Пытаюсь сделать в точности по инструкции. Но вылазят 12 ошибок.
Вот код:
#include <Windows.h>
LRESULT CALLBACK SoftwareMainProcedure(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp);
WNDCLASS NewWindowClass(HBRUSH BGColor, HINSTANCE hinst, HICON Icon, LPCWSTR Name, WNDPROC Procedure);
int WINAPI WinMain(HINSTANCE hinnst, HINSTANCE hPrevInst, LPSTR args, int ncmdshow) {
WNDCLASS SoftwareMainClass = NewWindowClass((HBRUSH)COLOR_WINDOW, LoadCursor(NULL, IDC_ARROW), hInst, LoadIcon(NULL, IDI_QUESTION),
L"MainWndClass", SoftwareMainProcedure);
if (!RegisterClassW(&SoftwareMainClass)) { return -1; }
MSG SoftWareClassW = { 0 };
CreateWindow(L"MainWndClass", L"c++ window", WS_OVERLAPPEDWINDOW | WS_VISIBLE, 100, 100, 500, 250, NULL, NULL, NULL, NULL);
while (GetMessage(&SoftwareMainClass, NULL, NULL, NULL)) {
TranslateMessage(&SoftwareMainClass);
DispatchMessage(&SoftwareMainClass);
}
return 0;
}
WNDCLASS NewWindowClass(HBRUSH BGColor, HINSTANCE hinst, HICON Icon, LPCWSTR Name, WNDPROC Procedure) {
WNDCLASS NWS = { 0 };
NWC.hicon = Icon;
NWC.hCursor = Cursor;
NWC.histance = hInst;
NWC.lpszClassName = Name;
NWC.hbrBackground = BGColor;
NWC.lpfnWndProc = Procedure;
return NWC;
}
LRESULT CALLBACK SoftWareNaunProcedure(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) {
switch (msg) {
case WM_CREATE:
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default: return DefWindowProc(HWnd, msg, wp, lp);
}
}
Юникод поставлен, подсистема Windows - тоже.