[DUG] Setting the windows default printer

Sean Cross - CRM sean.cross at crm.co.nz
Mon Oct 31 13:48:18 NZDT 2005


Does anyone know how to set the windows default printer under windows
server 2003 (for citrix)?

I was using something like :

var
  DeviceStr: String;
begin
  CheckPrinter;  {make sure new printer is loaded}
  {set the new device setting in the WIN.INI file}
  DeviceStr := StrPas (FDevice) + ',' + StrPas (FDriver) + ',' + StrPas
(FPort) + #0;
  WriteProfileString ('windows', 'device', @DeviceStr[1]);
  {force write to WIN.INI}
  WriteProfileString (nil, nil, nil);
  {broadcast to everyone that WIN.INI changed}
  SendMessage ($FFFF, WM_WININICHANGE, 0, 0);
End;

Which worked on older versions of windows, but in 2003 causes a sudden
exit stage right.


Regards

Sean
-------------------------
Sean Cross
Systems Development
CRM 
PO Box 230
Napier
DDI:	06 834 0362
Mobile:	021 270 3466 
Email:	sean.cross at crm.co.nz






More information about the Delphi mailing list