Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GetWindow/GetClassName

Status
Not open for further replies.

jrl237

IS-IT--Management
Jan 29, 2002
61
US
I'm converting some VB6 code to VB.net. A section of the code uses the Windows API to read text from a label in another application. I use the FindWindow API call to get the handle of the form I want, then use GetWindow to iterate through the objects on the form. I use GetClassName to find the type of the object, and then GetWindowText to actually read the value. This works great under VB6.

Under VB.net, I get a handle from FindWindow but I can't find anything after that. The handle returned seems too big. For example, Spy++ shows the handle of the form I'm looking for to be 00090662 but FindWindow returns 895000100090662. I have everything declared as Long.

Is this a difference between the way VB6 and .net store values? What do I need to do to get the correct handle?

Any help would be greatly appreciated.

jrl
 
VB6 Longs are VB.Net Integers
VB6 Integers are VB.Net Shorts
 
Oh, and if anyone knows a better way to do this in .net, that would be good as well. I don't want to rewrite this entire procedure, but I will if there's a better way.

 
Thanks strongm. I should have tried that before I posted. I Changed all the Longs to Integers and all is well.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top