Run exe Program (Immediately)

  • Thread starter Thread starter Bilsed
  • Start date Start date
B

Bilsed

Hi,
I have to run another exe inside my mobile appliction.
I know that this code for windows application.
"Process.Start("cmd.exe");" but, compact framework does not support Process
class. Do you know another way to handle with this problem?
 
You don't need OpenNetCF. Just call the WinCE API function:
Public Declare Function CreateProcess Lib "coredll.dll" Alias _

"CreateProcess" (ByVal imageName As String, ByVal cmdLine As String, ByVal _

lpProcessAttributes As Integer, ByVal lpThreadAttributes As Integer, ByVal _

boolInheritHandles As Int32, ByVal dwCreationFlags As Int32, ByVal _

lpEnvironment As Integer, ByVal lpszCurrentDir As Integer, ByVal si As _

Integer, ByVal pi As Integer) As Integer

Public Shared Function Execute(ByVal exeName As String, ByVal cmdLine As
String) As Integer

Return CreateProcess(exeName, cmdLine, 0, 0, 0, 0, 0, 0, 0, 0)

End Function
 
thank you so much, this code is run , but ý want to run paint.exe, and paint
dont run on windows ce version. Do you know paintexe or similar drawing
program on windows ce version?
 
Technically you don't even need Visual Studio .NET to write CF apps, there's
a way to do it with notepad. As a matter of fact, technically you don't
NEED the manged wrappers for the cf, you can P/INVOKE the native dll's too.

In that respect, you are right, you don't "NEED" anything OpenNETCF Does,
You don't need anything more than Notepad as far as IDE's go and you Don't
need much of the wrapped classes the CF offers. But please tell me what
benefit writing out the code for CreateProcess has over
"Process.Start("Program");? Since this is one of the more basic functions,
it's probably a safe bet that the person is a relatively new user. If they
use OpenNetCF, they'll have the benefit of a managed wrapper and they can
see the code underneath it. Since they provide the source code for it ,
you've effectively gotten them to the same place they would have arrived at
if they'd have followed Tims's advice. And that's not to mention that they
would have the side benefit of seeing what other things aren't supported
with a managed wrapper, what OpennetCf provides for them and what they
could save time and effort with in the future.

Isn't OOP all about Code Reuse? Then why recreate the wheel? If I
misinterpreted the intent or tone of your email, then I wholeheartedly
apologize for giving you short shrift. But assuming I didn't, I can't see
what benefit there is to steering someone away from something so helfpul,
useful and just cool as OpenNetCF.org. There's no group out there that's
even come close to them in terms of helping people with CF development and
making the CF transition a lot less painful.

Bill
 
Well said, Bill. And I'd just like to add that, since the source is freely
available, anyone can copy any portion of the SDF directly into their
application source and compile it. This might be more desirable for some
people that only require a very small portion of the SDF in one of their
applications. The good thing, in addition to what you said Bill, is that
calling Process.Start(...) is much better than calling CreateProcess(...) in
code as the CF in the future, I'm sure, will support the Process class as
well as the static Start method. It would be easier to refactor the code to
utilize Microsoft's implementation of Process.Start(...) than it would be to
search and replace every instance of CreateProcess(...) with
Process.Start(...) and the correct arguments. Using raw PInvoke calls
throughout an application sometimes isn't the nicest thing to do in regards
to long term code maintenance.
 
Tim
I'm new to this environment and have a question about the link supplied for the OpenNETCF SDF. I'm not sure what I'm supposed to do with the downloaded files to include the Process class in Visual Studio. I needed to start a .exe file from a button and found the Create Process code somewhere a few days ago. It works but I'd rather use a predefined class if its the proper way to write the code. Thanks

Rob
 
Do you need the entire SDF? Or do you just need the Process class? If you're
absolutely sure that you only need the Process class then you can always
download and include just this file in your application. If you're coding in
C# then you can simply add the file to your project. If your coding in
VB.Net then you can create a class library in C# add the file, compile it,
and then reference that assembly in your VB.Net application. Let me know if
you need anymore clarification on this.

--
Tim Wilson
..Net Compact Framework MVP
{cf147fdf-893d-4a88-b258-22f68a3dbc6a}
Rob said:
Tim,
I'm new to this environment and have a question about the link
supplied for the OpenNETCF SDF. I'm not sure what I'm supposed to do with
the downloaded files to include the Process class in Visual Studio. I
needed to start a .exe file from a button and found the Create Process code
somewhere a few days ago. It works but I'd rather use a predefined class if
its the proper way to write the code. Thanks.
 
Back
Top