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
|
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
freopen("out.txt", "wb", stdout); // For debug only
std::cout << "Open!" << std::endl;
LPCTSTR szClassName = L"BackgroundWindow";
WNDCLASSEX wc;
MSG msg;
wc.cbSize = sizeof(WNDCLASSEX);
wc.style = 0;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = NULL;
wc.hCursor = NULL;
wc.hbrBackground = 0;
wc.lpszMenuName = NULL;
wc.lpszClassName = szClassName;
wc.hIconSm = NULL;
if(!RegisterClassEx(&wc))
{
return 0;
}
CreateWindowEx(WS_EX_NOACTIVATE, szClassName, 0, WS_OVERLAPPEDWINDOW, 0, 0, 0, 0, HWND_DESKTOP, NULL, hInstance, NULL);
while(GetMessage(&msg, NULL, 0, 0) > 0)
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
std::cout << "Closed!" << std::endl;
}
|