Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
// start m_ain.h
#include <windows.h>
// fonction prototypes
int WINAPI WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nShowCmd
);
LRESULT CALLBACK WindowProc(
HWND hWnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
);
// end m_ain.h
// start m_ain.cpp
#include "m_ain.h"
int WINAPI WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nShowCmd)
{
HWND hWnd;
MSG Msg;
WNDCLASSEX wcex = {
sizeof(WNDCLASSEX),
CS_CLASSDC,
WindowProc,
0L, 0L,
hInstance,
NULL, NULL, NULL, NULL,
"GameClass", NULL };
// register class exit on error
if(!RegisterClassEx(&wcex))
return FALSE;
hWnd = CreateWindow(
"skeleton", "the title",
WS_OVERLAPPEDWINDOW,
0, 0, 400, 400,
NULL, NULL, hInstance, NULL);
// return if error on CreateWindow
if(hWnd == NULL)
return FALSE;
// show the window
ShowWindow(hWnd, SW_SHOWNORMAL);
UpdateWindow(hWnd);
// Clear out message structure
ZeroMemory(&Msg, sizeof(MSG));
// loop until msg = exit
while(Msg.message != WM_QUIT) {
// peek into queue to see if there's message waiting
if(PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE)) {
TranslateMessage(&Msg);
DispatchMessage(&Msg);
} else {
// time-crusial stuff
}
}
// unreg class
UnregisterClass("skeleton", hInstance);
// exit
return 0;
}
// MSG procedure
LRESULT CALLBACK WindowProc(
HWND hWnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam)
{
switch(uMsg) {
case WM_DESTROY:
PostQuitMessage(0); // close app
break;
// handle other mesage here
default: return DefWindowProc(hWnd, uMsg, wParam, lParam);
}
return 0;
}
// end m_ain.cpp