<DllImport("kernel32.dll")> _

Private Shared Function CreateProcess()Function CreateProcess(ByVal lpApplicationName As String, ByVal lpCommandLine As String, ByVal lpProcessAttributes As IntPtr, _
ByVal lpThreadAttributes As IntPtr, ByVal bInheritHandles As Integer, ByVal dwCreationFlags As Integer, _
ByVal lpEnvironment As IntPtr, ByVal lpCurrentDirectory As String, ByRef lpStartupInfo As STARTUPINFO, _
ByRef lpProcessInformation As PROCESS_INFORMATION) As Boolean
End Function

<StructLayout(LayoutKind.Sequential)> _

Private Structure STARTUPINFOStructure STARTUPINFO
Public cb As Integer
Public lpReserved As String
Public lpDesktop As String
Public lpTitle As String
Public dwX As Integer
Public dwY As Integer
Public dwXSize As Integer
Public dwYSize As Integer
Public dwXCountChars As Integer
Public dwYCountChars As Integer
Public dwFillAttribute As Integer
Public dwFlags As Integer
Public wShowWindow As Int32
Public cbReserved2 As Short
Public lpReserved2 As IntPtr
Public hStdInput As IntPtr
Public hStdOutput As IntPtr
Public hStdError As IntPtr
End Structure

<StructLayout(LayoutKind.Sequential)> _

Private Structure PROCESS_INFORMATIONStructure PROCESS_INFORMATION
Public hProcess As IntPtr
Public hThread As IntPtr
Public dwProcessId As Integer
Public dwThreadId As Integer
End Structure

<DllImport("shell32.dll")> _

Private Shared Function ShellExecuteEx()Function ShellExecuteEx(ByRef lpExecInfo As SHELLEXECUTEINFO) As Integer

End Function

<StructLayout(LayoutKind.Sequential)> _

Public Structure SHELLEXECUTEINFOStructure SHELLEXECUTEINFO
Public cbSize As Integer
Public fMask As Integer
Public hwnd As IntPtr
Public lpVerb As String ' /* Action,edit,open,print
*/
Public lpFile As String '; /* According to the value of lpVerb,always set to the filename */
Public lpParameters As String '; /* Parameters chars */
Public lpDirectory As String '; /* Directory */
Public nShow As Integer
Public hInstApp As IntPtr
Public lpIDList As Integer
Public lpClass As String
Public hkeyClass As IntPtr
Public dwHotKey As Integer
Public hIcon As IntPtr
Public hProcess As IntPtr
End Structure
posted on
2005-10-18 11:29 James Wong 阅读(233) 评论()
编辑 收藏