Solved

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

Posted on 1999-01-28
6
170 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
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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Fully specialized class template function 21 136
thread-safe code in c++ 2 101
Which Linux flavors will this run on? 6 87
Autosar OS Multicore Share Resources confusion ? 2 38
When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
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 tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

772 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