CreateProcess

CreateProcess

Bild des Benutzers rswy

Hi,
I was using 'winexec' to edit data files using notepad in my application.I read recently that winexec is good only for 16 bit and createprocess should be usedfor applications.
However I am not able to use createprocess successfully.For starters I do not know what to use for the startupinfo and process information structure.Can anyone give me an example using createprocess.
Can Shellexecute be used instead or is it also only 16 bit compatible?
--rswy

2 Beiträge / 0 neu
Letzter Beitrag
Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.
Bild des Benutzers james@elementyl.com

Example code:

program ed
use dfwbase
use kernel32
implicit none
type (T_STARTUPINFO) si
type (T_PROCESS_INFORMATION) pi
call ZeroMemory (LOC(si), SIZEOF(si))
call ZeroMemory (LOC(pi), SIZEOF(pi))
si%cb = SIZEOF (si)
si%dwFlags = STARTF_USESTDHANDLES
if (CreateProcess(NULL,'notepad junk.txt'c,NULL,NULL,FALSE,0,NULL,NULL,si,pi) /= 0) then
  print *, 'Process created', pi%dwProcessId
else
  print *, 'CreateProcess error', GetLastError()
end if
end program ed

James

Melden Sie sich an, um einen Kommentar zu hinterlassen.