Results 1 to 4 of 4

Thread: Selecting command buttons and other fuctions from a different program

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2001
    Posts
    98

    Selecting command buttons and other fuctions from a different program

    I know this has probably been asked alot around here, but how would I select something from a different Program, and also is there a way I can select something from a menu on another program in vb ?
    Visual basic 6.0 Enterprise Edition
    [email protected]

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Mar 2001
    Posts
    98
    ??
    Visual basic 6.0 Enterprise Edition
    [email protected]

  3. #3
    Frenzied Member
    Join Date
    Mar 2001
    Location
    You are HERE •™
    Posts
    1,300
    geoff_xrx had a post going a couple of days ago....trying to do something similar. Maybe do a search for his Name?

  4. #4
    Frenzied Member Microbasic's Avatar
    Join Date
    Mar 2001
    Posts
    1,402
    If you know the classes/captions, you can apply properties like WM_SETFOCUS to it:

    Code:
    'Code by: Microbasic
    Private Declare Function FindWindowEx Lib "user32" _
    Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, _
    ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
    
    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
    
    Private Const WM_SETFOCUS = &H7
    
    Function Find_hwnd(Text As String, ClassName As String, Optional Starthwnd As Long) As Long
        Find_hwnd = Findwindow(Starthwnd, ClassName, Text)
    End Function
    
    Sub FocusWin(hWnd As Long)
        SendMessage hwnd, WM_SETFOCUS, 0, 0
    End Sub
    Do you need a manual?


    MicroBasic
    Dragon Shadow Trainer

    There is no good or evil in the world...only programmers and fools .

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