Waitforsingleobject - not working in win 2003server

the below code used to open the pdf document and sent for printing. It works good in windows NT. But it is not working in Windows 2003. It stops at waitforsingleobject(“”). could any one help me to solve the issue.

please find the below code…

Dim RetVal As Long

Dim proc As PROCESS_INFORMATION

Dim StartInf As STARTUPINFO

StartInf.cb = Len(StartInf)

'Execute the given path

'RProg - this will conatin the pdfdocument path and printer name (ReaderPath(exe) & " /t " & filename & " " & Printername)

RetVal = CreateProcessA(0&, RProg, 0&, 0&, 1&, _

NORMAL_PRIORITY_CLASS, 0&, 0&, StartInf, proc)

'Disable this app until the shelled one is done

RetVal = WaitForSingleObject(proc.hProcess, INFINITE)

RetVal = CloseHandle(proc.hProcess)

Subject: RE: waitforsingleobject - not working in win 2003server

It seems perhaps this is an OS issue, not a Notes issue. Did you check whether the value in proc.hProcess was in fact a valid process ID and that it is the right process ID?

Subject: RE: waitforsingleobject - not working in win 2003server

really i don’t know about the api call. But i found the pdf documnet got extracted in the mentioned folder and sent for printing, after that the process is not terminated. so it is pointing in waitforsingleobject. (hope i have given right things, if not please correct me).

the process is not terminated,so i used the api Terminateprocess. now the process got terminated and it worked but i don’t know this will give me a permanent fix.

Please find the below code.

RetVal = CreateProcessA(0&, RunProg, 0&, 0&, 1&, _

NORMAL_PRIORITY_CLASS, 0&, 0&, StartInf, proc)

RetVal = WaitForSingleObject(proc.hProcess, 10000)

RetVal = TerminateProcess(proc.hProcess,RetVal)

RetVal = CloseHandle(proc.hProcess)

Subject: RE: waitforsingleobject - not working in win 2003server

You’re upgrading from NT to Windows 2003? I don’t understand why you’re using either version when the Commodore 64 operating system is perfectly adequate.

Anyway, so we are seeing that the process doesn’t terminate on its own; this seems to me like an operating system issue. Talk to the software vendor and find out why it doesn’t terminate. It seems like the delay you specify is going to happen every time.

Why do you need for it to terminate, by the way? What happens if you just request the printout and don’t bother to wait?

Subject: RE: waitforsingleobject - not working in win 2003server

Thanks for your reply and explanation.

Actually we are extracting the pdf in one particular folder and it is saved in that folder. after that it got printed using the api. after this using a batch file (through same api) we deleted the pdf in the folder.

Hope waitforsingleobject will close(terminate) the process once it finsh the (printing)work. in this case (for me in 2003 server) the process is not terminated. So deletion is not taking place. so i thougt to terminate the process.