﻿{"id":798,"date":"2009-11-03T09:02:58","date_gmt":"2009-11-03T01:02:58","guid":{"rendered":"http:\/\/www.tansoo.cn\/?p=798"},"modified":"2014-09-16T09:04:39","modified_gmt":"2014-09-16T01:04:39","slug":"%e5%9c%a8win2000xp%e4%b8%8b%e6%b7%bb%e5%8a%a0%e8%87%aa%e5%ae%9a%e4%b9%89%e7%ba%b8%e5%bc%a0","status":"publish","type":"post","link":"http:\/\/www.tansoo.cn\/?p=798","title":{"rendered":"\u5728WIN2000\/XP\u4e0b\u6dfb\u52a0\u81ea\u5b9a\u4e49\u7eb8\u5f20"},"content":{"rendered":"<p>\u5728Windows2000\/XP\/2003\u7b49\u7cfb\u7edf\u4e2d\u7684\u81ea\u5b9a\u4e49\u7eb8\u5f20\u7684\u7f16\u53f7\u5df2\u7ecf\u4e0d\u662fWIN98\u4e2d256\u4e86,\u800c\u662f\u91c7\u7528\u4e86\u4e00\u79cd\u65b0\u7684\u6807\u6ce8\u65b9\u5f0f,\u8fd9\u91cc\u63d0\u4f9b\u4e00\u4e2a\u5728Windows2000\/XP\/2003\u7b49\u7cfb\u7edf\u4e2d\u521b\u5efa\u81ea\u5b9a\u4e49\u7eb8\u5f20\u7684\u51fd\u6570,\u53ef\u4ee5\u5728\u5957\u6253\u7f16\u7a0b\u4e2d\u7528\u5230. <\/p>\n<pre class=\"lang:delphi decode:true \" >\/\/\u589e\u52a0\u89c4\u683c\u81ea\u5b9a\u4e49\u7eb8\u5f20    \r\n\/\/PaperName: \u81ea\u5b9a\u4e49\u7eb8\u5f20\u540d\u79f0    \r\n\/\/PaperWidth: \u7eb8\u5f20\u7684\u5bbd\u5ea6\uff0c\u4ee50.1mm\u4e3a\u5355\u4f4d    \r\n\/\/PaperLength: \u7eb8\u5f20\u7684\u9ad8\u5ea6\uff0c\u4ee50.1mm\u4e3a\u5355\u4f4d    \r\nprocedure TDM.AddCustomPaper(const PaperName: string; PaperWidth, PaperLength:integer);    \r\nvar    \r\n  PrintDevice, PrintDriver, PrintPort : array[0..255] of Char;    \r\n  hDMode : THandle;    \r\n  hPrinter : THandle;    \r\n  FormInfo : TFormInfo1;    \r\nbegin    \r\n  Printer.GetPrinter(PrintDevice, PrintDriver, PrintPort, hDMode);    \r\n  OpenPrinter(PrintDevice, hPrinter, nil);    \r\n  if hPrinter = 0 then    \r\n    raise Exception.Create('\u8054\u63a5\u6253\u5370\u673a\u5931\u8d25!');    \r\n\r\n  with FormInfo do    \r\n  begin    \r\n    Flags := FORM_USER;    \r\n    pName := PChar(PaperName);    \r\n    Size.cx := PaperWidth*100;    \r\n    Size.cy := PaperLength*100;    \r\n    ImageableArea.Left := 0;    \r\n    ImageableArea.Top := 0;    \r\n    ImageableArea.Right := PaperWidth*100;    \r\n    ImageableArea.Bottom := PaperLength*100;    \r\n  end;    \r\n\r\n\/\/\u4fee\u6539\u7eb8\u578b\uff0c\u5982\u679c\u6ca1\u6709\u5c31\u65b0\u589e    \r\n  if not SetForm(hPrinter, PChar(PaperName), 1, @FormInfo) then    \r\n    AddForm(hPrinter, 1, @FormInfo);    \r\n\r\n  ClosePrinter(hPrinter);    \r\nend;    \r\n\r\n\/\/\u5220\u9664\u81ea\u5b9a\u4e49\u89c4\u683c\u7eb8\u5f20    \r\n\/\/PaperName: \u81ea\u5b9a\u4e49\u7eb8\u5f20\u540d\u79f0    \r\nprocedure TDM.DeleteCustomPaper(const PaperName: string);    \r\nvar    \r\n  PrintDevice, PrintDriver, PrintPort : array[0..255] of Char;    \r\n  hDMode : THandle;    \r\n  hPrinter : THandle;    \r\nbegin    \r\n  Printer.GetPrinter(PrintDevice, PrintDriver, PrintPort, hDMode);    \r\n  OpenPrinter(PrintDevice, hPrinter, nil);    \r\n  if hPrinter = 0 then    \r\n    raise Exception.Create('\u8054\u63a5\u6253\u5370\u673a\u5931\u8d25!');    \r\n  DeleteForm(hPrinter, PChar(PaperName));    \r\n  ClosePrinter(hPrinter);    \r\nend;<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u5728Windows2000\/XP\/2003\u7b49\u7cfb\u7edf\u4e2d\u7684\u81ea\u5b9a\u4e49\u7eb8\u5f20\u7684\u7f16\u53f7\u5df2\u7ecf\u4e0d\u662fWIN98\u4e2d256\u4e86,\u800c\u662f\u91c7\u7528\u4e86\u4e00\u79cd [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-798","post","type-post","status-publish","format-standard","hentry","category-program"],"_links":{"self":[{"href":"http:\/\/www.tansoo.cn\/index.php?rest_route=\/wp\/v2\/posts\/798","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.tansoo.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.tansoo.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.tansoo.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.tansoo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=798"}],"version-history":[{"count":0,"href":"http:\/\/www.tansoo.cn\/index.php?rest_route=\/wp\/v2\/posts\/798\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.tansoo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=798"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.tansoo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=798"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.tansoo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=798"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}