Click here to Skip to main content
15,909,747 members
Home / Discussions / C#
   

C#

 
QuestionRe: Virtual keyboard losing window focus. Help! Pin
savitabelgaonkar7-Dec-10 4:52
savitabelgaonkar7-Dec-10 4:52 
QuestionHow to write document in 2 pages Pin
Atdhe1-Jul-07 13:25
Atdhe1-Jul-07 13:25 
QuestionCollections Pin
haz131-Jul-07 11:14
haz131-Jul-07 11:14 
AnswerRe: Collections Pin
Luc Pattyn1-Jul-07 11:39
sitebuilderLuc Pattyn1-Jul-07 11:39 
GeneralRe: Collections Pin
haz132-Jul-07 1:32
haz132-Jul-07 1:32 
AnswerRe: Collections Pin
RepliCrux1-Jul-07 13:20
RepliCrux1-Jul-07 13:20 
QuestionFaster dialog form display Pin
Jud White1-Jul-07 9:25
Jud White1-Jul-07 9:25 
QuestionHow to run a Win16 program? [modified] Pin
Mackster2111-Jul-07 8:48
Mackster2111-Jul-07 8:48 
Hi folks,

I've got a 16-bit Windows application that I'm trying to run from within a C# WinForms application, but it throws "Win32Exception was unhandled - the parameter is incorrect".

How do you call a 16-bit app from C#?

Here's what I've got. Apologies if this is too much information, but I figured I should err on the side of too much rather than too little.

System.Diagnostics.Process p = new System.Diagnostics.Process();<br />
p.StartInfo.FileName = "c:\\My16BitApp.exe";<br />
p.StartInfo.UseShellExecute = true;<br />
p.Start();<br />
p.WaitForExit();


I can run my 16-bit app successfully by going to Start > Run and typing in "c:\My16BitApp.exe" so I know XP can handle it. As a sanity check, I also created a batfile (RunMy16BitApp.bat) that contains the following:

c:\My16BitApp.exe<br />
pause


When I run that bat file from the command line (or Run dialog) it works fine. If I run the bat file from C# using Process.Start(), the following message is displayed in the cmd window:

c:\My16BitApp.exe<br />
The system cannot execute the specified program.<br />
<br />
pause<br />
Press any key to continue


What am I missing? Thanks for your help!

Cheers,
Kevin

[Edit]

MSDN has the following information, which brings me back to where I am (trying to run a 16-bit program from a 32-bit program):

Failure to Start
If the Shell function cannot start the named program, a FileNotFoundException error occurs. This can happen, for example, when you attempt to run a 16-bit program, such as command.com, from an application using System.Windows.Forms. For a workaround, you can run a 32-bit program that calls the desired 16-bit program. In the case of command.com, you can run cmd.exe as an alternative.





-- modified at 14:55 Sunday 1st July, 2007
AnswerRe: How to run a Win16 program? Pin
Luc Pattyn1-Jul-07 9:03
sitebuilderLuc Pattyn1-Jul-07 9:03 
GeneralRe: How to run a Win16 program? Pin
Mackster2111-Jul-07 9:10
Mackster2111-Jul-07 9:10 
GeneralRe: How to run a Win16 program? Pin
Luc Pattyn1-Jul-07 10:05
sitebuilderLuc Pattyn1-Jul-07 10:05 
QuestionDetermining when application is running in debug mode Pin
theFrenchHornet1-Jul-07 7:59
theFrenchHornet1-Jul-07 7:59 
AnswerRe: Determining when application is running in debug mode Pin
Luc Pattyn1-Jul-07 8:54
sitebuilderLuc Pattyn1-Jul-07 8:54 
GeneralRe: Determining when application is running in debug mode Pin
theFrenchHornet1-Jul-07 10:21
theFrenchHornet1-Jul-07 10:21 
GeneralRe: Determining when application is running in debug mode Pin
Luc Pattyn1-Jul-07 10:56
sitebuilderLuc Pattyn1-Jul-07 10:56 
GeneralRe: Determining when application is running in debug mode Pin
theFrenchHornet1-Jul-07 11:04
theFrenchHornet1-Jul-07 11:04 
GeneralMore on Task Manager Pin
Luc Pattyn1-Jul-07 11:30
sitebuilderLuc Pattyn1-Jul-07 11:30 
GeneralRe: Determining when application is running in debug mode Pin
theFrenchHornet3-Jul-07 8:19
theFrenchHornet3-Jul-07 8:19 
GeneralRe: Determining when application is running in debug mode Pin
Luc Pattyn3-Jul-07 11:00
sitebuilderLuc Pattyn3-Jul-07 11:00 
AnswerRe: Determining when application is running in debug mode Pin
Miguel Lopes1-Jul-07 11:57
Miguel Lopes1-Jul-07 11:57 
AnswerRe: Determining when application is running in debug mode - solution Pin
theFrenchHornet3-Jul-07 8:18
theFrenchHornet3-Jul-07 8:18 
QuestionPassing cmd line arguments to registry value during install Pin
Miguel Lopes1-Jul-07 6:27
Miguel Lopes1-Jul-07 6:27 
QuestionBig Problem with WebService Pin
Iftekhar Naim1-Jul-07 5:17
Iftekhar Naim1-Jul-07 5:17 
AnswerRe: Big Problem with WebService Pin
Guffa1-Jul-07 6:37
Guffa1-Jul-07 6:37 
GeneralRe: Big Problem with WebService Pin
Iftekhar Naim1-Jul-07 14:00
Iftekhar Naim1-Jul-07 14:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.