WINAPI beginner guidance question
Posted
by
gekod
on Programmers
See other posts from Programmers
or by gekod
Published on 2012-09-14T12:28:14Z
Indexed on
2012/09/17
9:50 UTC
Read the original article
Hit count: 220
I'm learning to develop windows applications using WINAPI and plain C.
Now I got a bit confused with all those handles and would like to ask if you guys could teach me some good practices to structure and handle controls and windows.
Here's where I get confused:
Using the IDs declared in the resources for each object, we can get their handles using GetDlgItem(). Now what if we don't know their parent, which is needed by this function.
One example: We have the main window created at launch. Then we register two new window classes and create a window for each new class and we create a message function for each too. Now if inside one of the children windows I create a button and inside the other child window I create a text label. Now when we click the button inside of child window A the label in child window B shall be modified to whatever.
The WM_COMMAND for the button is interpreted inside the message loop for child window A. Now what would be the best and more elegant way to access the text label inside the child window B?
I am in the process of learning the WINAPI and just want to learn it right from the start instead of producing Hacked code that someday becomes unreadable and to later have to adapt to a new way of programing.
© Programmers or respective owner