| Код | #include <windows.h>
LRESULT CALLBACK HelloWorldWndProc (HWND, UINT, UINT, LONG ); int WINAPI WinMain ( HINSTANCE hinstance, HINSTANCE hPrevInstance, LPSTR ipszCmdParam, int nCmdShow ) {
HWND hWnd ; WNDCLASS WndClass; MSG Msg; char szClassName[] = "HelloWorld"; WndClass.style =CS_HREDRAW | CS VREDRAW; WndCiass.lpfnWndProc = HelloWorldWndProc; WndClass.cbClsExtra = 0; WndClass.cbWndExtra = 0; WndClass.hlnslance = hInstance; WndClass.hIcon=LoadIcon (NULL, IDI_APLICATION); WndClass.hCursor=LoadCursor (NULL, IDC_ARROW); WndClass.hbrBackground=(HBRUSH) GetStockObject (WHITE_BRUSH); WndClass.lpszMenuName=NULL; WndClass.lpszClassName=szClassName;
if (!RegisterClass(&WndClass)) { MessageBox(NULL,"Cannot register class","Error", MB_OK); return 0; }
hWnd=CreateWindow(szClassName, "Program No1", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL,NULL, hInsatnce, NULL);
if (!hWnd) { MessageBox (NULL,"Cannot create window","Error", MB_OK); return 0; } ShowWindow(hWnd, nCmdShow); UpdateWindow(hWnd);
while (GetMessage(&Msg,NULL,0,0)) { TranslateMessage(&Msg); DispatcMessage(&Msg); } return Msg.wParam; }
LRESULT CALLBACK HelloWorldWndProc (HWND hWnd, UINT Message, UINT wParam, LONG lParam) { HDC hDC; PAINTSTRUCT PaintStruct; RECT Rect; switch (Message) { case WM_PAINT: hDC=BeginPaint(hWnd, &PaintStruct); GetClientRect(hWnd, &Rect); DrawText (hDC,"Hello World!", -1, &Rect, DT_SINGLELINE | DT_CENTER | DT_VCENTER); EndPaint(hWnd, &PaintStruct); return 0; case WM_DESTROY: PostQuitMessage(0); return 0; } return DefWindowRpoc(hWnd, Message, wParam, lParam); }
|
при попытке компиляции выдаёт следующую ошибку: fatal error C1010: unexpected end of file while looking for precompiled header directive в чём проблема?? заранее спасибо! |