Window Styles

I am developing a small application where i have main window Wnd1 that contains a child window as a form Form1. This child window contains in it turn another child window and some popups that are created when a push button pressed.

The problem is that the child windows of Form1 are not created due to the style of the windows. I dont know what style to use. I tried ws_popup but it didnt work as well.

below is the code sample of creating all windows:

1
2
3
4
5
6
7
8
9
10
11
12
13
Wnd1_v = CreateWindowEx (WS_EX_APPWINDOW, wndClass.lpszClassName, wndTitle_p, WS_CLIPCHILDREN | WS_OVERLAPPEDWINDOW | WS_VSCROLL, 
                         x_p, y_p, width_p, hight_p, NULL, (HMENU)wndId_p, hInst_p, NULL);


exStyle_v = WS_EX_APPWINDOW;
style_v = WS_CHILDWINDOW | WS_CAPTION | WS_BORDER;

Form1_v = CreateWindowEx (exStyle_v, wndClass.lpszClassName, wndTitle_p, style_v, x_p, y_p, 
                          width_p, hight_p, Wnd1_v, (HMENU)frmId_p, hInst_p, objPtr_p);

style_v = WS_POPUP;
hWnd_v = CreateWindowEx (0, popCls_v.lpszClassName, TEXT("LOV"), style_v, 
                         150, 220, 140, 170, Form1_v, (HMENU)2600, hInst_p, NULL);


I tried to assign Wnd1_v as parent window of the popup window but it didnt work as well.

Please any ideas what I'm having wrong?
Last edited on
Wen I specified the style as WS_CHILD | WS_CAPTION for the 3rd window, it was created but NOT SHOWEN. Then I set its parent to be Wnd1_v so it showed. This is not what I need. I want its parent to be Form1_v and not Wnd1_v.
Furthermore, I noticed that Form1_v window is always on top of the 3rd window. Which style is causing this? What I need is having the active form or window on the top of all other windows.

Besides, any ideas on how and when to use the WS_POPUP and WS_POPUPWINDOW styles.
I had checked the explaination of MSDN about window style and extended styles, but they are confusing and not that clear in some cases.

Please advise.
Last edited on
is it possible to post the whole code??
I think with WS_POPUP you have to call SetParent after creating it. WS_POPUP creates a client-only window; no border or title bar.
1- It is difficult to post the whole code because each window is being created in a different class with a lot of checking and structures initialization. However, my previous post shows exactly how CreateWindowEx was used in my code.

2- Regarding: WS_POPUP creates a client-only window;
Thanks for the info. I didnt know. But then what about WS_POPUPWINDOW? How it may help?

3- And what i have to do to set Form1_v as the parent of the 3rd window insted of Wnd1_v?

4- When I move a window (Form1_v or the 3rd window) on the top of the other, and then move way, the windows are NOT REDRAWN. I guess I have to handle some messages like WM_PAINT, however, this message is not generated for those windows. I am printing to a file all the generated messages and WM_PAINT was not generated neither for the Form1_v window nor for the 3rd window.

What do you suggest..
Thanks in advance
created but NOT SHOWEN

Are you calling ShowWindow on the window with SW_SHOW?

Or tried adding the WS_VISIBLE flag to the style?

WS_CHILDWINDOW | WS_CAPTION | WS_BORDER | WS_VISIBLE

(or WS_CHILD, which is the same as WS_CHILDWINDOW)

Note that WS_POPUP means it pops up, like a normal (popup) dialog. So you don't want that style, if I get you right (you want to embed the form in the parent window?)

Andy

PS If you aren't already using it, GetSystemMetrics() -- with SM_CXEDGE, SM_CYEDGE, SM_CYCAPTION -- might help make the positioning logic a bit more insensitive to system settings?
Last edited on
Topic archived. No new replies allowed.