• Advertisement

Archived

This topic is now archived and is closed to further replies.

running executables in C#

This topic is 5061 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
quote:
Original post by CoffeeMug
google

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]

Share this post


Link to post
Share on other sites

  • Advertisement