Ishamel
May 31st, 2000, 06:05 PM
Hi there,
I am writing some VB code that will automatically start up
a third party application.
When this third party application starts up, the user would
normally select two things - a session, followed by an
environment.
I can automatically select the session by passing in a
command-line parameter, however I am not sure how to go
about selecting an environment.
The environment options are listed in a ListBox control and
I have used the FindWindow & FindWindowEx API's, to get the
handle of this listbox
Can anyone tell me how to select an item from the Listbox
so the third party application starts-up completely.
Here is the code I have come up with so far....
Private Declare Function FindWindowEx Lib "user32.dll" Alias "FindWindowExA" (ByVal hwndParent As Long, ByVal hwndChildAfter As Long, ByVal lpszClass As Any, ByVal lpszWindow As Any) As Long
Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As Any, ByVal lpWindowName As Any) As Long
Dim RetVal
'Start up the Third Party application, passing in a Command-Line parameter
RetVal = Shell("C:\INFOCONN\ACCMGR\ACCMGR.EXE C:\INFOCONN\ACCMGR\ENV1.XWP", 3)
'At this point the application has started and a session has been
'selected automatically. Now there is a listbox of available
'environments to choose from.
'Attempt to locate a window called "Select INFOConnect Path"
Dim hWnd As Long
hWnd = FindWindow(CLng(0), "Select INFOConnect Path")
If hWnd <> 0 Then
'The window "Select INFOConnect Path" has been found.
'Now look for the Listbox control
Dim hWndListBox As Long
hWndListBox = FindWindowEx(hWnd, 0, "ListBox", CLng(0))
If hWndListBox <> 0 Then
'ListBox has been found
'This is where I want to select an environment so
'that the application will start up completely
'without any interference from the user.
End If
End If
Thanks for your time. Any help would be much appreciated.
I am writing some VB code that will automatically start up
a third party application.
When this third party application starts up, the user would
normally select two things - a session, followed by an
environment.
I can automatically select the session by passing in a
command-line parameter, however I am not sure how to go
about selecting an environment.
The environment options are listed in a ListBox control and
I have used the FindWindow & FindWindowEx API's, to get the
handle of this listbox
Can anyone tell me how to select an item from the Listbox
so the third party application starts-up completely.
Here is the code I have come up with so far....
Private Declare Function FindWindowEx Lib "user32.dll" Alias "FindWindowExA" (ByVal hwndParent As Long, ByVal hwndChildAfter As Long, ByVal lpszClass As Any, ByVal lpszWindow As Any) As Long
Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As Any, ByVal lpWindowName As Any) As Long
Dim RetVal
'Start up the Third Party application, passing in a Command-Line parameter
RetVal = Shell("C:\INFOCONN\ACCMGR\ACCMGR.EXE C:\INFOCONN\ACCMGR\ENV1.XWP", 3)
'At this point the application has started and a session has been
'selected automatically. Now there is a listbox of available
'environments to choose from.
'Attempt to locate a window called "Select INFOConnect Path"
Dim hWnd As Long
hWnd = FindWindow(CLng(0), "Select INFOConnect Path")
If hWnd <> 0 Then
'The window "Select INFOConnect Path" has been found.
'Now look for the Listbox control
Dim hWndListBox As Long
hWndListBox = FindWindowEx(hWnd, 0, "ListBox", CLng(0))
If hWndListBox <> 0 Then
'ListBox has been found
'This is where I want to select an environment so
'that the application will start up completely
'without any interference from the user.
End If
End If
Thanks for your time. Any help would be much appreciated.