Computing.Net > Forums > Programming > VB6 Shell command closing prg

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

VB6 Shell command closing prg

Reply to Message Icon

Original Message
Name: wt (by think)
Date: February 20, 2008 at 17:41:19 Pacific
Subject: VB6 Shell command closing prg
OS: windows 2003 server
CPU/Ram: ?
Model/Manufacturer: ?
Comment:

Hi,

Could anyone tell me why this is happening, while i am still trying to find any solution on the net. My knowledge about VB6 is very limited. Thanks!!

Our company has a small VB6 program, and so far I have managed to change it to run Acrobat.exe to view PDF files, using the Shell command. Problem happens when I close acrobat.exe (clicking the x at the left coner, or choosing File, exit) - it also closes the VB6 program! while it is supposed to be running until the user closes it.

But if I try to use it to open a txt file with notepad.exe, and close notepad.exe, it is ok - it does not close the VB6 program.

So how come it happens to the acrobat.exe and microsoft excell.exe, but not notepad.exe

extracted code:

success = FindExecutable(fileToOpen, filePath, sRusult)

If (success > 32) Then
pos = InStr(sRusult, Chr$(0))
If pos Then
exeProg = Left$(sRusult, pos - 1)
End If

runExe = Shell(sRusult & " " & filename, vbNormalFocus)
Else
...
...


thanks

wtk



Report Offensive Message For Removal


Response Number 1
Name: wt (by think)
Date: February 20, 2008 at 17:42:51 Pacific
Reply: (edit)

sorry, typing error:

If (success > 32) Then
pos = InStr(sRusult, Chr$(0))
If pos Then
sRusult = Left$(sRusult, pos - 1) ' not exeProg
End If

runExe = Shell(sRusult & " " & filename, vbNormalFocus)
Else
...
...


Report Offensive Follow Up For Removal

Response Number 2
Name: Razor2.3
Date: February 20, 2008 at 18:04:19 Pacific
Reply: (edit)

I suspect the problem is later on in the code; as soon as VB6 gets the PID from Windows, the program should continue on past the shell command.


Report Offensive Follow Up For Removal

Response Number 3
Name: wt (by think)
Date: February 20, 2008 at 19:50:55 Pacific
Reply: (edit)

hi,

the VB6 program continues, and it actually does nothing after the Shell command.

and if i continue to use this program to open another PDF file, the already-open acrobat.exe displays this file without error.

but closing acrobat.exe, it also closes (maybe clashes?) the VB6 program.

thanks

wtk


Report Offensive Follow Up For Removal







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home








Do you have your own blog?

Yes
No
I did before
I will soon


View Results

Poll Finishes In 4 Days.
Discuss in The Lounge
Poll History




Data Recovery Software