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\*.*'); //(\*.*)¿ÉÈ¥µô
S ......
ÔÚDelphiÓ¦ÓóÌÐòÖÐʹÓÃDLL
¡¡¡¡Delphi²»½ö¿Éµ÷ÓÃC£«£«²úÉúµÄDLLÄ£¿é£¬Í¬ÑùC£«£«³ÌÐòÒ²¿Éµ÷ÓÃDelphiËù²úÉúµÄDLL²¿¼þ¡£ÕâÑù½»»¥µ÷Óã¬ÎÞÐëÖظ´¿ª·¢£¬´ó´óËõ¶ÌÁËÉú²úÖÜÆÚ¡£
¡¡¡¡DelphiÓëVisualBasic¡¢VisualFoxProµÈÈí¼þÒ»Ñù£¬ÊôÓÚRAD¹¤¾ß£¨¿ìËÙÓ¦Óÿª·¢¹¤¾ß£©¡£ÊʺϿª·¢32λ»ò16λ£¯32λ»ìºÏÓ¦ÓóÌÐò¡£DelphiËùʹÓõijÌÐòÓïÑÔÊÇObjectPascal£¬Êǽṹ»¯¡¢ÃæÏò¶ÔÏóµÄ±àÒëÐÍÓïÑÔ£¬¾ßÓиßÖ´ÐÐЧÂÊ¡¢¿ÉÖØÓÃÐÔ¡¢Ò×ά»¤ÐÔ£¬¼°½ÏÇ¿µÄÒì³£´¦ÀíÄÜÁ¦¡¢Àà·â×°ÄÜÁ¦µÈ¡£VBÓëDelphiÏà±È£¬VB²»ÄܶԳÌÐò½øÐбàÒ룬ֻÄܽâÊÍÖ´ÐУ¬¸üÖØÒªµÄ²»Í¬ÊÇDelphi¾ßÓнÏÇ¿µÄ¼Ì³ÐÐÔ£¬DelphiµÄÓ¦ÓóÌÐò¿É±àÒëDLLÄ£¿é£¬VBÈ´ÎÞ·¨±àÒ룬ֻÄܵ÷ÓÃC±àÒëµÄDLL¡£¶øDelphi²»½ö¿Éµ÷ÓÃC£«£«²úÉúµÄDLLÄ£¿é£¬Í¬ÑùC£«£«³ÌÐòÒ²¿Éµ÷ÓÃDelphiËù²úÉúµÄDLL²¿¼þ¡£ÕâÑù½»»¥µ÷Óã¬ÎÞÐëÖظ´¿ª·¢£¬´ó´óËõ¶ÌÁËÉú²úÖÜÆÚ¡£
¡¡¡¡ Ò»¡¢ÓÃDelphi´´½¨DLL
¡¡¡¡DelphiµÄDLL´´½¨²¢²»¸´ÔÓ£¬ÏÂÃæÏò´ó¼Ò½éÉÜDelphiµÄDLL´´½¨·½·¨¡£
¡¡¡¡1¡¢Ê×ÏÈ´´½¨Ò»¸öеÄDLLÏîÄ¿£¨NewProject£©£¬ÒòΪDLLÓëµ÷ÓÃËüµÄÖ÷³ÌÐòÒª·Ö¿ª±àÒë¡£Èç¹ûDLLÄ£¿éÒѾ½¨Á¢ÔÚµ÷ÓÃËüµÄÏîÄ¿ÖУ¨Project£©£¬Ôò½«ËüµÄ´°Ì壨Form£©´ÓProject¡ ......
ÓÉÓÚ×é¼þÌṩµÄ·½Ê½²»Í¬£¬ËùÒÔ°²×°µÄ·½·¨Ò²ÊDz»Ò»ÑùµÄ£¬ÏÂÃæ¾ÍÄ¿Ç°³£¼ûµÄ¸÷ÖÖÐÎʽµÄ×é¼þµÄ°²×°·½·¨½éÉÜһϡ£
1 Ö»ÓÐÒ»¸öDCUÎļþµÄ×é¼þ¡£DCUÎļþÊDZàÒëºÃµÄµ¥ÔªÎļþ£¬ÕâÑùµÄ×é¼þÊÇ×÷Õß²»Ïë°ÑÔ´Â빫²¼¡£Ò»°ãÀ´Ëµ£¬×÷Õß±ØÐë˵Ã÷´Ë×é¼þÊʺÏDelphiµÄÄÄÖÖ°æ±¾£¬Èç¹û°æ±¾²»¶Ô£¬ÔÚ°²×°Ê±¾Í»á³öÏÖ´íÎó¡£Ò²ÕýÊÇÒòΪûÓÐÔ´Â룬¸øʹÓÃÕß´øÀ´Á˲»±ã£¬ÄǾÍÊÇÒ»µ©Delphi°æ±¾Éý¼¶£¬´Ë×é¼þ¾Í²»ÄÜÔÙʹÓÃÁË£¬µ±È»ÓеÄ×÷Õ߸ø³öÁ˼¸ÖÖ°æ±¾µÄDCUÎļþ£¬Óû§¸ù¾ÝÐèҪѡÔñʹÓá£ÕâÑùµÄ×é¼þµÄ°²×°·½·¨ÊÇ£ºÔÚComponent²Ëµ¥ÖУ¬Ñ¡Ôñinstall component£¬ÔÚ¶Ô»°¿ò "into existing package"Ò³ÖУ¬µ¥»÷“Unit file name”ºóµÄ“Browse”°´Å¤£¬ÔÚ´ò¿ªµÄÎļþ¶Ô»°¿òÖУ¬½«“ÎļþÀàÐÍ”É趨Ϊ*.dcu£¬ÕÒµ½Òª°²×°µÄDCUÎļþ£¬°´OK°´Å¥·µ»Ø"into existing package"Ò³ºóÔÙ°´OK°´Å¥¾Í¿ÉÒÔ°²×°ÁË¡£×¢Ò⣬´ËʱDelphi»áÌáʾdclusr40.dpk½«±»Öؽ¨£¬ÊÇ·ñ¼ÌÐø£¬OK¾Í¿ÉÒÔÁË¡£ÕâÀïÊǽ«×é¼þ°²×°µ½dclusr40.dpk°üÖУ¬´Ë°ü´ÓÎļþÃûÉÏ¿ÉÒÔ¿´³öÊÇÓû§×Ô¶¨Òå×é¼þ°ü£¬ÏÈ°²×°µ½Õâ¸ö°üÖаɣ¬ÏÂÃæÔÙ½²ÓйØ×¢ÒâÊÂÏî¡£°²×°Íê±Ï»áÓÐÒѾ½«×é¼þ×¢²áÍêµÄÌáÊ ......
»ñÈ¡post£¬»òÕßget·µ»ØµÄcookie£¬³ýÁ˹ýÂË·µ»ØµÄ×Ö·û´®Ö®Í⣬×î¼òµ¥µÄ·½·¨ÊÇʹÓÃidhttpµÄCookieManagerÊôÐÔ
±ÈÈç»ñµÃIDhttp·µ»ØµÄÈ«²¿Cookie
if idhttp1.CookieManager.CookieCollection.Count > 0 then
for i := 0 to idhttp1.CookieManager.CookieCollection.Count - 1 do
temp := temp + idhttp1.CookieManager.CookieCollection.Items[i] .CookieText + ';';
Ò²¿ÉÒÔͨ¹ýÊôÐÔÃûºÍÊôÐÔÖµµÄÐÎʽ»ñµÃ£¬ÕâÑù¾Í¿ÉÒÔÌáÈ¡³ö¸ö±ðµÄCookieÖµ
idhttp1.CookieManager.CookieCollection.Items[i]
.CookieName idhttp1.CookieManager.CookieCollection.Items[i]
.Value
±ÈÈ磺
temp := TStringList.Create;
if idhttp1.CookieManager.CookieCollection.Count > 0 then
for i := 0 to idhttp1.CookieManager.CookieCollection.Count - 1 do
// temp := temp + idhttp1.CookieManager.CookieCollection.Items[i] .CookieText + ';';
temp.Add(idhttp1.CookieManager.CookieCollection.Items[i]
.CookieName + '=' + idhttp1.CookieManager.CookieCollection.Items[i]
.Value);
......
¶¯Ì¬Á´½Ó¿âÊÇÒ»¸öÄܹ»±»Ó¦ÓóÌÐòºÍÆäËüµÄDLLµ÷ÓõĹý³ÌºÍº¯ÊýµÄ¼¯ºÏÌå,ËüÀïÃæ°üº¬µÄÊǹ«¹²´úÂë»ò×ÊÔ´¡£ÓÉÓÚDLL´úÂëʹÓÃÁËÄÚ´æ¹²Ïí¼¼Êõ,ÔÚijЩµØ·½windowsÒ²¸øÁËDLLһЩ¸ü¸ßµÄȨÏÞ,Òò¶øDLLÖпÉÒÔʵÏÖһЩһ°ã³ÌÐòËù²»ÄÜʵÏֵŦÄÜ,ÈçʵÏÖwindowsµÄHOOK¡¢ISAPIµÈ¡£Í¬Ê±,DLL»¹Îª²»Í¬ÓïÑÔ¼ä´úÂë¹²ÏíÌṩÁËÒ»Ìõ·½±ãµÄ;¾¶¡£Òò¶øDLLÔÚ±à³ÌʱӦÓýÏΪ¹ã·º,±¾ÎĽ«½éÉÜÈçºÎÔÚ Delphi Öн¨Á¢ºÍʹÓÃDLL¡£
Ò»£®DLL ¿âÄÚ´æ¹²Ïí»úÖÆ
´ÓʹÓÃЧ¹û¿´,DLLºÍunit ºÜÏñ,ËüÃǶ¼¿ÉÒÔ±»±ðµÄ¹¤³ÌÄ£¿éËùµ÷ÓÃ,µ«¶þÕßÔÚÄÚ²¿µÄʵÏÖ»úÖÆÉÏÈ·´æÔÚ×Ųî±ð¡£Èç¹ûÒ»¸ö³ÌÐòÄ£¿éÖÐÓÃusesÓï¾äÒýÓÃÁËij¸öunit,±àÒë³ÌÐòÔÚ±àÒë¸ÃÄ£¿éʱ,±ã»áÁ¬Í¬unitÒ»Æð±àÒë,²¢°Ñ±àÒëºóµÄ¿ÉÖ´ÐдúÂëÁ´½Óµ½±¾³ÌÐòÄ£¿éÖÐ,Õâ¾ÍÊÇÒ»¸ö³ÌÐòÄ£¿éÄܹ»µ÷ÓÃËùÒýÓÃunitÖйý³ÌºÍº¯ÊýµÄÔÒò¡£µ±Í¬Ò»¸öunit±»¶à¸ö¹¤³ÌËùÒýÓÃʱ,Ôòÿ¸ö¹¤³ÌÖж¼º¬ÓиÃunitµÄ¿ÉÖ´ÐдúÂë,µ±º¬ÓиÃunitµÄ¶à¸ö¹¤³ÌͬʱִÐÐʱ,unitµÄ¿ÉÖ´ÐдúÂë»áË治ͬ¹¤³Ì¶ø¶à´Î±»µ÷ÈëÄÚ´æ,Ôì³ÉÄÚ´æ×ÊÔ´µÄÀË·Ñ¡£DLLÔò²»Í¬,Ëü¼´Ê¹±»Ä³¸ö¹¤³Ìµ÷ÓÃ,±àÒëºóÈÔÊǶÀÁ¢µÄ,Ò²¾ÍÊÇ˵±àÒëºó,Ò»¸öDLL¿âÐγÉÒ»¸öµ¥¶ÀµÄ¿ÉÖ´ÐÐÎļþ,¶ø²»ÓëÈκÎÆäËüµÄ¿ÉÖ´ÐÐÎļþÁ¬½ÓÔÚÒ»Æð,Òò¶øDLL¿â ......
Client:TSocketConnection ºÍServer: Scktsrvr¹Øϵ----ѹËõÊý¾Ý´«Êä
Ò»Ö±ÓÃSocketConnectionºÍ·þÎñ¶ËµÄ´«ÊäÊý¾ÝÔÚÈý²ãÊý¾Ý¿âÖУ¬´ÓÀ´Ã»ÓÐ×¢Òâµ½ËüÃÇÖ®¼äµÄÊý¾Ý´«Ê䣬ֻÊÇÏë×Å£¬¹ÜËüÁË£¬ÍøÂçµÄÊ£¬Ç°¶Îʱ¼äÔÚDelphiÖеÄDemosÖз¢ÏÖDemos\Midas\Intrcpt.dprÀý×Ó£¬ºÇºÇ£¬ÔÙ¿´ÁË°ëÌìµÄVCL·¢ÏÖ¿ÉÒÔ½«Client¶Ë·¢Ë͵ĸøServerµÄÊý¾Ý£¬ºÍServer·¢Ë͸øClientµÄÊý¾ÝÊÇ¿ÉÒÔ½øÐÐѹËõµÄ¡£ºÇºÇ£¬²»¸Ò²Ø˽£¬Share¸ø´ó¼Ò¡£
1:
×¼±¸¹¤×÷,ÏÈdelphi¹âÅÌÖеÄ\info\extras\zlib\zlib.pas½øÐбàÒȻºócopy µ½lib·¾¶ÖУ¬ÒòΪҪѹËõÊý¾Ý£¬±ØÐëÒªÓÐѹËõ¹¦ÄÜ£¬Õâ¸ödelphiÒѾ×Ô´ø£¬ËüÊÇ»ùÓÚÁ÷µÄ·½Ê½¶Ô½Ó¿ÚIDataBlock(TDataBlockʵÏÖ£¬Æäʵ¾ÍÊǶÔTMemoryStreamµÄ²Ù×÷)Êý¾Ý½øÐÐѹËõºÍ½âѹµÄ¡£×öÁËÕâ¸öºó£¬²ÅÄܽøÐÐÏÂÃæµÄ¹¤×÷¡£
2:
Open \Demos\Midas\Intrcpt\Intrcpt.dpr
complier....(ÈçûÓÐ×öµÚÒ»²½£¬ºÙºÙ...)
Éú³ÉIntrcpt.dll
½«Intrcpt.dll copy to System directory,»òÕßÄãµÄ³ÌÐòÏÂÃæ¡£
×¢²áËü£ºregsrvr32 Intrcpt.dll (Ϊʲô£¬Õâ¸öÂï...)
¼ÇסIntrcpt.dprµÄÄǸöGUID,ÄãÒ²¿ÉÒÔ×Ô¼ºÖØÐÂÉú³ÉÒ»¸ö(°´Shift+Ctrl+G)
3:
Server:
Open scktsrvr.exe£¬ÏàП÷λ¶¼ºÜÊìϤÄǽçÃæ£ ......
×ܼǼÊý:644; ×ÜÒ³Êý:108; ÿҳ6 Ìõ;
Ê×Ò³ ÉÏÒ»Ò³ [1] [2] 3
[4] [5] [6] [7] [8] [9] [10] ÏÂÒ»Ò³ βҳ