Solved

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

Posted on 2006-11-14
7
361 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

707 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

19 Experts available now in Live!

Get 1:1 Help Now