running executables in C#
hi everyone. i wanted to ask about how to run an executbale from C# using threads. i am develping an application for a pocket pc using the emulator is C# and using the .NET framework. The process class is not supported for windows ce.
thanks
bob
quote:Original post by CoffeeMug
None of those(on the first page, anyway) answers how to do it using the Compact Framework.
How about P/Invoking ShellExecute or CreateProcess? Are those Win32 functions available on CE?
A P/Invoke declaration for ShellExecute looks something like this:
[DllImport("Kernel32.dll")] public static extern int CreateProcess( string appName, string commandLine, IntPtr processAttributes, IntPtr threadAttributes, bool inheritHandles, int creationFlags, IntPtr environment, string currentDir, ref STARTUP_INFO si, out PROCESS_INFORMATION pi ); [StructLayout ( LayoutKind.Sequential )] public struct PROCESS_INFORMATION { public IntPtr hProcess; public IntPtr hThread; public int dwProcessId; public int dwThreadId; } [StructLayout ( LayoutKind.Sequential )] public struct STARTUP_INFO { public int cb; public string reserved; public string desktop; public string title; public int wX; public int wY; public int xSize; public int ySize; public int xCountChars; public int yCountChars; public int fillAttributes; public int flags; public short showWindow; public short cbReserved2; public byte lpReserved2; public IntPtr stdInput; public IntPtr stdOutput; public IntPtr stdError; }
(Yes, I had it readily available. Thanks to Colin, who actually wrote it).
--
AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.
[Project site] [Blog] [RSS] [Browse the source] [IRC channel]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement