1. <ul id="0c1fb"></ul>

      <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
      <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区

      RELATEED CONSULTING
      相關(guān)咨詢
      選擇下列產(chǎn)品馬上在線溝通
      服務(wù)時(shí)間:8:30-17:00
      你可能遇到了下面的問(wèn)題
      關(guān)閉右側(cè)工具欄

      新聞中心

      這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷(xiāo)解決方案
      Delphi設(shè)置系統(tǒng)默認(rèn)打印機(jī)

      獲取默認(rèn)打印機(jī)名:

      站在用戶的角度思考問(wèn)題,與客戶深入溝通,找到南部網(wǎng)站設(shè)計(jì)與南部網(wǎng)站推廣的解決方案,憑借多年的經(jīng)驗(yàn),讓設(shè)計(jì)與互聯(lián)網(wǎng)技術(shù)結(jié)合,創(chuàng)造個(gè)性化、用戶體驗(yàn)好的作品,建站類(lèi)型包括:做網(wǎng)站、網(wǎng)站制作、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣、域名申請(qǐng)雅安服務(wù)器托管、企業(yè)郵箱。業(yè)務(wù)覆蓋南部地區(qū)。

      function TForm1.GetDefaultPrinterName: string;
      var
        iSize: Integer;
        sIniFile, sSection, sKeyName: PChar;
      begin
        iSize := 256;
        sIniFile := 'win.ini';
        sSection := 'windows';
        sKeyName := 'device';
        SetLength(Result, iSize);
        GetPrivateProfileString(sSection, sKeyName, nil, PChar(Result), iSize, sIniFile);
        Result := Copy(Result, 0, Pos(',', Result) - 1);
      end;

      更改默認(rèn)打印機(jī):需要Uses WinSpool

      procedure ChangeDefaultPrinter(const Name: string);
      var
        W2KSDP: function(pszPrinter: PChar): Boolean; stdcall;
        H: THandle;
        Size, Dummy: Cardinal;
        PI: PPrinterInfo2;
      begin
        if (Win32Platform = VER_PLATFORM_WIN32_NT) and (Win32MajorVersion >= 5) then
        begin
          @W2KSDP := GetProcAddress(GetModuleHandle(winspl), 'SetDefaultPrinterA');
          if @W2KSDP = nil then RaiseLastOSError;
          if not W2KSDP(PChar(Name)) then RaiseLastOSError;
        end
        else
        begin
          if not OpenPrinter(PChar(Name), H, nil) then RaiseLastOSError;
          try
            GetPrinter(H, 2, nil, 0, @Size);
            if GetLastError <> ERROR_INSUFFICIENT_BUFFER then RaiseLastOSError;
            GetMem(PI, Size);
            try
              if not GetPrinter(H, 2, PI, Size, @Dummy) then RaiseLastOSError;
              PI^.Attributes := PI^.Attributes or PRINTER_ATTRIBUTE_DEFAULT;
              if not SetPrinter(H, 2, PI, PRINTER_CONTROL_SET_STATUS) then RaiseLastOSError;
            finally
              FreeMem(PI);
            end;
          finally
            ClosePrinter(H);
          end;
        end;
      end; //ChangeDefaultPrinter
      ChangeDefaultPrinter函數(shù) 在D7下使用SetDefaultPrinterA,在Delphi2010以上版本使用SetDefaultPrinterW
      procedure TDM.ChangeDefaultPrinter(const Name: string);
      var
        Device: array[0..255] of Char;
        Driver: array[0..255] of char;
        Port: array[0..255] of char;
        s : array[0..255] of Char;
        hDeviceMode: THandle;
        I: Integer;
      begin
        for I := 0 to Printer.Printers.Count - 1 do
          if Printer.Printers.Strings[I] = name then
          begin
            Printer.PrinterIndex := I;
            Break;
          end;
        Printer.GetPrinter (Device, Driver, Port, hDeviceMode);
        StrCopy (s, Device);
        StrCat (s, ',');
        StrCat (s, Driver);
        StrCat (s, ',');
        StrCat (s, Port);
        WriteProfileString ('windows', 'device', s);
        StrCopy (s, 'windows');
        SendMessage (HWND_BROADCAST, WM_WININICHANGE, 0, LongInt(@s));
      end;//這個(gè)函數(shù)也可以更改打印機(jī),效果沒(méi)有上面的好

      當(dāng)前文章:Delphi設(shè)置系統(tǒng)默認(rèn)打印機(jī)
      文章分享:http://www.ef60e0e.cn/article/pijsjj.html
      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区
      1. <ul id="0c1fb"></ul>

        <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
        <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

        德保县| 揭东县| 临清市| 泊头市| 武山县| 化德县| 宜黄县| 镇安县| 青浦区| 湘阴县| 邹平县| 姜堰市| 吉林市| 西林县| 涞水县| 玛沁县| 万宁市| 巢湖市| 隆化县| 海丰县| 阜新市| 吴川市| 莫力| 德清县| 彰化县| 汾西县| 邵东县| 冕宁县| 肥东县| 颍上县| 五莲县| 耿马| 永登县| 会同县| 兖州市| 精河县| 谢通门县| 云阳县| 台中县| 邯郸市| 灵山县|