| takze by sme zacali standartnou kostrou:
#include"zaklad.h"
HINSTANCE g_hInstance;
HWND hWnd;
const TCHAR szMenoApp[] = TEXT("cavte");
//////////////////////////////////////////////////////////////////////////////
//PROCEDURA OKNA
LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg,WPARAM wParam,LPARAM lParam)
{
switch ( uMsg)
{
case WM_DESTROY:
PostQuitMessage(0);
break;
}
return DefWindowProc(hWnd, uMsg ,wParam ,lParam);
}
//////////////////////////////////////////////////////////////////////////////
//registracia triedy okna a vytvorenie okna
BOOL Inicializacia()
{
WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = (WNDPROC)WindowProc;
wcex.cbClsExtra =0;
wcex.cbWndExtra =0;
wcex.hInstance= g_hInstance;
wcex.hIcon = LoadIcon(g_hInstance,MAKEINTRESOURCE(IDI_SKULL));
wcex.hIconSm=LoadIcon(g_hInstance,"IDI_SKULL_SM");
wcex.hCursor=LoadCursor(NULL,IDC_ARROW);
wcex.hbrBackground =GetSysColorBrush(COLOR_WINDOW);
wcex.lpszMenuName = NULL;
wcex.lpszClassName = szMenoApp;
if (!RegisterClassEx(&wcex))
return FALSE;
hWnd = CreateWindowEx(0,szMenoApp,TEXT("MISKO:)"),WS_OVERLAPPEDWINDOW,100,50,800,600,
(HWND)NULL,(HMENU)NULL,g_hInstance,NULL);
if(!hWnd) return FALSE;
ShowWindow(hWnd,SW_SHOW);
return TRUE;
}
//////////////////////////////////////////////////////////////////////////////
//Hlavna funkcia programu pre Windows
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPTSTR lpCmdLine,int nCmdShow)
{
MSG msg;
g_hInstance=hInstance;
if (!Inicializacia() )
return -1;
//Hlavna slucka sprav
while (GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}
|
|