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.±¨¸æÄÚ´æÐ¹Â©
// ÔÚ³ÌÐòÖм
Ïà¹ØÎĵµ£º
²éÕÒÁíÍâÒ»¸ö´°¿ÚµÄ¾ä±ú£º handle := FindWindow(nil,PChar('´°¿ÚµÄ±êÌâ'));//²éµ½´°Ìå¾ä±ú
²éÕÒ×Ó´°Ì壺childHandle := FindWindowEx(handle,0,'×Ó´°ÌåÀà','×Ó´°Ìå±êÌâ');
ÁíÍâÓиöö¾Ù×Ó´°ÌåµÄAPI£¬EnumChildWindows(Ö÷´´Ìå¾ä±ú,@»Øµ÷º¯Êý,Óû§²ÎÊý);
ÓÃÕâ¸öº¯ÊýÐèÒª×Ô¼ºÐ´Ò»¸ö»Øµ÷µÄº¯Êý£¬±ÈÈ磺
function EnumChil ......
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, TlHelp32;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Pub ......
¼¼Êõ½»Á÷,DH½²½â. Ê×ÏÈÎÒÃÇÒªÖªµÀʲôÊÇÊý×é?Êý×éÊÇÒ»¶ÑÏàÍ¬ÌØÐÔÊý¾ÝµÄÒ»¸ö¼¯ºÏ,Ò²¾ÍÊÇÿ¸öÔªËØµÄÀàÐͱØÐëÊÇÒ»ÑùµÄ,µ±È»ÔÚÆäËûһЩÈõÓï·¨µÄÓïÑÔÀïÃæ,Êý×éµÄÔªËØ¿ÉÒÔÇ§Ææ°Ù¹Ö.
Àý×Ó: Var
A: Array[ 0..2 ] Of Integer ;
Begin
A[ 0 ] := 1 ;
A[ 1 ] := 1.0 ; //ÕâÀïÊÇ´íµÄ,ÒòΪÿ¸öÔªËØ¶¼±ØÐëÊÇIntegerÀàÐ ......
ÔÚÉè¼ÆÊý¾Ý¿âÓ¦ÓóÌÐòµÄʱºò£¬¾³£ÐèÒª½«Ò»Ð©ÐÅÏ¢´Ó³ÌÐòÖжÀÁ¢³öÀ´£¬ÒÔ±£Ö¤³ÌÐòµÄ¿ÉÒÆÖ²ÐÔ¡£ÆäÖÐ×îÖØÒªµÄÐÅÏ¢¾ÍÊÇÊý¾Ý¿âµÄÁ¬½Ó²ÎÊý¡£
ÔÚDelphiÖУ¬»ñµÃÕýÈ·µÄÊý¾Ý¿âÁ¬½Ó²ÎÊýµÄ·½·¨Ê®·Ö¼òµ¥£¬ÄãÖ»ÐèÒª½¨Á¢Ò»¸öÊý¾ÝÄ£¿é£¬ÔÚÆäÖÐÌí¼ÓÒ»¸öADO Connection,Ë«»÷Ö®£¬È»ºóÔÚµ¯³öµÄ´°¿ÚÖÐÑ¡“Use Connection String”£¬µ¥ ......
ÓÅÐãµÄÊý¾Ý¿âÓ¦ÓÃÓ¦µ±³ä·Ö¿¼ÂÇÊý¾Ý¿â·ÃÎʵÄËÙ¶ÈÎÊÌ⡣ͨ³£¿ÉÒÔͨ¹ýÓÅ»¯Êý¾Ý¿â¡¢ÓÅ»¯ ²éѯÓï¾ä¡¢·ÖÒ³²éѯµÈ;¾¶ÊÕµ½Ã÷ÏÔµÄЧ¹û¡£¼´Ê¹ÊÇÕâÑù£¬Ò²²»¿É±ÜÃâµØ»áÔÚ²éѯʱÉÁÏÖÒ»¸ö´øÓÐ SQL·ûºÅµÄɳ©£¬¼´Êó±ê±ä³ÉÁ˲éѯµÈ´ý¡£×î¿ÉÁ¯µÄÊÇÓû§£¬Ëû£¨Ëý£©ÔÚ´ËʱֻÄÜÎÞÄεصȴý¡£Óöµ½¼±ÐÔ×ӵ쬏ɴàÔÚ´Ëʱ³¢ÊÔ WindowsÖÐµÄÆäËüÓ¦ÓóÌÐ ......