delphi×ÊÁÏ
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
Ïà¹ØÎĵµ£º
Ëæ×ÅÍøÂçµÄÈÕÒæÆÕ¼°£¬RM£¨Real Media£©¸ñʽµÄ¶àýÌåÎļþÓÉÓÚѹËõ±È¸ß¶øÊܵ½ÊÀ½ç·¶Î§µÄÈÏͬºÍ»¶Ó¡£°²×°ÍêRealPlayerÖ®ºó£¬ÏµÍ³Öн«»á±»¼ÓÈëÒ»¸ö²¥·ÅRM¸ñʽµÄActiveX¿Ø¼þ£¬ÎÒÃǾÍÊÇÀûÓÃÕâ¸ö¿Ø¼þÀ´ÊµÏÖRM¸ñʽÎļþµÄ²¥·Å¡£
1¡¢°²×°ActiveX¿Ø¼þ
µã»÷Component²Ëµ¥ÏµÄImport ActiveX ControlÑ¡Ï¾Í»á³öÏÖÒ»¸öÏÖÔÚ¿É°²×°µÄ ......
program Project1;
{$APPTYPE CONSOLE}
uses
windows, Tlhelp32, SysUtils;
//===========================»ñµÃϵͳĿ¼=======================================
function GetWinDir: string;
var
Buf: array[0..MAX_PATH] of char;
begin
GetSystemDirector ......
¶Á“Delphi2010,DELPHIµÄÏ£Íû?”ÓиÐ
ÔÎÄ£ºhttp://www.gowjq.com/forum-29-1.html
1£© Ê¢´óµÄÖ÷Òª¿ª·¢¹¤¾ßÊÇDelphi, Ïê¼û£º http://act.sdo.com/Delphi/£¬ ÓÎÏ·ÊÇÒ»ÖÖ¸´ÔÓ½»»¥½çÃæµÄ¿ª·¢£¬Delphi¿ÉÒÔʤÈΡ£Í¬Ñù×÷ΪÆóÒµÓ¦ÓõÄÇ°¶Ë£¬ÓÃDELPHI¿ª·¢Ò²ÊǺܺõÄÑ¡Ôñ¡£
2£© Ò ......
DelphiµÚÈý·½¿Ø¼þ°²×°Ð¶ÔØÖ¸ÄÏ
»ù±¾°²×°
1¡¢¶ÔÓÚµ¥¸ö¿Ø¼þ£¬Componet-->install component..-->PAS»òDCUÎļþ-->install;
2¡¢¶ÔÓÚ´ø*.dpkÎļþµÄ¿Ø¼þ°ü£¬File-->Open(ÏÂÀÁбí¿òÖÐÑ¡*.dpk)-->install¼´¿É£»
3¡¢¶ÔÓÚ´ø*.bplÎļþµÄ¿Ø¼þ°ü£¬Install Packages-->Add-->bplÎļþÃû¼´¿É£»
4¡¢Èç¹ ......
DelphiÖнØÈ¡ÎļþÃû²»º¬ºó׺²¿·Ö ÊÕ²Ø
µ±ÎļþÃûº¬ÓÐÖÐÎÄʱ£¬²»ÄÜÖ±½ÓÓÃLeftStr(FileName, Length(FileName - 4))»òÕßÓÃPosÀ´¶¨Î»"."µÄλÖÃÀ´»ñÈ¡¡£ÒòΪÖÐÎÄÒ»¸ö×Ö·ûÏ൱ÓëÁ½¸öÓ¢ÎÄ×Ö·û¡£ÕâÑù½ØÈ¡ÍùÍù»¹ÊÇ°ÑÕû¸öFileName¶¼½ØÏÂÀ´ÁË¡£
Ó¦µ±Ê¹ÓÃCopyº¯Êý£¬ÈçÏ£º
TmpFileLength := Pos(extFile, FileName); TmpFileName := ......