Results 1 to 7 of 7

Thread: VB6 Switching Focus

  1. #1

    Thread Starter
    Frenzied Member joefox's Avatar
    Join Date
    Oct 2004
    Posts
    1,318

    VB6 Switching Focus

    how do you find the name of a window you want to change focus to?

  2. #2
    Giants World Champs!!!! Mark Gambo's Avatar
    Join Date
    Sep 2003
    Location
    Colorado
    Posts
    2,965

    Re: VB6 Switching Focus

    Quote Originally Posted by joefox
    how do you find the name of a window you want to change focus to?

    Take a look at this link
    Regards,

    Mark

    Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."


  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: VB6 Switching Focus

    Quote Originally Posted by Mark Gambo
    Take a look at this link
    If you aren't a member you can't view the solution.

  4. #4
    Giants World Champs!!!! Mark Gambo's Avatar
    Join Date
    Sep 2003
    Location
    Colorado
    Posts
    2,965

    Re: VB6 Switching Focus

    Ok:

    VB Code:
    1. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    2. Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    3. Private Const WM_CLOSE = &H10
    4.  
    5. Private Sub Form_Load()
    6.    Dim lngHwnd As Long
    7.    lngHwnd = FindWindow(vbNullString, "MyApp")
    8.    SendMessage lngHwnd, WM_CLOSE, 0, 0
    9.    End
    10. End Sub

    But you will have to know the name of form inorder to use this code.
    Regards,

    Mark

    Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."


  5. #5

    Thread Starter
    Frenzied Member joefox's Avatar
    Join Date
    Oct 2004
    Posts
    1,318

    Re: VB6 Switching Focus

    How do i find the name of the form? do i use spy ++?

    this is what i found in spy++

    Last edited by joefox; Apr 28th, 2006 at 03:23 PM.

  6. #6
    Frenzied Member litlewiki's Avatar
    Join Date
    Dec 2005
    Location
    Zeta Reticuli Distro:Ubuntu Fiesty
    Posts
    1,162

    Re: VB6 Switching Focus

    name of a form in your app or some others apps form ??
    __________________
    ________________0îîî___
    ___îîî0________(___)____
    __(___)_________) _/_____
    ___\_ (_________(_/______
    ____\_)_________________

  7. #7

    Thread Starter
    Frenzied Member joefox's Avatar
    Join Date
    Oct 2004
    Posts
    1,318

    Re: VB6 Switching Focus

    Hummmm ?!?!?!?!

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