Archived

This topic is now archived and is closed to further replies.

Getting hWnd

This topic is 5114 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok, i want to get the hWnds for three contols within my window (note, not mfc) two edits and a button, i know of a way, but this seems to be...unflexible (GetWindow()) then get next and stuff, is there a better way? and how do you use the EnumChildWindows() ?? because this seems to be the answer -Dan Yes I realize im a n00b...

Share this post


Link to post
Share on other sites
When you create them you have to specify an ID, whether or not you create them on the fly or in a resource editor (or in a resource by hand). When you create controls on the fly the ID is what you pass casted to an HMENU. When you use an editor the ID is the name you give to the control.


Colin Jeanne | Invader''s Realm

Share this post


Link to post
Share on other sites
Sometimes it''s a handle to a menu, sometimes it''s a window id. In the case of top level windows it''s typically a menu. In the case of child windows, such as edit controls and buttons, it''s an id.

Share this post


Link to post
Share on other sites
Ok, sweet, but how do i get the ID''s from the wndproc to the winmain? or is it that IDs are usually constants, and thus you can acess them from the winmain that way? if so....this seems at least a little bit unflexible, but ill take what i can get, i suppose another way would be enumeration? well anyways... thanx

-Dan

Yes I realize im a n00b...

Share this post


Link to post
Share on other sites
Yeah, IDs are generally constants (#defines) when they are created at compile time. We are talking about C++ here so flexibility is not always at its highest level. It is the programmer''s position to find ways around any of these limitations!

Share this post


Link to post
Share on other sites
You might want to look through MSDN or WinProg.Org for some answers. If you are on a newbie level, WinProg will help a lot. You might have heard of MSDN, it is the Microsoft Software Development Network, and a complete reference is on the MSDN website.

Scott Simontis
e-mail:ageofscott@comcast.net
AIM:ssimontis

Share this post


Link to post
Share on other sites
Thanx, msdn is great, but the only thing i come up with when i search msdn for controls.... is mfc... and right now im asking more application than what the prototype is anyways, as for wndprog, sounds like a plan, thanx

-Dan

Yes I realize im a n00b...

Share this post


Link to post
Share on other sites