Start a process

  • Thread starter Thread starter Frank Kreißel
  • Start date Start date
F

Frank Kreißel

Hi,

is there a possibility to start a process (for example Internet explorer)
out of an application with compact framework 1!

(on CF 2.0 there is the process-class)

Greetings...
Frank
 
Frank,

You can use PInvoke and CreateProcess:

public class ProcessInfo
{
public IntPtr hProcess;
public IntPtr hThread;
public Int32 ProcessId;
public Int32 ThreadId;
}

[DllImport("CoreDll.DLL", SetLastError=true)]
private 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 static bool CreateProcess( String ExeName, String CmdLine,
ProcessInfo pi )
{
if ( pi == null )
pi = new ProcessInfo();
byte [] si = new byte[128];
return CreateProcess(ExeName, CmdLine, IntPtr.Zero,
IntPtr.Zero,
0, 0, IntPtr.Zero, IntPtr.Zero, si, pi) != 0;
}
 
You need to P/Invoke CreateProcess, this should help you in the right
direction

[DllImport("coredll", EntryPoint="CreateProcess",
SetLastError=true)]
private extern static bool CreateProcess(string pszImageName,
string pszCmdLine, IntPtr psaProcess, IntPtr psaThread, int
fInheritHandles, int fdwCreate, IntPtr pvEnvironment, IntPtr pszCurDir,
IntPtr psiStartInfo, ProcessInfo pi);

--
I hope this helps

--
Norman Rericha
Senior Software Engineer
Applied Data Systems
www.applieddata.net
An ISO 9001:2000 Registered Company
Microsoft WEP Gold-level Member
 
Back
Top