Archive for April, 2008

Membuat Format nilai Leading Zero

April 30, 2008 2 komentar

function GiveLeadingZero(const aNumber,aMaxDigit: Integer): String;
var formatSpecifier: String;
formatSpecifier := Format(‘%%.%dd’, [aMaxDigit]);
Result := Format(‘FJ’+formatSpecifier, [aNumber]);

pemanggilnya :

Edit1.Text := GiveLeadingZero(aNumber, 5)

Hasil : 00001


How to get the status of a printer and a print job

April 30, 2008 2 komentar
This article was previously published under Q160129

var sectionFilter = “type != ‘notice’ && type != ‘securedata’ && type != ‘querywords'”;
var tocArrow = “/library/images/support/kbgraphics/public/en-us/downarrow.gif”;
var depthLimit = 10;
var depth3Limit = 10;
var depth4Limit = 5;
var depth5Limit = 3;
var tocEntryMinimum = 1;

Baca selanjutnya…


Printer.GetPrinter vs. WinSpool.GetPrinter

April 30, 2008 23 komentar
what a different of Printer.GetPrinter and WinSpool.GetPrinter?

Printer.GetPrinter is part of the Delphi VCL, it gets you the *current* 
DEVMODE of the selected printer inside your application. The function 
happens to return a global memory handle for the devmode record instead of 
a pointer to it, so it has to be locked to get access to the memory of the 
record. When you modify the current Devmode settings and then call 
Printer.beginDoc the settings will be used to create the printer device 
context. It is not necessary to call Printer.SetPrinter to make the changes 
active. But any changes you make here are local to your program, they do 
not influence other programs printing to the same printer. 

WinSpool.GetPrinter is part of the Windows Spooler API, it gets you 
information about the *default* settings for the printer. As it happens the 
TPrinterInfo2 record contains a pointer to the DEVMODE holding the default 
settings, not a memory handle, so locking is not required. Changes you make 
to the default DEVMODE have no effect at all until you call 
Winspool.SetPrinter, passing it the TPrinterInfo2 record you obtained from 
Winspool.GetPrinter. The SetPrinter call changes the defaults, so this 
influences other programs that use the printer as well as yours.

How to get printer job from document name?

April 30, 2008 Tinggalkan komentar

uses Winspool, Printers...

function GetCurrentPrinterHandle: THandle;
  Device, Driver, Port: array[0..255] of Char;
  hDeviceMode: THandle;
  Printer.GetPrinter(Device, Driver, Port, hDeviceMode);
  if not OpenPrinter(@Device, Result, nil) then
 Baca selanjutnya...

Monitoring a printer with Delphi

April 30, 2008 Tinggalkan komentar

unit Unit1;


Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, StdCtrls;

TForm1 = class(TForm)
ListView1: TListView;
PrinterSetupDialog1: TPrinterSetupDialog;
Button1: TButton;
procedure Button1Click(Sender: TObject);
{ Private declarations }
{ Public declarations }
Baca selanjutnya…


Windows services – Checking status ()

April 30, 2008 Tinggalkan komentar

Ingin tau mencari status dari ServiceWindows ?
gunakan fungsi “QueryServiceStatus()” Caranya adalah sebagai berikut: Baca selanjutnya…


Link : How To Handle Printinter device

April 29, 2008 Tinggalkan komentar