Procedure SetDefaultPrinter(xPrintName: string); var buffer: array[0..255] of Char; name: string; begin name := xPrintName; if AnsiPos(',', name) = 0 then begin name := name + ','; end; StrPCopy(buffer, name); WriteProfileString('windows', 'device', buffer); StrCopy(buffer, 'windows'); SendMessage(HWND_BROADCAST, WM_WININICHANGE, 0, Longint(@buffer)); end;
參考自-Solnone 螺旋旅人-Delphi 設定預設印表機
沒有留言:
張貼留言