|
-
Jun 20th, 2005, 11:41 AM
#1
Thread Starter
Member
Problem Running Application Using Shell Command
Hi, running application in vb made my project easy by using Shell(appPath,windowstate) command.
now, i got a list of applications in my database with its correct path, the prob is, when i try to run those application one-by-one, they all run except for one application which is the most important applications for my client pc (because it is the most favorite application of my costumers), but the program runs abnormally when i run it using shell command, i checked the application's path, but it is correct, when i try to run that application w/o my prog, it ran normally, even its shortcut on my desktop, normal!
What probablly the problem is??
I think it's not with my code, cuz the other application runs normaly, except with that application. BDY, the application i am talkin' bout is a game application, do you know MU Online? by Mobius? it is an online game like Ragnarok!!! also ragnarok runs normally in my project, except really MU...
But when i compiled my program and create the exe file, i try to paste that exe program to the folder where MU resides, then i run my prog, then click the button, THEN iT RAN NORMALLY!?!?!... i check out the properties of MU's shortcut in my desktop, there I see 2 paths: the "target" path w/c is the whole path of the application including the mu.exe file, the other is the "start in" path, where also display the application path but excluding the mu.exe file.
i think the problem is within the application i am trying to run, not in my program, or maybe there is something wrong with the shell command, maybe parameters or sumthin'....
does anyone encounter this type of problem???
then if so, can you share it to this forum, so that i can find a solution to my problem... and it will gladly appreciated!!!... thanx....
BuB'
Last edited by Apollyon255; Jun 20th, 2005 at 12:24 PM.
Reason: Resolved
-
Jun 20th, 2005, 11:53 AM
#2
Re: Problem Running Application Using Shell Command
Try running it with ShellExecute API.
-
Jun 20th, 2005, 11:55 AM
#3
Re: Problem Running Application Using Shell Command
The "start in" path is the working directory for your app.
baja yu suggestion to use the ShellExecute API allows you to specify the working directory. Shell doesnt.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jun 20th, 2005, 11:57 AM
#4
Thread Starter
Member
Re: Problem Running Application Using Shell Command
Thankz for reply...
i don't know how to use that API call or function, i ain't got any code for using it..
but if you have or know, then please do post it here...
appreciated...
-
Jun 20th, 2005, 12:01 PM
#5
Re: Problem Running Application Using Shell Command
Test.txt is located on my D drive but because I specify the working directory (D:\) it can find the text file in there
without specifing the entire path.
VB Code:
Option Explicit
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Const SW_SHOWNORMAL As Long = 1
Private Sub Command1_Click()
ShellExecute Me.hwnd, "Open", "C:\Windows\Notepad.exe", "Test.txt", "D:\", SW_SHOWNORMAL
End Sub
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jun 20th, 2005, 12:03 PM
#6
Thread Starter
Member
Re: Problem Running Application Using Shell Command
thankz, i'll try the code now, and reply imediately the results....
thnkx for reply...
-
Jun 20th, 2005, 12:12 PM
#7
Thread Starter
Member
Re: Problem Running Application Using Shell Command
WoW!!!! thats realy workz!!! i don't even think about using an API call for that prob...
Thankz a millon!!!! Really appreciated... this forum site really good!!!...
i'm really still juz a beginner!!! hehehe....
-
Jun 20th, 2005, 12:16 PM
#8
Re: Problem Running Application Using Shell Command
baja_yu should get some credit too for suggesting the API. 
I just showed you how to use it. 
Ps, dont forget to 'Resolve' your thread so others will know its been solved.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jun 20th, 2005, 12:32 PM
#9
Thread Starter
Member
Re: Problem Running Application Using Shell Command
Yeah, OK i did, but last one... can you explain me the parameters used in that API call function (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) so that i can improvized my way of running application!, i know the use of lpFile, lpParameters and lpDirectory, the others, nope... can you? and advice me for other feature and uses of this API call... cuz it is really my first time to use an API call or function... Thnx again...
BuB'
-
Jun 20th, 2005, 12:39 PM
#10
Re: Problem Running Application Using Shell Command
Sure no problem.
The first parameter is the owner of the to be sheelled process. Usually you can make the form that is shelling it as the owner - Me.hWnd.
The second parameter is the operation you want shellexecute to perform. You can do an "Open" or a "Print" if its a printable file.
For ex. if you shellexecute'd notepad and passed a textfile as the parameter and specified "Print" then it would not open and display
notepad but rather only print the textfile.
The last parameter nShowCmd is for the windowstate you want it to be shelled in. Either show normal, minimized, maximized, or hidden
or a few other minor variations.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jun 20th, 2005, 01:16 PM
#11
Thread Starter
Member
Re: Problem Running Application Using Shell Command
Thankx very much.. Got It...
'til next time...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|