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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Noob: How to cast a hwnd into an object? 1

Status
Not open for further replies.

stebboko

Technical User
Jul 16, 2007
4
0
0
AU
I'm just trying to set the focus to an edit box in another running application - so I've enumerated all the windows, found the right application, then enumerated its child windows to find the edit boxes handle.

Question - now I've got it's handle, how can I set focus to it? Can I somehow cast the handle into an edit box control, and then use the control object's setfocus method?

Thx


 
try
Code:
Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long
 
Thanks Justin - it worked a treat.

Stebboko
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top