Hello Everybody,

I am using ShellExecute function to restart the computer in DOS. When it is running in DOS (not a DOS window) I want to launch a 16 bit app. How to do this? I tried passing simple arguments like 'cd\' or 'autoexec' to the ShellExecute function but this doesn't work. Can anyone point me in the right direction? Can anyone explain what constitutes a parameter in this case. All the SDK tells is that parameters can be separated with a space. Any help or suggestions will be appreciated.

best regards,

Posted on 2002-10-13 11:31:31 by czDrillard
I don't use win9x but this is how I spawn another process. First it opens cmd.exe then passes a parameter (szPrm).

mthd DB "open", 0
szApp DB "cmd.exe", 0
szPrm DB "/c mspaint.exe", 0



invoke ShellExecute, NULL, OFFSET mthd, OFFSET szApp, OFFSET szPrm, NULL, SW_SHOW

invoke ExitProcess, 0

end start
Might as well place all your DOS commands to a .bat file then put this .bat file in the default folder where DOS starts up then just type the name of this .bat file to execute the DOS commands.
Posted on 2002-10-13 16:01:47 by stryker
you have to create a .pif file - copy it from _default.pif - and supply this file as parameter to ShellExecute.
Posted on 2002-10-14 06:32:35 by japheth
Thanks japheth and stryker for pointing me in the right direction. I will be more clear in what I'm trying to do.

1) I run my app from windows and it shuts down windows and restarts in MS-DOS

2) The 16 bit app is launched and this overwrites the swap file which is no longer in use.

3) On completion windows is re-started, a flag is set and windows is shut down and the power is shut off.

Numbers (1) and (2) work well but the computer hangs when I try to re-start windows by issuing the command 'win'.

Btw, I want to shut the power off the computer because overwriting the swap file takes a few minutes so I want to be able to run the app and walk away without waiting for it to finish and I don't know of any way to shut off the power from within DOS

best regards,

Posted on 2002-10-15 09:34:42 by czDrillard
I would check the APM BIOS functions for shutdown from within DOS. Its the Int 15h, AX=53xx functions. Check RB interrupt list for details.

just looked myself. This real mode code may turn off a APM pc:

mov ax,5301h
mov bx,0000
int 15h
mov ax,5307h
mov cx,0003h
mov bx,0001h
int 15h
Posted on 2002-10-16 03:37:32 by japheth
Thanks japheth

best regards.

Posted on 2002-10-18 10:01:49 by czDrillard