Results 1 to 2 of 2

Thread: How to set focus on object located out of the form?

  1. #1

    Thread Starter
    Registered User Lior's Avatar
    Join Date
    Jan 2000
    Posts
    307

    Question

    Hi...
    I have a little problem:
    I cant set focus on object which is NOT located on the form.
    Let's say I run the program EXTERNAL.EXE, it has 3 objects on its form. When I set focus on the EXTERNAL form, I can set focus with TAB on these 3 objects.

    Let's say I wanna set focus on object with TabIndex=1 located at the EXTERNAL.EXE form,
    How do I do this with a VB program?

  2. #2
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    If you ca find out its hWnd then you can use the setFocus API

    Code:
    Private Declare Function SetFocus Lib "user32" Alias "SetFocus" (ByVal hwnd As Long) As Long
    but I'm not sure how Tabindex's are handled (I don't thinks it's Window's reponsibility to do the tapping, I think it's the programs, which would make it very hard)

    but you could try setting the focus to the parent window of all the controls, that will probably get you to the first item in the taborder.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width