delphi code
http://hi.baidu.com/rainbow_chaser/blog/item/7eb5f001c0d864e508fa93ac.html
1.·ÀֹˢÐÂʱÉÁ˸µÄÖÕ¼«½â¾ö°ì·¨
{ ·ÀֹˢÐÂʱÉÁ˸µÄÖÕ¼«½â¾ö°ì·¨(¶Ô¸¶Ë«»º³åÎÞЧʱ) }
Perform($000B, 0, 0); //ËøÆÁÄ» ·ÀÖ¹ÉÁ˸
// ×öһЩ»á·¢ÉúÑÏÖØÉÁ˸µÄÊÂÇé..
//½âËøÆÁÄ»²¢ÖØ»
Perform($000B, 1, 0);
RedrawWindow(Handle, nil, 0, RDW_FRAME + RDW_INVALIDATE + RDW_ALLCHILDREN + RDW_NOINTERNALPAINT);
2.ͼƬÉÏÏÔʾ͸Ã÷ÎÄ×Ö
//ͼƬÉÏÏÔʾ͸Ã÷µÄÎÄ×Ö
//Ö±½ÓÓÃ.Canvas.Brush.Style:=bsClear;
//È»ºó.Canvas.TextOut(x,y,'ÎÄ×ÖÏÔʾ͸Ã÷');
procedure TForm1.Button1Click(Sender: TObject);
var
bitBuf:TBitmap;
begin
bitBuf := TBitmap.Create;
try
bitbuf.LoadfromFile('²âÊÔͼƬ.bmp');
Self.Canvas.Draw(0,0,bitbuf);
bitbuf.Transparent := True;
bitbuf.TransparentColor := clWhite; //ÎÄ×ÖÏÔʾ͸Ã÷
bitbuf.Canvas.font.color := clBlue; //ÎÄ×ÖÑÕÉ«
bitbuf.Canvas.TextOut(10,10,'ÕâÑù¾ÍÊÇ͸Ã÷µÄ×ÖÁË£¡');
Self.Canvas.Draw(0,0,bitbuf);
finally
bitBuf.Free;
end;
end;
3.È¡µÃ±¾»úIPµØÖ·(¾«¼ò°æ)
//È¡µÃ±¾µØIPµØÖ·(¾«¼ò°æ)
//×¢£ºÊ¹Óú¯ÊýÇ°ÐèÒª WSAStartup($202, wsdata);
function GetLocalIP(): String;
var
HostName: array[0..255] of Char;
HostEnt: PHostEnt;
begin
Result := '';
if gethostname(HostName, 255) = 0 then
begin
HostEnt := gethostbyname(HostName);
Result := StrPas(inet_ntoa(PInAddr(PInAddr(HostEnt^.h_addr_list)^)^));
end;
end;
4.±¨¸æÄÚ´æй©
// ÔÚ³ÌÐòÖмÓÉÏÕâ¾ä£¬µ±Í˳öʱ»á±¨¸æÄÚ´æй©
ReportMemoryLeaksOnShutdown := True;
5.ÊÍ·Å×ÊÔ´Îļþ
// Ê×ÏȼÓÈë.RCÎļþ£¬Ð´ÉÏ MyDLL DAT testDLL.dll
// È»ºó³ÌÐòÀï ExtractRes('DAT','MyDLL','123DLL.dll');
procedure ExtractRes(ResType, ResName, ResNewName:String);
var Res:TResourceStream;
begin
Res:=TResourceStream.Create(Hinstance, Resname, Pchar(ResType));
try
Res.SavetoFile('.\'+ResNewName); // Êͷŵ½µ±Ç°Ä¿Â¼
fin
Ïà¹ØÎĵµ£º
Ìí¼ÓÒýÓãºuses JPEG;
//=====================ͼƬ´¦Àíº¯Êý£¬½«¸²¸ÇÔͼƬÎļþ===========================
//=====filename:ͼƬÍêÕû·¾¶ PressQuality:ѹËõÖÊÁ¿ Width:¿í Height:¸ß
function CompressMainFun(filename: String; PressQuality,Width,Height:integer): Boolean;
var
bmp: TBitmap ......
implementation
uses ComOBJ;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var ExcelAPP1:Variant;
ExcelApp2:Variant;
I,j: Integer;
ID,IDX:string;
begin
try
ExcelAPP1:=CreateOleObject('Excel.Application');
E ......
µÚÒ»½Ú BDE¡¢ADO¡¢InterBaseºÍdbExpress
DelphiÖд¦ÀíÊý¾Ý¿âÖ÷ÒªÓÐÁ½ÖÖ·½·¨£¬Ò²¾ÍÊÇBDE¡¢ADO£¬´ÓDelphi 6.0¿ªÊ¼»¹¼ÓÈëÁËÒ»ÖÖdbExpress·½·¨¡£ ÁíÍ⣬Delphi»¹ÌṩÁËרÃÅ´¦ÀíBorland ¹«Ë¾×Ô¼ºµÄÊý¾Ý¿â²úÆ·InterBase Êý¾Ý¿âµÄרÃŵķ½·¨¡£
BDE£¨Borland Databas Engine£©£¬ ÊÇDelph ......
DelphiµÚÈý·½¿Ø¼þ°²×°Ð¶ÔØÖ¸ÄÏ
»ù±¾°²×°
1¡¢¶ÔÓÚµ¥¸ö¿Ø¼þ£¬Componet-->install component..-->PAS»òDCUÎļþ-->install;
2¡¢¶ÔÓÚ´ø*.dpkÎļþµÄ¿Ø¼þ°ü£¬File-->Open(ÏÂÀÁбí¿òÖÐÑ¡*.dpk)-->install¼´¿É£»
3¡¢¶ÔÓÚ´ø*.bplÎļþµÄ¿Ø¼þ°ü£¬Install Packages-->Add-->bplÎļþÃû¼´¿É£»
4¡¢Èç¹ ......
ΪÁ˼ӿìÓ²¼þµÄ·ÃÎÊËÙ¶È, ±àÒëÆ÷ͨ³£ÒªÊ¹ÓÃ"Êý¾Ý¶ÔÆë", Æ©Èç:
//ÏÂÃæ½á¹¹ÖÐ: SizeOf(TRec) = 6; ÒòΪ b ÔÚÕâÀïÒ²ÒªÕ¼ 2 ×Ö½Ú.
TRec = record
a: Word;
b: Byte;
c: Word;
end
;
//ÏÂÃæ½á¹¹ÖÐ: SizeOf(TRec) = 16; ÕâÀïµÄ a ºÍ b ¹²Õ¼ÁË 8 ¸ö×Ö½Ú.
TRec = record
a: Byte;
b: Byte;
c: Do ......