Показать сообщение отдельно
  #3  
Старый 18.05.2015, 13:20
Аватар для Alegun
Alegun Alegun вне форума
LMD-DML
 
Регистрация: 12.07.2009
Адрес: Богородское
Сообщения: 3,025
Версия Delphi: D7E
Репутация: 1834
По умолчанию

А можно и так, по drkb
Код:
Var
  exInfo: TShellExecuteInfo;
Begin
  FillChar( exInfo, Sizeof(exInfo), 0 );
  With exInfo Do Begin
    cbSize:= Sizeof( exInfo ); // required!
    fMask := SEE_MASK_NOCLOSEPROCESS;
    Wnd   := Handle;  // forms handle
    lpVerb:= 'paintto';
    lpFile:= Pchar( pdffilename );
    lpParameters := PChar( printernameAndPort );
    nShow := SW_HIDE;
  End;
  If ShellExecuteEx( @exInfo ) Then Begin
     While GetExitCodeProcess( exinfo.hProcess, exitcode )
          and (exitcode = STILL_ACTIVE)
     Do
       Sleep( 500 );
     CloseHandle( exinfo.hProcess );
     DeleteFile( pdffilename );
  End
  Else
    ShowMessage(SysErrorMessage( GetLastError ));
Ответить с цитированием