Scalabium Software

SMExport advertising
Knowledge for your independence'.
Home Delphi and C++Builder tips


#32: How can I change the default printer in MS Windows?

If you want to change the the default printer in Windows OS, you must change
the device key in the Windows section of the WIN.INI. After that you must
send a WM_WININICHANGE message:

var
  strIni: array[0..MAX_PATH] of Char;
  arrWindows: array[0..64] of Char;
begin
  GetWindowsDirectory(strIni, SizeOf(strIni));
  StrCat(strIni, '\win.ini');
  with TIniFile.Create(strIni) do
    try
      WriteString('windows', 'device', 'HP LaserJet 4 Plus,HPPCL5MS,LPT1:');
    finally
      Free;
    end;

  StrCopy(arrWindows, 'windows');
  SendMessage(HWND_BROADCAST, WM_WININICHANGE, 0, LongInt(@arrWindows));
end;


Published: October 20, 1999

See also
 
Database Information Manager
MAPIMail
SMMsg suite
Mail parser (ActiveX)
ABA Spreadsheet Convert
Viewer for TNEF-files (winmail.dat)
DBExport tools
Clarion to Text converter/a>
ABA Picture Convert
SMReport
 
 


Contact to webmaster

 

Borland Software Code Gear Scalabium Delphi tips

Copyright© 1998-2017, Scalabium Software. All rights reserved.
webmaster@scalabium.com

SMReport Autogenerated