How can you create a window without caption and border using CreateWindowEx()? And I why do you use '|' OR operator to combine styles instead of '&' And?
int WINAPI WinMain(....)
{
MSG msg;
WNDCLASS wc={0};
wc.lpszClassName="MyClass";
wc.lpfnWndProc=DefWindowProc;//You MUST use your own wndproc here
wc.hInstance=hInstance;
wc.hbrBackground=(HBRUSH)(COLOR_3DFACE+1);
wc.hCursor=LoadCursor(NULL,IDC_ARROW);
if (!RegisterClass(&wc)) {/*Handle Error*/}
HWND hwnd;
hwnd=CreateWindowEx(0,wc.lpszClassName,0,WS_POPUP|WS_VISIBLE|WS_SYSMENU,9,9,99,99,0,0,0,0);
if (!hwnd) {/*Handle Error*/}
while(GetMessage(&msg,0,0,0)>0)DispatchMessage(&msg);
return 0;
}
If you want a border, you can add WS_BORDER or WS_DLGFRAME (Not both). If you don't want to show the window in the taskbar, add the WS_EX_TOOLWINDOW extended style.
As to why you need to bitwise OR the styles; OR will combine all the style values, AND is used (by windows) to check which styles are set. Say we had two styles (WS_FOO=1,WS_BAR=2):
See wikipedia for more info.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With