|
-
Mar 22nd, 2004, 04:29 PM
#1
Thread Starter
Fanatic Member
[RESOLVED] Shell command
Hello
I'm looking to run a script file I have created using the shell command. It works great for running batch files, but it crashes when I try to use it to run my script file. (The script file is very similiar to how batches run) Here is my code:
If intVerify(1) = 11500 Then
MsgBox "11500 does not match"
Call Shell("S:\MIS\Scripts\Speciality_Fore.msl")
I really just want VB to open this file. That alone will kick off the script. Any help would be greatly appreciated.
James
-
Mar 22nd, 2004, 04:36 PM
#2
Frenzied Member
Search on Shellexecute and use that instead of Shell.
-
Mar 22nd, 2004, 04:46 PM
#3
To clarify:
Shell() executes a .exe/application. If you want to open a specific file then
include the app and file in the Shell. Like Shell appname filename
Alternatly, (as mentioned) you can use the ShellExecute API.
It will run the native application associated with the passed file.
Bruce.
-
Mar 22nd, 2004, 05:19 PM
#4
Fanatic Member
Her eis the shell execute.
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
Const SW_SHOWNORMAL = 1
Private Sub Form_Load()
'KPD-Team 1998
'URL: [url]http://www.allapi.net/[/url]
'Send an E-Mail to the KPD-Team
ShellExecute Me.hwnd, vbNullString, "mailto: [email protected]", vbNullString, "C:\", SW_SHOWNORMAL
End Sub
-
Jul 23rd, 2004, 11:23 AM
#5
Fanatic Member
Shell loads App into Processes and not Desktop?
Hello,
I am trying to shell notepad from my app (a service).
It's telling me that it is loaded, however it is not being displayed on the desktop. I've checked the task manager and it's not there, but it is listed in the processes
Does anyone know why this is happening? Is there a better way of doing it?
Here is a my code -
VB Code:
If Not modAppRunning.CheckForProcByExe(strAppName) Then
' Not found start it
retVal = Shell(notepad.exe, vbNormalFocus)
If retVal <> 0 Then
MsgBox "Started by the Service (" & NTService.DisplayName & ")"
Else
MsgBox "Error With Launch!"
End If
Else
MsgBox "Already Running"
End If
Cheers Al
-
Jul 23rd, 2004, 11:28 AM
#6
Fanatic Member
Apologies
Sorry Guys I mean't to post the above as a new Post and not a reply
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
|