Solved

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

Posted on 2006-11-14
7
365 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

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…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

808 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