-
Does anyone know how to open a program like notepad or anything else without the OLE control(I want to be able to click on a command button to open the program) ??
I'm guessing it's the "OpenFile" API call...
Public Declare Function OpenFile Lib "kernel32"_
Alias "OpenFile" (ByVal lpFileName As String, lpReOpenBuff_ As OFSTRUCT, ByVal wStyle As Long) As Long
if it is, then what do i use for lpReOpenBuff ??
thnx!!
-
I'm thinking you actually want
Code:
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
td.
-
oh, and
Code:
Public Declare Function FindExecutable Lib "shell32.dll" Alias "FindExecutableA" (ByVal lpFile As String, ByVal lpDirectory As String, ByVal lpResult As String) As Long
will give you the exe associated with a given file.
td.
-
-
OFSTRUCT
if you need it...
Code:
Public Type OFSTRUCT
cBytes As Byte
fFixedDisk As Byte
nErrCode As Integer
Reserved1 As Integer
Reserved2 As Integer
szPathName as String * 28
'/szPathName(OFS_MAXPATHNAME) As Byte
End Type
ignore Reserved1 and 2
cBytes is the length of the struct
fFixedDisk is not zero if your reading of a disk
nErrCode is a error identifier (there's a big list of 'em)
szPathName is the full path name to the file (using the OEM char set)
wStyle is a flag setting for the open operation (OF_CREATE, OF_READ, OF_DENY_READ etc)
td.
-
thnx again.
For the ShellExecute function, it wants a window handle.
handle from which window ?
-
It wants the handle to tell who the owner is.
Give it something like me.hWnd (e.g. your hWnd of your form)
td.
-
k, tnx 4 the help
much appreciated.
-
The OpenFile function creates, opens, reopens, or deletes a file.
Yes I did get that straight from MSDN