Hello!
Could someone help me to convert this code to VB .NET:
----
[DllImport("Coredll.dll", EntryPoint="CreateProcess")]
public unsafe extern static int CreateProcess(
string imageName,
string cmdLine,
IntPtr lpProcessAttributes,
IntPtr lpThreadAttributes,
Int32 boolInheritHandles,
Int32 dwCreationFlags,
IntPtr lpEnvironment,
IntPtr lpszCurrentDir,
byte [] si,
ProcessInfo *pi
);
public struct ProcessInfo
{
public IntPtr hProcess;
public IntPtr hThread;
public Int32 ProcessId;
public Int32 ThreadId;
}
private unsafe static int StartProcess(string name, string parameters)
{
if (File.Exists(name))
{
ProcessInfo pi = new Win32API.ProcessInfo();
if (CreateProcess( name,
parameters,
IntPtr.Zero,
IntPtr.Zero,
0,
0,
IntPtr.Zero,
IntPtr.Zero,
null,
&pi
) != 0)
return 0;
else
{
int ret = Win32API.GetLastError();
return ret;
}
}
else
return 2; // 2 is file not found
}
----
Thanks in advance
Andreas
http://www.ab-archive.com