vbÖÆ×÷¿ÉÊä³öº¯ÊýµÄͨÓÃDLL VB_DLL_LinkÓ÷¨
vbÖÆ×÷¿ÉÊä³öº¯ÊýµÄͨÓÃDLL---VB_DLL_LinkÓ÷¨
ÂÛ̳ԽÀ´Ô½¶àÈ˹Ø×¢dll£¬ÌØ·ÖÏíÒ»ÏÂvbÖÆ×÷¿ÉÊä³öº¯ÊýµÄͨÓÃDLL---VB_DLL_LinkÓ÷¨
´ó¼ÒÖªµÀ£¬VB6Ö»ÄÜÖÆ×÷ActiveX DLLÎļþ£¬ÖÆ×÷ÄÜÊä³öº¯ÊýµÄͨÓÃDLLÎļþͨ³£ÒªÓõ½VCµÈ¹¤¾ß¡£Êµ¼ÊÉÏ£¬VBÔÚ±àÒëµÄʱºò¼ÓÒÔ¿ØÖÆ£¬¾¹ýÊʵ±´¦ÀíÒ²ÊÇ¿ÉÒÔÖÆ×÷ͨÓÃDLLµÄ¡£Ê¹ÓÃVB_DLL_Link³ÌÐò¾Í¿ÉÒÔÀûÓÃVB±àÒë³öͨÓõÄDLLÎļþ£¬´ËDLLÎļþ¿ÉÒÔ±»ÆäËû³ÌÐòµ÷Óã¬ÀýÈçÔÚVBÖÐÓÃDeclareÓï¾äµ÷Óò¢Ö´ÐÐDLLÖеĺ¯Êý¡£ÏÂÃæ½éÉÜVB_DLL_LinkµÄʹÓ÷½·¨£º
1¡¢°²×°£º
±¾Èí¼þΪ´¿ÂÌÉ«Èí¼þ¡£ÏÂÔØVB_DLL_Link.exeºó£¬Ë«»÷Ëü¾Í¿ÉÒÔ×Ô¶¯°²×°ÁË¡£ÄãÒ²¿ÉÒÔÊÖ¶¯½«Ëü¸´ÖƵ½VB6³ÌÐòĿ¼Ï£¬½«ÔLink.exe¸ÄÃûΪLink2.exe£¬ÔÙ½«VB_DLL_Link.exe¸ÄÃûΪLink.exe¼´¿É¡£
2¡¢Éú³ÉDLL£º
°²×°ºÃVB_DLL_Linkºó£¬´ò¿ªVB6£¬Ð½¨±ê×¼exe¹¤³Ì£¬¹¤³Ì²Ëµ¥>>ÒƳýForm1£¬Ìí¼ÓÒ»¸ö±ê׼ģ¿éÈçModule1.bas£¬Ê×ÏÈÏòÆäÖÐдÈëDLLµÄÈë¿Ú´úÂ룺
Function DLLMain(ByVal hInstDLL As Long, ByVal fdwReason As Long, ByVal lpwReserved As Long) As Long
DLLMain = 1
End Function
×¢Òâ²ÎÊýÐÎʽһ¶¨ÒªÕýÈ·£¬·ñÔò±àÒëʧ°Ü¡£¸ß¼¶±à³ÌʱÕâЩ²ÎÊýºÜÓÐÓá£ÔÚÊ״ε÷ÓÃDLLºÍµ÷ÓÃDLLµÄÔ³ÌÐòÍ˳öʱ¾ù»áÖ´ÐÐDLLMainº¯Êý¡£Õâ¸öº¯ÊýÊDZØÐëµÄ¡£
ΪÁËʹVB²»±¨´í£¬»¹Ðè¼ÓÈëÒÔÏ´úÂ룺
Sub Main()
'È·±£VBÄܱàÒë
End Sub
È»ºó¾Í¿ÉÒÔÏòModule1.basÖÐдÈë×Ô¶¨Ò庯Êý´úÂëÁË£¬È磺
Function Add(ByVal A As Double, ByVal B As Double) As Double
MsgBox A + B
Add = A + B
End Function
Private Sub M(s As String)
MsgBox s, vbInformation
End Sub
±àдºÃ´úÂëºó£¬±£´æ¹¤³Ì£¬Ñ¡ÔñÎļþ²Ëµ¥>>Éú³Éexe£¬×¢Ò⽫ÎļþÀ©Õ¹Ãû¸ÄΪ.dll£¬·ñÔò±¾Èí¼þ²»Äܵ÷³ö¡£È»ºó±¾³ÌÐò¾Í»áÔËÐУ¬³öÏÖÒ»¸ö¶Ô»°¿òÌáʾѡÔñ´Ë¹¤³ÌÐèÒªµ¼³öµÄº¯ÊýËùÔÚµÄÄ£¿éÎļþ£¬´ËÀý¼´Module1.bas£¬Ñ¡ÔñºÃºó±¾³ÌÐòÖ÷´°¿Ú»áÁгöModule1.basÖÐËùÓеĺ¯ÊýÃû¡£Èç¹ûÓжà¸öÄ£¿é£¬¿ÉÒÔÑ¡Ôñ"´ÓÄ£¿éÌí¼Ó"°´Å¥¼ÌÐøÌí¼Óº¯ÊýÃû¡£"Ìí¼Óº¯ÊýÃû"°´Å¥¿ÉÊÖ¶¯Ìí¼ÓÏÖ´æµÄº¯ÊýµÄÃû³Æ¡£È»ºó¹´Ñ¡ÐèÒªµ¼³öµÄº¯ÊýÃû£¬µã»÷"±àÒëΪÄÜÊä³öº¯ÊýµÄDLL"°´Å¥£¬¼´¿É±àÒë³öͨÓÃDLLÎļþÁË£¬ËüÄÜÊä³öº¯ÊýÁбíÖдò¹´µÄËùÓк¯Êý¡£Èô²»ÐèÒª±àÒëΪͨÓÃDLL£¬Çëµã»÷"³£¹æ±àÒë"»ò°´Esc¼ü¡£
3¡¢Ó¦ÓÃDLL£º
±àÒëºÃµÄͨÓÃDLLÎļþ£¬¿É°´³£¹æDLLÎļþµÄµ÷Ó÷½·¨¼ÓÒÔµ÷Ó
Ïà¹ØÎĵµ£º
¡¡¡¡Èç½ñOCX¿Ø¼þÔÚ±à³ÌÖÐÒÑÕ¼ÁìÁ˺ÜÖØÒªµÄµØλ,ÎÒÃÇ¿ÉÒÔÀûÓÃOCX¿Ø¼þÍê³ÉһЩÏ൱¸´Ôӵıà³Ì²Ù×÷.ͬʱOCX ¿Ø¼þ»¹ÓÐÀûÓÚÖ÷³ÌÐòµÄ¼òµ¥»¯¡¢¹¦ÄܵÄÖØÓá¢Òþ³£³ÌÐòʵÏÖϸ½Ú¡¢±ãÓÚÉý¼¶¡¢´«²¥·½±ãµÈÓŵ㡣ÏÖÔÚÎÒÃÇ¿ÉÒÔÀûÓÃVB 5.0·½±ãµÄÖÆ×÷³ö×Ô¼ºµÄOCX¿Ø¼þ¹©ÎÒÃÇÔÚ±à³ÌÖÐʹÓÃͬʱ»¹¿ÉÒÔ°ÑËüË͸øÄãÖÜΧϲ»¶±à³ÌµÄÅóÓÑ!
ÏÂÃæÁгöÖÆ× ......
'* ************************************************************** *
'* ³ÌÐòÃû³Æ£ºmodNtSrv
'* ³ÌÐò¹¦ÄÜ£ºÊµÏÖNT·þÎñ
'* ×÷Õߣºlyserver
'* ÁªÏµ·½Ê½£ºhttp://blog.csdn.net/lyserver
'* ************************************************************** *
Option Explicit
' ......
ÓôÃÆ£¬ÎÒʹÓõÄÕâ¸ö¿Õ¼äµÄIDCÉ̾¹È»Ã¿¸ôÒ»¶Îʱ¼ä¾ÍÒª¼ì²â°ó¶¨µÄÓòÃûÊÇ·ñÔÙδÌá½»±¸°¸ÁбíÖУ¬Èç¹ûÊǾÍɾ³ý£¬µ«ÊÇÈ´²»¼ì²âÎÒÊÇ·ñÌá½»Á˱¸°¸£¬°´ÕÕËûÃÇ˵·¨É¾³ýÓòÃûÒ»Ììºó²ÅÄÜÔٴΰ󶨣¬·ñÔòÕâÒ»ÌìÄÚ°ó¶¨Á˵½Ï´μì²â¾Í»áÔÙɾ³ý¡£ÕâÑùÎҾͲ»Í£µÄÔÚºǫ́¿´£¬¿´ÊÇ·ñ±»É¾³ý£¬Èç¹û±»É¾³ý£¬¾ÍÔÙ°ÑÓòÃû°ó¶¨ÉÏÈ¥£¬;(ºÜÊÜÉË£¡
ÓÚÊÇÓÃV ......
Óɵ×ÖÁÉÏÊÇ£º
• ÍйÜ×ÊÔ´
• WMI »ù´¡½á¹¹
• ʹÓÃÕß
ÍйÜ×ÊÔ´
ÍйÜ×ÊÔ´ÊÇÈÎÒâÂß¼»òÎïÀí×é¼þ£¬Í¨¹ýʹÓà WMI ½øÐй«¿ªºÍ¹ÜÀí¡£¿ÉÒÔʹÓà WMI ¹ÜÀíµ ......