Matt Ellison
September 24th, 2001, 10:20 AM
I know someone has a good ShellExecute handler for VB. Can i have a copy of the code? THanks
|
Click to See Complete Forum and Search --> : ShellExecute Matt Ellison September 24th, 2001, 10:20 AM I know someone has a good ShellExecute handler for VB. Can i have a copy of the code? THanks Iouri September 24th, 2001, 10:44 AM The regular "Shell" command won't open files, just execute them. To open files with Word, Excel, Notepad - whatever, use this API - ShellExecute: Public 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 Public Const SW_SHOWNORMAL = 1 Dim iRetVal as Long iRetVal = ShellExecute(Me.hwnd, "open", "C:\bootlog.txt", vbNullString, "c:\", SW_SHOWNORMAL) This will open notepad and have notepad open the bootlog.txt file (if it exists). "open" to open or execute "print" "explore" Iouri Boutchkine iouri@hotsheet.com Matt Ellison September 24th, 2001, 11:18 AM Actually i'm executing a batch file. So instead of open do i use run? Iouri September 24th, 2001, 11:40 AM I beleive it must be 'open' Iouri Boutchkine iouri@hotsheet.com codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |