連結已複製
10 回應
You can always go to http://msdn.microsoft.com for documentation on system routines. Here is an example with CreateProcess:
program example 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, & DETACHED_PROCESS,NULL,NULL,si,pi) /= 0) then print *, 'Process created', pi%dwProcessId else print *, 'CreateProcess error', GetLastError() end if end program exampleJames
Okay ... I copied the code from the example and I get all sorts of compile errors about the actual arguments not matching dummy argument type. Here's my code ... let me know what you think.
program MIKE
use kernel32
implicit none
INTEGER INSTANCE,X
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
INSTANCE=CreateProcessNULL,'C:WINNTNOTEPAD',NULL,NULL,&
FALSE,DETACHED_PROCESS,NULL,NULL,si,pi)
end program MIKE
program MIKE
use kernel32
implicit none
INTEGER INSTANCE,X
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
INSTANCE=CreateProcessNULL,'C:WINNTNOTEPAD',NULL,NULL,&
FALSE,DETACHED_PROCESS,NULL,NULL,si,pi)
end program MIKE