News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

MDI Client Window sends a WM_CREATE msg ?

Started by Rainstorm, July 09, 2011, 03:50:12 PM

Previous topic - Next topic

Rainstorm

hi.

am trying to create a child window in a MDI (with the client win as the parent) using the CreateWindowEx method.
I was trying to do this In the WM_CREATE msg, which is supposed to be sent whenever the CreateWindowEx function is used
I'd have to do it on the right WM_CREATE msg, but no WM_CREATE msg seems to be getting sent for the MDIClient win
one gets sent when the Frame window is made & thats it. I put a counter in the WM_CREATE msg to check
The MDI Client win is created using teh pre-registered MDICLIENT system Class
(there are 2 alternate methods of creating the chil-win without CreateWindowEx but just wondering whats the problem here)

~also just take a look at the msg loop to see if its okay

Thanks!

dedndave

your message box is in the "main" window code
it seems to work fine

in the child window code, it goes right to default proc
no message box

maybe you are a little confused, there   :P
notice that the WM_CREATE message for the main window will be sent to the WndProc for that window
the WM_CREATE message for the child window will be sent to the WndProc for that window

what i do is.....
1) in WndProc, i test the handle against the stored version
the stored version is 0 until it has been initialized
so, i only allow WM_CREATE if it is 0
i do that because i may handle more than 1 window in the same WndProc
2) in WM_CREATE, i initialize the stored handle, rather than doing it in WinMain
the valid handle is in the hWnd parm for WM_CREATE before it appears as the return value for CreateWindow   :bg
3) any additional windows that need to be created can be done in WM_CREATE

the message loop is probably ok
although, i don't read IF/THEN structures very well - lol
here is a message loop that is similar to the ones i use...
        lea     esi,msg
        xor     edi,edi
        jmp short mLoop1

mLoop0: INVOKE  TranslateMessage,esi
        INVOKE  DispatchMessage,esi

mLoop1: INVOKE  GetMessage,esi,edi,edi,edi
        neg     eax                                ;exit only
        shr     eax,1                              ;if 0 or -1
        jnz     mLoop0

;----------------------

;exit _main

        INVOKE  ExitProcess,[esi].MSG.wParam

i don't get a message box if there is an error
such errors aren't very likely (as in never)

Rainstorm

>>our message box is in the "main" window code

ya i just put the msg box there as a counter to check

thanks for the tips on the WM_CREATE processing

Quotenotice that the WM_CREATE message for the main window will be sent to the WndProc for that window
the WM_CREATE message for the child window will be sent to the WndProc for that window..

the child window in this case (for which am expecting the 2nd WM_CREATE msg) is the Client window & its a system class so there is no proc to handle it in my code, & i thought that it would send some notifications to the frameWindowProc (which is its Parent).

what am trying to do is create another child (of this Client window when it sends its WM_CREATE msg).

thanks

dedndave

i am not sure i understand what your problem is or exactly what you're trying to do and can't   :P

maybe you want something like WM_PARENTNOTIFY
http://msdn.microsoft.com/en-us/library/ms632638%28v=vs.85%29.aspx

Rainstorm

hi
my prob was i needed to get the WM_CREATE msg for the client window (wgich i've been unable to capture)- so are you suggesting that i create a wndproc for the client window ? what happens in the case of System classes to the WM_CREATE msg, on creation ? i was not planning on having a wndproc for the MDI client win cause its a system class.

Quotemaybe you want something like WM_PARENTNOTIFY
maybe i'll try & use that.. thx

dedndave

yah - you can examine wParam/lParam on WM_PARENTNOTIFY to see what the story is

however, it looks to me as though you have a window proc for the child
maybe i am not looking at the code right   :bg

Rainstorm

Quotehowever, it looks to me as though you have a window proc for the child
yes but that windowproc for child windows is for children of the client window.. not for the client window itself

FrameWindow -->ClientWindow--> child windows of the client

thats the heirarchy

so i'd assumed that the client window being a child of the framewindow & a system class would send its msgs to the FrameWindow Proc

dedndave

ohhhhhhh - so you will have more than 2 windows, total
that's where i was misunderstanding

in that case, WM_PARENTNOTIFY should work for you
it "trickles" up to the highest level window until it is processed

Rainstorm

Quote from the sdk for the CreateWINDOWEX function
QuotelpParam
[in] Pointer to a value to be passed to the window through the CREATESTRUCT structure passed in the lpParam parameter the WM_CREATE message. If an application calls CreateWindow to create a multiple-document interface (MDI) client window, lpParam must point to a CLIENTCREATESTRUCT structure

Thats what partly gave me the impression too

anyhow, many thx