Solved

nietod, or anyone... ugh, still confused! help!

Posted on 1999-01-28
6
163 Views
Last Modified: 2010-04-16
OkAy...

Now that I know which functions to use, I still don't know exactly HOW to use them.

How would EnumChildWindows() find an edit box? Does it find the resource ID?

Can I get some code for this?
D
0
Comment
Question by:SuperMario
  • 4
6 Comments
 
LVL 22

Expert Comment

by:nietod
Comment Utility
Once you have the parent window you call EnumChildWindows() specifing the parent window's handle and a pointer to a callback procedure you've written.  windows will call your callback function for each child window that the specified window has.  for each window, check to see if it is the edit box window, if so, you've found it, do whatever you want with it and then return FALSE, to stop enumeration.   If it is not the target window, return TRUE to continue enumeration.

You can test if a window is an edit box by looking at its class name.  You obtain that with GetClassName().
0
 
LVL 3

Author Comment

by:SuperMario
Comment Utility
Okay...
I tried EnumWindows, but.. I honestly have no clue how to implement this into code. I'm sorry I'm being so dense about it. I need just... code. I'm a visual learner.
D
0
 
LVL 3

Author Comment

by:SuperMario
Comment Utility
oo0o0o0....

Using Spy ++, I found the handle, class, style and rect of the edit box. So now, how would I put text into this window w/ the given info?

Thanks so much,
D
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 3

Author Comment

by:SuperMario
Comment Utility
Now that I found this, I tried just changing its caption. It sucks though, because no matter what I try I get a "This program has performed an illegal operation" because of an unhandled exception in MFC42D.DLL.\

This is getting mighty confusing.
D
0
 
LVL 8

Accepted Solution

by:
Answers2000 earned 0 total points
Comment Utility
I missed any previous question, but here's how to use the functions you mention

1. Code

// the enumeration call-back
BOOL CALLBACK EnumChildProc( HWND hWndChild, LPARAM lParam )
{
char szClassName[256] ;
GetClassName( hWndChild, szClassName, sizeof szClassName )

if ( 0 == _strcmpi( szClassName, "edit" ) )
{
 // hWndChild is the child edit control, do whatever you need here
}

return TRUE ;
}


// in your main code
EnumChildWindows( hWndParent, (WNDENUMPROC)EnumChildProc, 0 ) ;

2. If the call-back function is a member of class make sure it's a static member, e.g.

class CSomeClass
{
static BOOL CALLBACK CSomeClass::EnumChildProc( HWND hWndChild, LPARAM lParam )
} ;

BOOL CALLBACK CSomeClass::EnumChildProc( HWND hWndChild, LPARAM lParam )
{
// etc
}


3. Note - when you call EnumChildWindows the last parameter get's passed into the LPARAM of the EnumChildProc function.  You can use this to pass any data type you want.  As a pointer will fit into LPARAM simply cast a pointer to whatever data structure the call back function might need.
0
 
LVL 3

Author Comment

by:SuperMario
Comment Utility
That should do it! Thanks a ton.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now