T
through86
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TForm1.Button1Click(Sender: TObject);<br> var<br> pDevice : pChar;<br> pDriver : pChar;<br> pPort : pChar;<br> hDMode : THandle;<br> begin<br> if PrintDialog1.Execute then begin<br> GetMem(pDevice, cchDeviceName);<br> GetMem(pDriver, MAX_PATH);<br> GetMem(pPort, MAX_PATH);<br> Printer.GetPrinter(pDevice, pDriver, pPort, hDMode);<br> if lStrLen(pDriver) = 0 then begin<br> GetProfileString('Devices', pDevice, '', pDriver, MAX_PATH);<br> pDriver[pos(',', pDriver) - 1] := #0;<br> end;<br> if lStrLen(pPort) = 0 then begin<br> GetProfileString('Devices', pDevice, '', pPort, MAX_PATH);<br> lStrCpy(pPort, @pPort[lStrLen(pPort)+2]);<br> end;<br> Memo1.Lines.Add('Device := ' + StrPas(pDevice));<br> Memo1.Lines.Add('Driver := ' + StrPas(pDriver));<br> Memo1.Lines.Add('Port := ' + StrPas(pPort));<br> FreeMem(cchDeviceName);<br> FreeMem(pDriver, MAX_PATH);<br> FreeMem(pPort, MAX_PATH);<br> end;<br> end;