Delphi¿½±´Ä¿Â¼(º¬×ÓĿ¼)µÄ·½·¨
Delphi¿½±´Ä¿Â¼(º¬×ÓĿ¼)µÄ·½·¨
ҪʵÏÖĿ¼¼¶µÄ¿½±´£¬¿ÉÒÔÀûÓÃWindows APIº¯ÊýShFileOperation( )£¬Æ亯ÊýÉùÃ÷ÈçÏ£º
WINSHELLAPI int WINAPI SHFileOperation(
LPSHFILEOPSTRUCT lpFileOp
);
ʵÀý£º
н¨Ò»¸ö¹¤³Ì£¬Æä³ÌÐòʾÀýÈçÏ£º
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,ShellApi;
//×¢Ò⣺±ØÐëÒýÓÃShellApiµ¥Ôª
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender:TObject);
var
OpStruc:TSHFileOpStruct;
frombuf,tobuf:Array[0..128]of Char;
begin
FillChar(frombuf,Sizeof(frombuf),0);
FillChar(tobuf,sizeof(tobuf),0);
//¼ÙÉ轫C:\temp1Ŀ¼ÏµÄËùÓÐÎļþ¸´ÖƵ½C:\temp2Ŀ¼ÏÂ
StrPCopy(frombuf,'C:\temp1\*.*'); //(\*.*)¿ÉÈ¥µô
StrPCopy(tobuf,'C:\temp2');
With OpStruc Do
begin
Wnd:=Handle;
wFunc:=FO_COPY;
pfrom:=@frombuf;
pTo:=@tobuf;
fFlags:=FOF_NOCONFIRMATION or FOF_RENAMEONCOLLISION;
fAnyOperationsAborted:=false;
hNameMappings:=Nil;
lpszProgressTitle:=Nil;
end;
ShFileOperation(OpStruc);
end;
end.
ͨ¹ý±¾³ÌÐò£¬¿ÉÒÔ½«Ä³Ò»×ÓĿ¼¼°ÆäÏÂÃæµÄËùÓÐÎļþ£¨°üÀ¨Ï¼¶×ÓĿ¼£©¿½±´µ½ÁíÒ»¸ö×ÓĿ¼£¬Èç¹ûÄ¿±êĿ¼²»´æÔÚ£¬Ôò»á×Ô¶¯´´½¨Ëü£¬´Ó¶øʵ¼ÊһЩ×Ô¶¯±¸·ÝµÄ¹¦ÄÜ¡£
Ïà¹ØÎĵµ£º
ËùÔÚµ¥Ôª£º DateUtils
Day ¿ªÍ·µÄº¯Êý
1¡¢DayOf()
ÃèÊö£º ʹÓà DateOf º¯ÊýÓÃÀ´°ÑÒ»¸ö TDateTime ÀàÐ͵ıäÁ¿×ª±ä³ÉÒ»¸ö Ö»´øÓÐÈÕÆÚµÄ TDateTime ÀàÐͱäÁ¿¡£ ÀýÈ磺 showmessage(DateTimetostr(dateof(now()))); ÄãµÃµ½µÄÊÇ 2003/03/19 ¶ø showmessage(DateTimetostr((now()))); µÃµ½µÄÊÇ
2¡¢DateTimeTostr()
ÃèÊö£º Da ......
ADO¶àÏß³ÌÊý¾Ý¿â²éѯͨ³£»á³öÏÖ3¸öÎÊÌ⣺
1¡¢CoInitialize ûÓе÷ÓÃ
£¨CoInitialize was not
called£©£»ËùÒÔ£¬ÔÚʹÓÃÈκÎdbGo¶ÔÏóÇ°£¬±ØÐëÊÖ
µ÷ÓÃCoInitializeºÍCoUninitialize¡£µ÷ÓÃCoInitializeʧ°Ü»á²úÉú"CoInitialize was not
called"ÀýÍâ¡£
2¡¢»²¼²»ÔÊÐí»æ»
£¨Canvas does not allow
drawing£ ......
Delphi²Ù×÷×¢²á±í²½ÖèÈçÏ£º
-------------------------------------
1£©ÔÚUsesÖÐÌí¼ÓRegistryµ¥Ôª£»
2£©ÉùÃ÷TRegistry¶ÔÏó£»
3£©´´½¨TRegistry¶ÔÏó£»
4£©Ö¸¶¨¸ù¼ü£»
----------------try------------------
5£©´ò¿ªÐèÒª²Ù×÷µÄÖ÷¼ü£»
6£©¶Áд²Ù×÷£»
7£©±£´æ²¢¹Ø±ÕÖ÷¼ü£»
--------------finally----------------
......
ÎÒÃÇÄÜ¿´µ½ÒÔÏ´úÂë
var pSource,pDest:PChar;
len: integer;
.......................//һЩ´úÂë
Move(pSource,pDest,len); //´íÎó
Move(pSource^,pDest^,len); //ÕýÈ·
¿´ÆðÀ´È·ÊµºÃÏñÊÇ´«Öµ£¬¶ø²»ÊÇ´«µØÖ·£¬µ«ÊǸ÷λ±ðÍüÁË£¬Õâ²»ÊÇC£¬C++£¬¶øÊÇDelphi
Object Pascal,ËùÒÔ£¬¾ø²»ÄÜ´Óº¯Êýµ ......