- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, I have written on function like this to create a process...
---------------------------------------------------
logical function supershell (App , workdir)
use dfwin
use dflib
use DefineGlobalVarsModule
implicit none
type (T_STARTUPINFO) :: startupinfo
type (T_PROCESS_INFORMATION) :: processinfo
type (T_SECURITY_ATTRIBUTES) :: securityatt1, securityatt2
character*(MAX_PATH) path
integer ret
character*256 workdir,App,start_size
startupinfo%dwFlags = 0
startupinfo%cb = sizeof(startupinfo)
securityatt1%nLength = sizeof(securityatt1)
securityatt2%nLength = sizeof(securityatt2)
ret = CreateProcess (NULL , & ! Application Name
App, & !'"'//path(1:path_len)//'" -child'C, & ! Command line
NULL_SECURITY_ATTRIBUTES, &
NULL_SECURITY_ATTRIBUTES, &
TRUE, & ! InheritHandles
0, & ! CreationFlags
NULL, & ! Environment variables
"c:mdtwizardgemdt_program", & ! Current directory
startupInfo, &
processInfo)
if (ret == 0) then
ret = GetLastError ()
write (*,'(A,I0)') "Create process failed with error ",ret
else
! CreateProcess succeeded. Wait for the process to finish
!
ret = WaitForSingleObject (ProcessInfo%hProcess,INFINITE)
! Close handles, otherwise resources are lost
!
ret = CloseHandle (ProcessInfo%hThread)
ret = CloseHandle (ProcessInfo%hProcess)
end if
!return
end function supershell
-----------------------------------------------------
when I call this function
integer Ty
working_directory is the current working directory like
c:folder
Ty = supershell('isight',working_directory)
this does not create a thread nor nothing happens I am not able tounderstand why it is happening so...
I tried keeping 'isight' in the working directory also but still it does not work.
Iget an error saying 'isight' has an explicit type and does not have a type.
If i say
Ty = supershell('notepad',working_directory)then it works fine.
how can i get for 'isight' createprocess working????
---------------------------------------------------
logical function supershell (App , workdir)
use dfwin
use dflib
use DefineGlobalVarsModule
implicit none
type (T_STARTUPINFO) :: startupinfo
type (T_PROCESS_INFORMATION) :: processinfo
type (T_SECURITY_ATTRIBUTES) :: securityatt1, securityatt2
character*(MAX_PATH) path
integer ret
character*256 workdir,App,start_size
startupinfo%dwFlags = 0
startupinfo%cb = sizeof(startupinfo)
securityatt1%nLength = sizeof(securityatt1)
securityatt2%nLength = sizeof(securityatt2)
ret = CreateProcess (NULL , & ! Application Name
App, & !'"'//path(1:path_len)//'" -child'C, & ! Command line
NULL_SECURITY_ATTRIBUTES, &
NULL_SECURITY_ATTRIBUTES, &
TRUE, & ! InheritHandles
0, & ! CreationFlags
NULL, & ! Environment variables
"c:mdtwizardgemdt_program", & ! Current directory
startupInfo, &
processInfo)
if (ret == 0) then
ret = GetLastError ()
write (*,'(A,I0)') "Create process failed with error ",ret
else
! CreateProcess succeeded. Wait for the process to finish
!
ret = WaitForSingleObject (ProcessInfo%hProcess,INFINITE)
! Close handles, otherwise resources are lost
!
ret = CloseHandle (ProcessInfo%hThread)
ret = CloseHandle (ProcessInfo%hProcess)
end if
!return
end function supershell
-----------------------------------------------------
when I call this function
integer Ty
working_directory is the current working directory like
c:folder
Ty = supershell('isight',working_directory)
this does not create a thread nor nothing happens I am not able tounderstand why it is happening so...
I tried keeping 'isight' in the working directory also but still it does not work.
Iget an error saying 'isight' has an explicit type and does not have a type.
If i say
Ty = supershell('notepad',working_directory)then it works fine.
how can i get for 'isight' createprocess working????
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Iget an error saying 'isight' has an explicit type and does not have a type.
??? What's the exact error message and the code on that line? You must declare that supershell is a logical function in the calling routine. At least add
Jugoslav
P.S. Please use {pre}...{/pre} tags from the toolbar in Forum message editor around the code -- that will preserve code formatting, as in my message.
??? What's the exact error message and the code on that line? You must declare that supershell is a logical function in the calling routine. At least add
logical, external:: supershellin the routine that calls supershell.
App, & ! Command lineYou need a trim(App)//char(0) here instead.
"c:mdtwizardgemdt_program", & ! Current directorySame here. Add //char(0).
Jugoslav
P.S. Please use {pre}...{/pre} tags from the toolbar in Forum message editor around the code -- that will preserve code formatting, as in my message.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page