Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > Help! Waiting until a program loads!


Reply
 
Thread Tools Display Modes
  #1  
Old 03-17-2003, 05:58 AM
Samhane Samhane is offline
Newcomer
 
Join Date: Mar 2003
Posts: 4
Exclamation Help! Waiting until a program loads!


I am working on a launcher program. I am using the acitvex list control. When the user runs the laucher it will pull up their list of specified programs and then log the users on. The problem that I am having is I have to wait until the program finishes loading before sending the keystrokes. I have tried a timer but it does not work.. Does anyone have any suggestions??? Please HELP!
Reply With Quote
  #2  
Old 03-17-2003, 07:08 AM
Ales Zigon's Avatar
Ales Zigon Ales Zigon is offline
Dead dog's ghost

Forum Leader
* Expert *
 
Join Date: Feb 2001
Location: Celje, Slovenia, Europe
Posts: 2,601
Default

You should probably check, if the target window is enabled (that would mean it is capable of receiving messages) with IsWindowEnabled API call.
__________________
Yes, MSDN comes with VB! Yes, you must have at least 25 post to have an avatar! No, you cant write your OS in VB! and NO, YOU CAN NOT DECOMPILE IT!

I'm sure there are things that are more important than me - I just can't thing of any...
Reply With Quote
  #3  
Old 03-17-2003, 09:10 AM
Samhane Samhane is offline
Newcomer
 
Join Date: Mar 2003
Posts: 4
Default

etmswindow = IsWindowEnabled(enterprise.hwnd)

is the *.hwnd the actual process or the name of the application in the window??? I have tried to use it but maybe I am doing something wrong...


On Error GoTo ErrHandler
Dim itm As ListItem
Dim ctr As Integer

ctr = 0
For Each itm In lvwApp.ListItems
'If itm.Checked Then
txtStatus = txtStatus & "Launching Application " & itm.text & "... "
ScrollText
On Error Resume Next 'launch the application
Call Shell(arrApp(itm.Index - 1).Path, vbNormalNoFocus)
DoEvents


etmswindow = IsWindowEnabled(etmsprod.hwnd)
If etmswindow <> 0 Then

AppActivate ("Enterprise Trouble Management System")
SendKeys ("{DEL}{DEL} {DEL} {DEL} {DEL} {DEL} {DEL} {DEL} {DEL} {DEL} {DEL} {DEL} {DEL} {DEL} {DEL} {DEL} {DEL} {DEL} {DEL} {DEL} {DEL} ")
SendKeys ("mgress {TAB}")
SendKeys ("password03 {ENTER}")
End If
'End If

If Err.Number <> 0 Then
txtStatus = txtStatus & Err.Description & "." & vbCrLf
Err.Clear
Else
txtStatus = txtStatus & "OK." & vbCrLf
End If
On Error GoTo ErrHandler
ScrollText

Next


ErrHandler:
txtStatus = txtStatus & "Error: " & Err.Description & vbCrLf & "Done."
ScrollText

End Sub
Reply With Quote
  #4  
Old 03-18-2003, 01:15 AM
Ales Zigon's Avatar
Ales Zigon Ales Zigon is offline
Dead dog's ghost

Forum Leader
* Expert *
 
Join Date: Feb 2001
Location: Celje, Slovenia, Europe
Posts: 2,601
Default

What is "etmsprod"? IS it the name of the called application?
As the argument to the function you must pass the handle to the application window. To get it, you should probably use GetWindow or GetWindowDC and pass it thru.
__________________
Yes, MSDN comes with VB! Yes, you must have at least 25 post to have an avatar! No, you cant write your OS in VB! and NO, YOU CAN NOT DECOMPILE IT!

I'm sure there are things that are more important than me - I just can't thing of any...
Reply With Quote
  #5  
Old 03-18-2003, 06:04 AM
Samhane Samhane is offline
Newcomer
 
Join Date: Mar 2003
Posts: 4
Default

Etmsprod is the application - One of the many actually. I will try what you mentioned. Unfortunately, I am new to VB and was wondering if you hand any syntax usage of that command. Thanks, Mark
Reply With Quote
  #6  
Old 03-18-2003, 06:06 AM
Samhane Samhane is offline
Newcomer
 
Join Date: Mar 2003
Posts: 4
Default

The problem that I am having is I have to log the user onto about 5 different applications so I am going to have to find out which window handle corresponds to each program and then send the specific keystrokes and passwords for each program. I have finished everything else and I am stuck on this. 8-(
Reply With Quote
  #7  
Old 03-18-2003, 06:17 AM
Robse's Avatar
Robse Robse is offline
Senior Contributor

* Expert *
 
Join Date: Sep 2002
Location: Karlsruhe, Germany
Posts: 1,319
Default

Not sure if this is what you need, but you can find out
each window's name using the GetWindowText() API,
cycling through every active window using GetActiveWindow()
and GetWindow() API's
__________________
Posting Guidelines MSDN-VB API List Use [vb]...[/vb] tags for code!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
call another program and obtain status code after program is closed cosito7777 General 1 01-06-2003 02:55 PM
waiting for called program to finish macgyver2 General 4 06-28-2002 09:16 AM
Opening a program and waiting for it to finish planet-boss General 2 05-09-2002 06:33 PM
waiting for a form to close to continue a program saryon General 6 01-14-2002 05:50 AM
Executing a program... then waiting. skubik General 3 05-09-2001 09:32 AM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->