摘要载入中…    请稍等…












内容载入中…    请稍等…

如长时间看不到内容,请关闭浏览器,重新打开此页!

芯友首页 应用软件 编程开发 网络硬件 资源下载 动漫音乐 精美图库 芯友论坛 视频教程 电脑技术QQ群:43315186
 ★★photoshop学友-10万图书免费看★★
 位置:编程开发>Deiphi>Deiphi打印编程
◎→ 本类最新
在DELPHI文本和图形的打印
用好Delphi的打印技能的编程技巧
在Delphi中实现数据分析模块的动
在Delphi中控制扫描仪
自定义报表打印预览窗口
获取打印机队列的状态信息
◎→相关资源
VB窗体文章
HTML入门教程
JavaScript入门教程
VbScript入门教程
ASP.net入门教程
C语言入门教程
Deiphi实例教程
Deiphi窗体文章
Deiphi数据库编程
Deiphi网络编程
Deiphi图形图象文章
Deiphi系统文件
◎→ 热门资源
用DELPHI通过写注册表来实现建立
网络积件再思考。(其实也只是胡
Delphi中动画设计(2)
Delphi中动画设计
Delphi无标题窗口的移动
用Delphi实现文件下载的方法
Delphi数据库编程一日通(3)

Delphi中设置默认打印机


日期:2008-9-2 21:24:41    来源:
   
 -->用DELPHI通过写注册表来实现建立IIS的虚拟目录!
 -->用Delphi设置墙纸
 -->监视打印机部分线程内容

Delphi中设置默认打印机


type
  TForm1 = class(TForm)
    Button1: TButton;
    ComboBox1: TComboBox;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }   
  public
    { Public declarations }
  end;

{...}

procedure TForm1.FormCreate(Sender: TObject);
begin
  { tell printer to go to the default by setting
    the PrinterIndex value to -1 }
  Printer.PrinterIndex := -1;

  { make our combobox non-editable }
  ComboBox1.Style      := csDropDownList;

  { set our combobox items to the printer printers }
  ComboBox1.Items      := Printer.Printers;

  { set combobox to view the default printer
    according to printer printerindex as set above }
  ComboBox1.ItemIndex  := Printer.PrinterIndex;
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  MyHandle  : THandle;
  MyDevice,
  MyDriver,
  MyPort: array [0..255] of Char;
begin
  { set printer to the selected according to the
    combobox itemendex }
  Printer.PrinterIndex := ComboBox1.ItemIndex;

  { get our printer properties }
  Printer.GetPrinter(MyDevice,
                     MyDriver,
                     MyPort,
                     MyHandle);

  { create string of exactly what WriteProfileString()
    wants to see by concat each of the above received
    character arrays }
  StrCat( MyDevice, ',');
  StrCat( MyDevice, MyDriver );
  StrCat( MyDevice, ',');
  StrCat( MyDevice, MyPort );

  { copy our new default printer into our windows ini file
    to the [WINDOWS] section under DEVICE= }
  WriteProfileString('WINDOWS',
                     'DEVICE',
                     MyDevice );

  { tell all applications that the windows ini file has
    changed, this will cause them all to recheck default
    printer }
  SendMessage(HWND_BROADCAST,
              WM_WININICHANGE,
              0,
              LongInt(pChar('windows')));
  end;
end;

 [1]

Delphi中动画设计(2)

设置ListView的页眉图标

打印机不能打印维修日志2008

--->QQ优化设置 2006.8.12 绿色版
--->GrabFile V3.9 Final┊强大可设置筛选图象文件下载工具┊简体中文绿色特别版
--->NeoDownloader V2.2┊超快速抓图工具、具有秀图设置等的功能┊汉化绿色特别版
--->飞鱼浏览器(Flyfish) 1.79.0┊可以自行设置启动页的界面┊简体中文绿色特别版
--->Opera通用设置工具 070328┊用这个工具可进行恢复后重新设置┊简体中文免费版
Tags:  Delphi 设置 打印机
{$enumber$}


芯友网版权所有 1999-2006 | 著作权与商标声明 | 法律声明 | 服务条款 | 隐私声明 | 联系我们