News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

starting other programs

Started by nrdev, June 16, 2009, 01:51:39 PM

Previous topic - Next topic

nrdev

How can I start other (console) programs via one program made in masm? I want to make one program that will start another, and save info from it.

dedndave

truthfully, go "hack" someplace else

qWord

hi,

Use CreateProcess() and pass a file-handle (CreateFile,OpenFile...) to STARTUPINFO.hStdOutput . The created Process (console-application) will write it output to the specified file.

regards, qWord
FPU in a trice: SmplMath
It's that simple!

Vortex

Hi nrdev,

Here is a quick example for you :


.386
.model flat,stdcall
option casemap:none

include     \masm32\include\windows.inc
include     \masm32\include\kernel32.inc

includelib  \masm32\lib\kernel32.lib


.data

app         db 'C:\Windows\notepad.exe',0

.data?

startinfo   STARTUPINFO         <?>
processinfo PROCESS_INFORMATION <?>

.code

start:

    invoke  CreateProcess,ADDR app,0,0,0,0,0,0,0,\
            ADDR startinfo,ADDR processinfo
           
    invoke  ExitProcess, 0

END start


Slugsnack

you could also use shellexecute