DelphiÖж¯Ì¬Á´½Ó¿â(DLL)µÄ½¨Á¢ºÍʹÓÃ
¶¯Ì¬Á´½Ó¿âÊÇÒ»¸öÄܹ»±»Ó¦ÓóÌÐòºÍÆäËüµÄ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¿â²¢²»´ÓÊôÓÚij¸öÌض¨µÄ¹¤³Ì,µ±¶à¸ö¹¤³Ìµ÷ÓÃͬһ¸öDLL¿âʱֻÓеÚÒ»¸ö¹¤³Ì°ÑDLL¿âµ÷ÈëÄÚ´æ,ÆäÓ๤³Ì²¢²»Öظ´µ÷Èëͬһ¸öDLL¿âµ½ÄÚ´æ,¶øÊǵ½Í¬Ò»¸ö¹²ÏíÄÚ´æÇø¶ÁÈ¡¡£²¢ÇÒ,DLLµÄÖ´ÐдúÂëÊÇÔÚ³ÌÐòÔËÐÐÆڼ䶯̬µ÷ÈëµÄ,¶ø²»ÊÇÈçunitÔÚ³ÌÐòÔËÐÐʱ¾ÍÓëÕû¸ö¹¤³ÌÒ»Æðµ÷ÈëÄÚ´æ¡£ÕâÑù±ã¿ÉÏû³ýunit´øÀ´µÄÏàͬ´úÂë¶à´¦Õ¼ÓÃÄÚ´æµÄ±×²¡¡£
¶þ DelphiÖÐDLL¿âµÄ½¨Á¢
¡¡ÔÚDelphi»·¾³ÖÐ,±àдһ¸öDLLͬ±àдһ¸öÒ»°ãµÄÓ¦ÓóÌÐò²¢Ã»ÓÐÌ«´óµÄÇø±ð¡£ÊÂʵÉÏ×÷ΪDLLÖ÷ÌåµÄDLLº¯ÊýµÄ±àд,³ýÁËÔÚÄÚ´æ¡¢×ÊÔ´µÄ¹ÜÀíÉÏÓÐËù²»Í¬Íâ,²¢²»ÐèÒªÆäËüÌرðµÄÊֶΡ£
¡¡¡¡¡¡¡¡Ò»°ã¹¤³ÌÎļþµÄ¸ñʽΪ:
¡¡¡¡program¡¡¡¡¹¤³Ì±êÌâ;¡¡
¡¡¡¡uses¡¡¡¡¡¡¡¡×Ó¾ä;¡¡
¡¡¡¡³ÌÐòÌå
¡¡¡¡¶øDLLs¹¤³ÌÎļþµÄ¸ñʽΪ:
¡¡¡¡library ¹¤³Ì±êÌâ;¡¡
¡¡¡¡uses ×Ó¾ä;¡¡
¡¡¡¡exprots ×Ó¾ä;¡¡
¡¡¡¡³ÌÐòÌå
¡¡¡¡ËüÃÇÖ÷ÒªµÄÇø±ðÓÐÁ½µã:
¡¡¡¡1.Ò»°ã¹¤³ÌÎļþµÄÍ·±êÓÃprogram¹Ø¼ü×Ö,¶øDLL¹¤³ÌÎļþÍ·±êÓÃlibrary ¹Ø¼ü×Ö¡£²»Í¬µÄ¹Ø¼ü×Ö֪ͨ±àÒëÆ÷Éú³É²»Í¬µÄ¿ÉÖ´ÐÐÎļþ¡£ÓÃprogram¹Ø¼ü×ÖÉú³ÉµÄÊÇ.exeÎļþ,¶øÓÃlibrary¹Ø¼ü×ÖÉú³ÉµÄÊÇ.dllÎļþ;
¡¡¡¡2.¼ÙÈçDLLÒªÊä³ö¹©ÆäËüÓ¦ÓóÌÐòʹÓõĺ¯Êý»ò¹ý³Ì,Ôò±ØÐ뽫ÕâЩº¯Êý»ò¹ý³ÌÁÐÔÚe
Ïà¹ØÎĵµ£º
ÒÔÏÂÊÇtest.htmÒ³µÄÄÚÈÝ
Ê×Ïȶ¨ÒåÒ»¸ö²å¼þ¶ÔÏó
<object id="Mapupload" name="Mapupload" width="0" height="0" classid="clsid:045FA9B9-B373-4D4C-AE76-128A19A4B6AE">
</object>
<script type="text/javascript">
//´Ëº¯Êý´ò¿ªactivexform´°Ì岢Ϊactiv ......
ÎÄÕÂÀ´Ô´£ºIT¹¤³ÌÐÅÏ¢Íø http://www.systhinker.com/html/09/n-12309.html
֮ǰÓÃAccess×÷Ò»¸öÓ¦Ó㬵«ÕÒ²»µ½»õ±Òת»»³É´óдÈËÃñ±ÒµÄ¹¦ÄÜ£¨µ±È»¿ÉÒÔͨ¹ýexcel ת»»£¬µ«²»ÔÚÒ»¸öÓ¦ÓÃÉÏ£¬·ÅÆú£©¡£ÒÔΪ±È½Ï¼òµ¥£¬×Ô¼ºÊÔд£¬ËÖªÓÃÁËÁ½¸öÍíÉÏ£¬²Å»ù±¾ÊµÏÖ£¬µ«Ã»ÓÐСÊýµã£¨Ôª£©ÒÔÏ»õ±ÒµÄת»»¡£Ò²Ã»ÓÐÕ×µÄÅжϡ£¶øÇÒ¶Ô×Ö· ......
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----------------
......
Delphi¿½±´Ä¿Â¼(º¬×ÓĿ¼)µÄ·½·¨
ҪʵÏÖĿ¼¼¶µÄ¿½±´£¬¿ÉÒÔÀûÓÃWindows APIº¯ÊýShFileOperation( )£¬Æ亯ÊýÉùÃ÷ÈçÏ£º
WINSHELLAPI int WINAPI SHFileOperation(
LPSHFILEOPSTRUCT lpFileOp
);
ʵÀý£º
н¨Ò»¸ö¹¤³Ì£¬Æä³ÌÐòʾÀýÈçÏ£º
unit Unit1;
interface
uses
Windows, Messag ......