Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Launching a windows 3rd party app without Shell 1

Status
Not open for further replies.

ddelk

Programmer
May 28, 2003
47
US
I want to execute a third party application using VB but without using Shell. Is this possible?
 
Yes. Any particular reason you don't like Shell? What are you needing to achieve that you need to specifically avoid Shell?

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'

for steam enthusiasts
 
look at the API ShellExecute... much cleaner than shell...

Also do you want to embed the application you run 'within' your application? This is also possible but a bit more work.
 
I see post after post regarding asynchronous issues with Shell. It seems to me there ought to be a way to skin this cat without using 3-4 more modules. All we are trying to do is run another app synchronously. Is Bill so far out that he can't figure a way to do that easily?
 
It's really easy if you want to run asynchronously..

You need to get the Process returned from shellexecute, then get the windowproc and see when the task has finished.. I suggest wrapping this in a class that raises an event at that point in time...

Its really easy if you want the code let me know.
 
I took your advice and looked up ShellExecute. The code is pretty straightforward. But still, you need 3-4 processes. Thanks for the advice. I'll come back to you if I get stuck.
 
WaitforSingleObject is probably what you're looking for. Try this:
There are some examples shown for usage

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'

for steam enthusiasts
 
>Is Bill so far out that he can't figure a way to do that easily?

Code:
[blue]Option Explicit
Private Const WshNormalNoFocus As Long = 4
Private Const WshNormalFocus As Long = 1

Private Sub Command1_Click()
        CreateObject("wscript.shell").Run "notepad", WshNormalNoFocus, True
End Sub
[/blue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top