Hi
If you are starting acrobat from your application then you could try starting it using the code below that will not return until the program you started has finished. I am not sure of the origion of the code but it works for me where I call pkunzip and don't want to carry on until it is complete.
Warren.S
 
 
function WinExecAndWait(CmdLine,DefaultDir: string; showCmd: Word; Yield: Boolean): Integer;
 // Spawn Exe and wait until finished
 //if Yield then ProcessMessages
var
  StartUpInfo: TStartupInfo;
  ProcessInfo: TProcessInformation;
  ProcessStatus: DWORD;
  lpExitCode: DWORD;  // address to receive termination status
begin
  Result := -1;
  Fillchar(StartUpInfo, SizeOf(StartUpInfo), #0);
  with StartUpInfo do begin
    cb := SizeOf(StartUpInfo);
    wShowWindow := showCmd;
  end;
  UniqueString(CmdLine);
  if not (CreateProcess(nil, PChar(CmdLine), nil, nil, False, //Spawn
    CREATE_DEFAULT_ERROR_MODE, nil, PChar(DefaultDir),
    StartUpInfo, ProcessInfo))
    then Exit;
  with ProcessInfo do begin //wait until process finished
    WaitForInputIdle(hProcess, INFINITE);
    CloseHandle(hThread);
    while GetExitCodeProcess(hProcess, ProcessStatus) and
       (ProcessStatus = STILL_ACTIVE) do
       if Yield then Application.ProcessMessages;
    GetExitCodeProcess(hProcess, lpExitCode);
    result := lpExitCode;
    CloseHandle(hProcess);
  end;
end;
 
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Monday, 15 September 2003 08:16 a.m.
To: Multiple recipients of list delphi
Subject: [DUG]: How do I examine the printer queue?

Hi

 

I have an app which uses a ShellExecute to print a whole lot of PDFs one after the other. It first assigns a different printer, prints the pdfs and then assigns back to the default printer. It is a scheduled job. The problem is that it is printing some of the pdfs on the correct printer, and some on the default printer. What I think is happening, is that Acrobat is still busy spooling the pdfs, when I re-assign the default printer and close my app. Since the printer has been re-assigned to the default, the remaining pdfs that are still in the process of being spooled, end up on the default printer. (My re-assign to default printer has a sendmessage which broadcasts the printer change to all apps).

 

I'm not that familiar with the printer unit. I want to either pause my app from reassigning the default printer and closing, until all the files have been spooled, or until the spooler is empty. So I either need to see if Acrobat is still open and wait, or see if the spool queue still has entries and wait.

 

Any suggestions on how to do either of these?

 

Thanks.

Dave Jollie
Developer, TOWER NZ IT

(: 09 368 4259
Ê: 09 306 6801
*: [EMAIL PROTECTED]
.: 46 Parnell Rd, Parnell, Auckland

 


This e-mail message has been scanned for Viruses and Content and cleared by MailMarshal - For more information please visit www.marshalsoftware.com

Reply via email to