1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' \
processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#include <windows.h>
class cMain
{
public:
cMain( HINSTANCE hInstance, int nCmdShow )
{
WNDCLASSEX wc;
wc.cbSize = sizeof(WNDCLASSEX);
wc.style = 0;
wc.lpfnWndProc = &cMain::WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_ICON1));
wc.hIconSm = (HICON)LoadImage(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_ICON1),IMAGE_ICON,16,16,0);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = GetSysColorBrush(COLOR_3DFACE);
wc.lpszMenuName = NULL; //MAKEINTRESOURCE(IDR_MENU1);
wc.lpszClassName = "Main Window";
RegisterClassEx(&wc);
hwnd = ::CreateWindowEx ( WS_EX_CLIENTEDGE, "Main Window", "Window Caption", WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, 340, 410, NULL, NULL, hInstance, NULL);
ShowWindow(hwnd, nCmdShow);
UpdateWindow(hwnd);
}
HWND Handle() { return hwnd; }
private:
// Inhibit copy/assignments of this class
cMain( const cMain& ) {}
cMain& operator= ( const cMain& ) {}
cMain( cMain&& ) {}
cMain& operator= ( cMain&& ) {}
// Members
HWND hwnd ;
static LRESULT CALLBACK WndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
/* STUFF HERE */
return 0;
}
};
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
cMain TheApp(hInstance, nCmdShow);
MSG Msg;
while(GetMessage(&Msg, NULL, 0, 0) > 0)
{
if (!IsDialogMessage(TheApp.Handle(), &Msg))
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
}
return Msg.wParam;
}
|