When do you create child windows?
I was wondering if there was a reason to call CreateWindow() for child windows from outside the WndProc(). Ive been studying this in my Win32 book, and from what I can gather it looks like if you want to create a static child window, then you should create it outside the main WndProc. For other things it looks like you should call CreateWindow() during the processing of a WM_CREATE message. Theres not nearly enough examples in this book for me to come up with a rule of thumb to live by, so I thought I would ask the experts... What criteria do you use to gauge when/where you should call CreateWindow()? Thanks!
There is no spoon.
HEY MODERATOR!! We need to be able to change message titles so people will read good questions with boring titles!
For those of you who do read this, where do you call CreateWindow?? In WinMain or WndProc? What about for static clidren? Non static children? A question of style!!
For those of you who do read this, where do you call CreateWindow?? In WinMain or WndProc? What about for static clidren? Non static children? A question of style!!
There is no spoon.
November 07, 2000 01:17 PM
It doesn''t matter. Do it whichever way you want.
What I usually do is if I have a static set of windows I want then I call CreateWindow for each of them in my initialization routine rather than doing it in the WM_CREATE handler. The only reason is that if one of the creates fails it''s easier to step through the code if all the calls are in the same spot.
-Mike
What I usually do is if I have a static set of windows I want then I call CreateWindow for each of them in my initialization routine rather than doing it in the WM_CREATE handler. The only reason is that if one of the creates fails it''s easier to step through the code if all the calls are in the same spot.
-Mike
As Mike mentioned, it is up to you to decide where you want to put your child creation routines. It''s all about preferences. What I would do is for static controls, I would create them in WM_CREATE, and for dynamic controls I would create them wherever I see fit.
If you don''t create them in WM_CREATE, your best bet is to put the code right after the code that creates the parent window.
Hope this helps!
-------------------------------
"Mind your own damn business!!!" - Gladiator
..-=gLaDiAtOr=-..
If you don''t create them in WM_CREATE, your best bet is to put the code right after the code that creates the parent window.
Hope this helps!
-------------------------------
"Mind your own damn business!!!" - Gladiator
..-=gLaDiAtOr=-..
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement