views:

65

answers:

1

Hi guys,

I have question regarding the CreateWindowEx function. I have 2 windows, a main one and a popup one. I want a popup window to hide everywhere. It is currently not displayed in taskbar and it is not even visible in alt+tab menu. However it is visible on "Applications" tab in task manager. What flags do I need to use in CreateWindowEx to hide my popup window from there?

Current code:

hHistoryWindow = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_NOACTIVATE | WS_EX_LAYERED, szAppName, L"HistoryWindow",  WS_EX_TOPMOST | WS_POPUP, WIDTH, TOP, width, height, NULL, NULL, hInstance, NULL);

I also wanted to ask, whether I need to release a bitmap resource from "static" window before using DestroyWindow() function? I set image to a "static" window this way:

SendMessage (hStatic, STM_SETIMAGE, (WPARAM)IMAGE_BITMAP, (LPARAM)hWhiteStone);

Is it enough to release hWhiteStone or do I need to release also handle returned by SendMessage() (- or is it done automatically by DestroyWindow)?

Thank you for any info.

Kra

+2  A: 

Make it a child of your main window. Do this by changing the fourth last parameter to the HWND of your main window. This SHOULD make windows treat your popup window as part of the same application as your main window.

Alexander Rafferty
I need this popup window to be displayed outside the "main" window. If I make a popup window a child, it will not be possible to display it :/
Kra
no, that will only happen if you specify the WS_CHILD style.
Alexander Rafferty
ahhh, good point. I always thought parent hWnd and WS_CHILD must be bound together. Thanks!
Kra
I think technically it's an *owned* window, not a *child* window.
jamesdlin
Thanks for clearing that up.
Alexander Rafferty