|
-
Aug 13th, 2001, 02:44 PM
#1
Thread Starter
Hyperactive Member
Shell Function
When I try to run a file with the Shell Function, I get an error message. Apparently, I cannot find the rest of the app. What's wrong
VB, ADO, SQL, 3DSMAX, DHTML, VBscript, Javascript, CSS
-Lars Espen Rosness
-
Aug 13th, 2001, 02:59 PM
#2
Member
Open a program (EXE) or a document (BMP, DOC, JPG, etc.)?
-
Aug 13th, 2001, 03:07 PM
#3
Thread Starter
Hyperactive Member
A program (with the EXE extension). The problem is that the program has to load an .ini file in that very same directory. But the program cannot find that file when the directory is set to my app. How can I change that. I know there's a way...
VB, ADO, SQL, 3DSMAX, DHTML, VBscript, Javascript, CSS
-Lars Espen Rosness
-
Aug 13th, 2001, 03:57 PM
#4
Fanatic Member
Post the code giving the problem and the exact error.
-
Aug 13th, 2001, 04:02 PM
#5
Thread Starter
Hyperactive Member
VB Code:
Private Sub Form_Load()
Me.Show
Label1.FontBold = True
Shell "C:\PunkBuster\PB.exe", vbNormalNoFocus
Label1.FontBold = False
End Sub
Dette er koden
VB, ADO, SQL, 3DSMAX, DHTML, VBscript, Javascript, CSS
-Lars Espen Rosness
-
Aug 13th, 2001, 04:14 PM
#6
Fanatic Member
Obviously, I don't have your "C:\PunkBuster\PB.exe" to test but I tried several different applications. Small to large to see if maybe a timing problem. All worked fine.
Nothing wrong with that code.....The PB.exe file runs ok on it's own ??
-
Aug 13th, 2001, 05:04 PM
#7
Thread Starter
Hyperactive Member
No, that's the problem. It requires the Pb.ini file. When I run the file from my app, the program Pb.exe does'nt understand to look for it in the PB.exe directory.
VB, ADO, SQL, 3DSMAX, DHTML, VBscript, Javascript, CSS
-Lars Espen Rosness
-
Aug 13th, 2001, 05:07 PM
#8
Frenzied Member
You just proved that sig advertisements work.
-
Aug 13th, 2001, 05:08 PM
#9
Fanatic Member
or you could use the shellexecuteex api
-
Aug 13th, 2001, 05:11 PM
#10
Thread Starter
Hyperactive Member
But that makes it a whole lot more complicated(Which I don't want, especially since I've never used or done any API...I don't even yet know what it is and what it's used for)
But thanks anyway!
VB, ADO, SQL, 3DSMAX, DHTML, VBscript, Javascript, CSS
-Lars Espen Rosness
-
Aug 13th, 2001, 05:14 PM
#11
Frenzied Member
Before you open the .ini file, use ChDir to change to its directory, whatever that may be.
You just proved that sig advertisements work.
-
Aug 13th, 2001, 05:15 PM
#12
Thread Starter
Hyperactive Member
VB, ADO, SQL, 3DSMAX, DHTML, VBscript, Javascript, CSS
-Lars Espen Rosness
-
Aug 13th, 2001, 06:20 PM
#13
Frenzied Member
well i was just wondering whether it solved your problem...
You just proved that sig advertisements work.
-
Aug 13th, 2001, 06:37 PM
#14
PowerPoster
ShellExecute is not complicated at all.
Just put this under General Declarations:
VB Code:
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
It may seem long, but you can just copy & paste it in there.
Next, put this to replace your current Form_Load() event:
VB Code:
Private Sub Form_Load()
Me.Show
Label1.FontBold = True
ShellExecute hwnd, "open", "C:\PunkBuster\PB.exe", "", "", 1
Label1.FontBold = False
End Sub
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
|