delphi¶àÏß³Ì
DelphiÖÐÓÐÒ»¸öÏß³ÌÀàTThreadÊÇÓÃÀ´ÊµÏÖ¶àÏ̱߳à³ÌµÄ£¬Õâ¸ö¾ø´ó¶àÊýDelphiÊé½å¶¼ÓÐ˵µ½£¬µ«»ù±¾É϶¼ÊǶÔTThreadÀàµÄ¼¸¸ö³ÉÔ±×÷Ò»¼òµ¥½éÉÜ£¬ÔÙ˵Ã÷Ò»ÏÂExecuteµÄʵÏÖºÍSynchronizeµÄÓ÷¨¾ÍÍêÁË¡£È»¶øÕâ²¢²»ÊǶàÏ̱߳à³ÌµÄÈ«²¿£¬ÎÒд´ËÎĵÄÄ¿µÄÔÚÓÚ¶Ô´Ë×÷Ò»¸ö²¹³ä¡£
Ï̱߳¾ÖÊÉÏÊǽø³ÌÖÐÒ»¶Î²¢·¢ÔËÐеĴúÂë¡£Ò»¸ö½ø³ÌÖÁÉÙÓÐÒ»¸öỊ̈߳¬¼´ËùνµÄÖ÷Ï̡߳£Í¬Ê±»¹¿ÉÒÔÓжà¸ö×ÓÏ̡߳£µ±Ò»¸ö½ø³ÌÖÐÓõ½³¬¹ýÒ»¸öÏß³Ìʱ£¬¾ÍÊÇËùνµÄ“¶àÏ߳̔¡£
ÄÇôÕâ¸öËùνµÄ“Ò»¶Î´úÂë”ÊÇÈçºÎ¶¨ÒåµÄÄØ£¿Æäʵ¾ÍÊÇÒ»¸öº¯Êý»ò¹ý³Ì£¨¶ÔDelphi¶øÑÔ£©¡£
Èç¹ûÓÃWindows APIÀ´´´½¨Ï̵߳Ļ°£¬ÊÇͨ¹ýÒ»¸ö½Ð×öCreateThreadµÄAPIº¯ÊýÀ´ÊµÏֵģ¬ËüµÄ¶¨ÒåΪ£º
HANDLE CreateThread(
LPSECURITY_ATTRIBUTES lpThreadAttributes,
DWORD dwStackSize,
LPTHREAD_START_ROUTINE lpStartAddress,
LPVOID lpParameter,
DWORD dwCreationFlags,
LPDWORD lpThreadId
);
Æä¸÷²ÎÊýÈçËüÃǵÄÃû³ÆËù˵£¬·Ö±ðÊÇ£ºÏß³ÌÊôÐÔ£¨ÓÃÓÚÔÚNTϽøÐÐÏ̵߳ݲȫÊôÐÔÉèÖã¬ÔÚ9XÏÂÎÞЧ£©£¬¶ÑÕ»´óС£¬ÆðʼµØÖ·£¬²ÎÊý£¬´´½¨±êÖ¾£¨ÓÃÓÚÉèÖÃÏ̴߳´½¨Ê±µÄ״̬£©£¬Ïß³ÌID£¬×îºó·µ»ØÏß³ÌHandle¡£ÆäÖеÄÆðʼµØÖ·¾ÍÊÇÏ̺߳¯ÊýµÄÈë¿Ú£¬Ö±ÖÁÏ̺߳¯Êý½áÊø£¬Ïß³ÌÒ²¾Í½áÊøÁË¡£
Õû¸öÏ̵߳ÄÖ´Ðйý³ÌÈçÏÂͼËùʾ£º
ÒòΪCreateThread²ÎÊýºÜ¶à£¬¶øÇÒÊÇWindowsµÄAPI£¬ËùÒÔÔÚC Runtime LibraryÀïÌṩÁËÒ»¸öͨÓõÄÏ̺߳¯Êý£¨ÀíÂÛÉÏ¿ÉÒÔÔÚÈκÎÖ§³ÖÏ̵߳ÄOSÖÐʹÓã©£º
unsigned long _beginthread(void (_USERENTRY *__start)(void *), unsigned __stksize, void *__arg);
DelphiÒ²ÌṩÁËÒ»¸öÏàͬ¹¦ÄܵÄÀàËƺ¯Êý£º
function BeginThread(SecurityAttributes: Pointer; StackSize: LongWord; ThreadFunc: TThreadFunc; Parameter: Pointer; CreationFlags: LongWord; var ThreadId: LongWord): Integer;
ThreadFunc£ºÏ̺߳¯Êý£¬
BeginThread£ºÏß³ÌÆô¶¯º¯Êý¡£
ÕâÈý¸öº¯ÊýµÄ¹¦ÄÜÊÇ»ù±¾ÏàͬµÄ£¬ËüÃǶ¼Êǽ«Ï̺߳¯ÊýÖеĴúÂë·Åµ½Ò»¸ö¶ÀÁ¢µÄÏß³ÌÖÐÖ´Ð
Ïà¹ØÎĵµ£º
3.2 Óû§µÇ¼·½°¸
ÔÚ½øÈëÒ»¸öϵͳʱ£¬±ØÐëÏÈÔڵǼ´°ÌåÖÐÊäÈëÕýÈ·µÄÓû§ÃûºÍÃÜÂë²ÅÄܽøÈë¡£ÕâÑù¿ÉÒÔÈ·±£ÏµÍ³µÄ°²È«ÐԺͱ£ÃÜÐÔ£¬µÇ¼´°ÌåµÄÖÆ×÷°´ÕÕϵͳµÄ´óС¼°Óô¦£¬¿ÉÒÔ·ÖΪ²»Í¬µÄµÇ¼´°ÌåÑùʽ£¬ÔÚϵͳµÚÒ»´ÎµÇ¼ǰ£¬Ê×ÏÈÒª¶Ô²Ù×÷Ô±ÐÅÏ¢½øÐÐÏàÓ¦µÄÉèÖᣱ¾½Ú½«¶ÔµÇ¼´°Ìå¼°²Ù×÷Ô±¹ÜÀí´°ÌåµÄÖÆ×÷¹ý³Ì½øÐÐÏêϸµÄ˵Ã÷ ......
Ò»¡¢Ê¹ÓÃÎļþÁ÷µÄ·½·¨½øÐп½±´£¬µ±È»¡£Í¬ÑùµÄµÀÀí£¬ÄãÒ²¿ÉÒÔʹÓÃÄÚ´æÁ÷µÈ·½·¨½øÐÐÎļþµÄ¿½±´£¬ÔÀíÊÇÒ»ÑùµÄ¡£
procedure copyfile(sourcefilename,targetfilename : String);
var f1, f2: tfilestream;
begin
f1 := tfilestream.Create(sourcefilename, fmopenread);
try
f2 := tfilestream ......
Delphi¿½±´Ä¿Â¼(º¬×ÓĿ¼)µÄ·½·¨
ҪʵÏÖĿ¼¼¶µÄ¿½±´£¬¿ÉÒÔÀûÓÃWindows APIº¯ÊýShFileOperation( )£¬Æ亯ÊýÉùÃ÷ÈçÏ£º
WINSHELLAPI int WINAPI SHFileOperation(
LPSHFILEOPSTRUCT lpFileOp
);
ʵÀý£º
н¨Ò»¸ö¹¤³Ì£¬Æä³ÌÐòʾÀýÈçÏ£º
unit Unit1;
interface
uses
Windows, Messag ......
»ñÈ¡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.Cooki ......
¿ª·¢²½Ö裺
1¡¢´´½¨ActiveX Library¹¤³Ì¡£
2¡¢´´½¨COM Object¡£
3¡¢´´½¨Type Library£¬²¢´´½¨ÏàÓ¦½Ó¿Ú¡£
4¡¢´´½¨½Ó¿Ú¶ÔÓ¦µÄº¯ÊýºÍʵÏÖ¡£
¾ßÌåÈçÏ£º
1¡¢´´½¨ActiveX Library¹¤³Ì¡£
new|other|activeX|activeX library
Delphi»á×Ô¶¯Éú³É¿ò¼Ü´úÂ룬ֱ½Ó±àÒëµÄ»°¾Í¿ÉÒԵõ½Ò»¸ödllÎļþÁË£»
Èç¹ûÏë±àÒë³öÀ´µÄÊÇocxÎÄ ......