Ben_Stanton Posted June 11, 2009 Posted June 11, 2009 (edited) Basically, I am pooh pooh. Long time since I have programmed anything other than the microwave to ding in 4 minutes my ruby murry! What I need is the code to call a program already on the device. It a very basic 2 button form. Button1 calls \sdmmc\app1\app.exe Button2 calls \sdmmc\app2\app.exe ********************************** Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click End Sub ********************************** I need all code, assume I know nothing (I actually don't). I am doing it in dev studio\vb\smartdeviceapplication. I tried the shell command (as per vb) but no go. Simples - as our friend Mr Meerkat would say! THAAAAANKS (i'd even paypal a fiver to the person that gives working code) Edited June 11, 2009 by Ben_Stanton
powdarrmonkey Posted June 11, 2009 Posted June 11, 2009 This is how I'd do it on a big machine: System.Diagnostics.Process.Start("notepad") but with a CE device your mileage may vary. (substitute some other process for 'notepad')
Guest monkeyx Posted June 11, 2009 Posted June 11, 2009 Can't take credit for this, but google can. But here c# pinvoke example which could be converted to vb.net. As some sites suggest that System.Diagnostics.Process.Start is not in winCE but that may be dated info? Duncan King For anyone who's been following this (or has the same problem) - here's the code that actually works: public class Externals { [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 ); [DllImport("CoreDll.dll")] private extern static Int32 GetLastError(); private static bool CreateProc( 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; } public static void LaunchIE() { if(!CreateProc("iexplore.exe", "http://pocketpc.msn.co.uk";, null)) { throw new Exception("Could not launch IE"); } } } public class ProcessInfo { public IntPtr hProcess; public IntPtr hThread; public Int32 ProcessId; public Int32 ThreadId; }
Ben_Stanton Posted June 11, 2009 Author Posted June 11, 2009 Wow, monkies (or is it monkeys) everywhere today! System.Diagnostics.Process.Start does not work. Will try code above _ I couldn't find anything on the googly woogly! Seems like lots of code just to call one app...
Ben_Stanton Posted June 11, 2009 Author Posted June 11, 2009 Thinking about it, I have visual studio so if you can write code in c# that would do too
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now