Solved

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

Posted on 1999-01-28
6
182 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
6 Comments
 
LVL 22

Expert Comment

by:nietod
ID: 1185426
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
ID: 1185427
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
ID: 1185428
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
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 
LVL 3

Author Comment

by:SuperMario
ID: 1185429
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
ID: 1185430
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
ID: 1185431
That should do it! Thanks a ton.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
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++.

627 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