Solved

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

Posted on 2006-11-14
7
366 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

730 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