News:

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

1st child program

Started by shankle, June 26, 2011, 07:10:43 PM

Previous topic - Next topic

shankle

Thanks for any help.
This program is attempting to write two windows to the screen.
I suspect the handles/instances might be the problem because of my understanding
of them. Checked Petzold's book but it didn't seem to help.
See the attacked zip file.
The greatest crime in my country is our Congress

qWord

- you are using uninitialized local variables (hInst,frstchild)
- you should also think about the live time of a local variable
- do you want to create a top level window or a child window?
FPU in a trice: SmplMath
It's that simple!

shankle

Hi Qword,
Attempting to create two windows parent and child
The greatest crime in my country is our Congress

qWord

Quote from: shankle on June 26, 2011, 08:14:07 PM
Attempting to create two windows parent and child
a parent window with a child control? - see attachment.
FPU in a trice: SmplMath
It's that simple!

dedndave

you can create the child in the WM_CREATE code of the parent
sometimes a bit messy to share the same WndProc for both - sometimes, not so bad
to get started, it is probably easier to seperate them

qWord

Using one WndProc is only useful/makeable for windows that doesn't need the use of global variables - however, this can be break by using the extra memory associate with current window (WNDCLASS.cbWndExtra)
FPU in a trice: SmplMath
It's that simple!

hutch--

Jack,

Its good advice to use a separate WndProc for each window, either parent or child. About the only time you safely use a common WndProc is for identical controls in the form of a subclass.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

shankle

Thanks Hutch,
Didn't know I could do that.
Will give it a shot.
The greatest crime in my country is our Congress