Click to See Complete Forum and Search --> : How to create toplevel borderless window?


p.ribet
April 23rd, 2003, 06:36 AM
Hi all!

I'd like to create a window like the ones used for menus, contextual menus or combo box (while the list is open).

For this, I need some toplevel borderless window. I tried this:
new_window_handle = CreateWindow(CLASSNAME, WINNAME, WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, CW_USEDEFAULT, CW_USEDEFAULT, new_window_width, new_window_height, NULL, NULL, main_hInstance, NULL);

The problem are:
- this window appears in the taskbar,
- the main window is not the active window anymore (the "blue title bar" is back to gray color).

Then I tried this:
new_window_handle = CreateWindowEx(WS_EX_TOOLWINDOW, CLASSNAME, WINNAME, WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, new_window_x, new_window_y, new_window_width, new_window_height, NULL, NULL, main_hInstance, NULL);

This solved the first problem but not the second one.

Does anybody have any idea?
I read many docs but didn't find anything...
Where could I look for?

Thanks for any advice!

rsmemphis
April 23rd, 2003, 06:55 AM
I tried something similar myself, and I have seen exactly the same problem. The way I solved it for myself is to use SetWindowRgn(...);
Not pretty, and I will follow this thread hoping for a better answer.

JamesUK
April 24th, 2003, 07:06 AM
The problem is not really with the Window Styles (although you definitely don't want WS_OVERLAPPED*).

Your problem is that the new window is not owned by any other window in your application, so it becomes a top-level application window, which could appear on the task bar.

The solution is to give the parent window handle in the hWndParent parameter to CreateWindow[Ex].

This means that the parent window (application) remains active (blue).

Hope this helps.
James