Solved

Need to start an external application using VB.net & CF

Posted on 2006-11-14
7
363 Views
Last Modified: 2010-04-24
I either need to be able to send VK_OFF to the keyboard or I need to be able to start and external application using VB.net w/ CF.  Since I have not a clue how do send a vertual key and I have a utility the suspends the device I figured it would be easy to shell out and run the utility.   This however has not turned out to be so easy.

First I tried

 If File.Exists(strFile) Then
  intRslt = Shell(strFile,AppWinStyle.NormalFocus, True, -1)  
end if

This oddly enough generated a File Not Found Error even after passing the file.exist command.

Next I tried the following getting with the same result

 System.Diagnostics.Process.Start("sample.txt")

Both work wonderfully in the .NET Framework.  Not so well in the CF.  
0
Comment
Question by:Kmc86
  • 4
  • 3
7 Comments
 
LVL 16

Expert Comment

by:Hillwaaa
ID: 17944756
Hi Kmc86,

Basically the System.Diagnositics.Process() approach is the way to go.  It should work fine (according to msdn, it is supported by CF v2.0 - http://msdn2.microsoft.com/en-us/library/system.diagnostics.process.aspx).  

If you are still having trouble with file not found errors, try (as a test) putting the full path to the application (like c:\temp\sample.exe).

There is also a good article on this (although not for CF) at http://www.devx.com/dotnet/Article/7914

Let us know how you go.

Cheers!
0
 

Author Comment

by:Kmc86
ID: 17947576
When I couidn't get the shell command to work I did  some searching and I found that same article.  The sample code for it works great I actually block copied the code to make sure I wasn't overlooking a simple typo.  But unfortunately still no luck
0
 
LVL 16

Expert Comment

by:Hillwaaa
ID: 17950674
Ok, can you please post the code you are using to try and call your utility?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:Kmc86
ID: 17951354
It appears as though the shell and the system.diagnostics.process are not supported under the compact framework.  In order to do what I needed done I had to PInvoke.    Thanks anyway

0
 
LVL 16

Expert Comment

by:Hillwaaa
ID: 17951376
No worries - just check that you are using CF v2.0 - it should be supported - but at least you got it working!
0
 

Author Comment

by:Kmc86
ID: 17952693
I have tried it on CE4.1 & CE4.2  w/ CF 1.1  and CE5.0 with CF 2.0 and 2.0 w SP1.   If it is suppose to be supported Microsoft has screwed up.  SURPRISE!!!!!!!!!!!!!!!!  Thanks again
0
 
LVL 16

Accepted Solution

by:
Hillwaaa earned 500 total points
ID: 17952720
No worries - sorry to have not been more help!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Hide Tab Page 3 33
Protecting vb6 & .Net code Obfuscation 18 93
Unable  to create new object 9 38
Need a starter for ETL protocol? 4 31
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.

948 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now