(ת)VBÖд´½¨¿ÉÒÔÊä³öº¯ÊýµÄDLL
VBÖд´½¨µÄDLLÖ»ÊÇCOM×é¼þ£¬ÎÞ·¨×÷ΪÊä³öº¯ÊýµÄDLL¡£½ñÌì´ÓÅóÓÑÄÄÀï¸ãµ½Ò»ÖÖ¿ÉÒÔ´´½¨Êä³öº¯ÊýµÄDLLµÄ·½·¨£¬ÐÀϲ֮Ó࣬²»¸Ò¶ÀÏí£¬ÏÖÔÚ°ÑËû½éÉܸø´ó¼Ò¡£
¡¡¡¡VB±àÒëÎļþʵ¼ÊÉϲÉÈ¡ÁËÁ½´Î±àÒëµÄ·½·¨£¬Ê×ÏÈÊǵ÷ÓÃc2.exe²úÉúOBJÎļþ£¬È»ºóµ÷ÓÃLink.exeÁ¬½Ó¡£Èç¹ûÔÚlinkµÄʱºòÌí¼ÓEXPORTÑ¡Ïʵ¼ÊÉÏÊÇ¿ÉÒÔÊä³öº¯ÊýµÄ¡£µ«ÊÇ£¬ÔÚVBµÄ¹¤³ÌÑ¡ÏîÖн«ÕâЩÆÁ±ÎÁË¡£¶øÇÒ¹ý·ÖµÄÊÇ£ºVBÔÚBuildÍê³Éºó»á½«OBJÎļþɾ³ý£¬ÕâÑù¾ÍÎÞ·¨Í¨¹ýLinkÀ´Êä³öº¯ÊýÁË¡£²»¹ýÎÒÕÒµ½Ò»¸ö±È½Ïö»õºµÄ±äͨµÄ·½·¨£¬¾ÍÊÇÏÈ´´½¨Ò»¸öExe¹¤³Ì£¬ÔÚForm_LoadʼþÀïÃæдÏÂÃæµÄÓï¾ä:
Private Sub Form_Load()
If (MsgBox("hehe", vbOKCancel) = vbOK) Then
Shell "link2.exe " & Command$
End If
End
End Sub
¡¡¡¡È»ºó±àÒëΪlinktemp.exe£¬½ÓÏÂÀ´½«LINK.EXE¸ÄÃûΪLink2.exe£¬½«linktemp.exe¸ÄÃûΪlink.exe¡£ÕâÑùÔÚVBµ÷ÓÃlink.exeʱ»áµ¯³ö¶Ô»°¿ò£¬´¦Àí¾Í»áÖжϡ£Õâʱ¾Í¿ÉÒÔÓлú»á½«OBJÎļþ¿½±´³öÀ´ÁË J
¡¡¡¡È»ºóÎÒ´´½¨ÁËÒ»¸öActiveX DLL¹¤³Ì£¬ÔÚÕâ¸ö¹¤³ÌÀïÃæÌí¼ÓÒ»¸öModule²¢´´½¨Ò»¸öPublicº¯Êýmathadd£º
Public Function mathadd(ByVal a As Long, ByVal b As Long) As Long
mathadd = a + b
End Function
¡¡¡¡BuilderÕâ¸ö¹¤³Ì£¬ÔÚLinkµÄʱºò¾Í»áÖжϡ£È»ºó°Ñ´´½¨µÄClass1.obj¡¢Module1.obj¡¢Project1.obj±¸·Ý³öÀ´¡£
¡¡¡¡È»ºó¾Í¿ÉÒÔµ÷ÓÃLink2.exeÁ¬½ÓOBJµ½DLLÁË£¬ÎÒµÄÁ¬½Ó´úÂëÊÇ£º
link2.exe "e:\vbdll\Class1.obj" "e:\vbdll\Module1.obj" "e:\vbdll\Project1.obj" "E:\Program Files\Microsoft Visual Studio\VB98\VBAEXE6.LIB" /ENTRY:__vbaS /EXPORT:mathadd /OUT:"e:\vbdll\ProjectOK.dll" /BASE:0×11000000 /SUBSYSTEM:WINDOWS,4.0 /VERS
¡¡¡¡×¢ÒâÀïÃæµÄ/ENTRYºÍ/EXPORT¿ª¹Ø£¬/EXPORT¿ª¹ØÉùÃ÷ÁËÊä³öº¯Êýmathadd¡£ÕâÑù¾Í´ó¹¦¸æ³ÉÁË £¬¿ÉÒÔ±»ÆäËûÓïÑÔÒýÈ룬ÀýÈçÔÚVBÖУ¬Ö»ÐèÒª£º
Private Declare Function mathadd Lib "e:\vbdll\ProjectOK.dll" (ByVal a As Long, ByVal b As Long) As Long
¡¡¡¡¾Í¿ÉÒÔÁË¡£
Ïà¹ØÎĵµ£º
Option Explicit
Private Sub Form_Load()
'¹¤³Ì->ÒýÓÃ->Ñ¡ÖÐMicrosoft ActiveX Data Objects 2.8 Library
Dim shujukulianjie As New ADODB.Connection
Dim jiluji As New ADODB.Recordset
'Á¬½ÓÊý¾Ý¿âµÄ´úÂë¶Î
shujukulianjie.Open "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Sour ......
Private Type SECURITY_ATTRIBUTES
nLength As Long
lpSecurityDescriptor As Long
bInheritHandle As Boolean
End Type
Dim lang As String
Private Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (ByVal hkey As Long, ByV ......
1. ÀûÓÃ×ÊÔ´Îļþ±£´æ¹ú¼Ê»¯Áбí
2.“Íâ½Ó³ÌÐò”--“Íâ½Ó³ÌÐò¹ÜÀíÆ÷”--“VB6 ×ÊÔ´±à¼Æ÷”¾Í¿ÉÒÔ±à¼×ÊÔ´Îļþ
3.²¿·Ö´úÂë
'´°Ìå¼ÓÔØ
Private Sub Form_Load()
Dim LocaleID As Long
LocaleID = GetSystemDefaultLCID
Select Case LocaleID
'Ó¢ÎÄ
......
×î½üÓÉÓÚ¹¤×÷ÏîÄ¿ÔÒò£¬ÁÙʱҪÇó×öÒ»¸ö¾ÖÓòÍøɨÃèÈí¼þ¡£¹¦ÄÜÒªÇó£¬É¨Ãè³öIPµØÖ·ÒÔ¼°¶ÔÓ¦µÄMACµØÖ·¡£¹¦ÄܱȽϼòµ¥¡£ÓÚÊǺܿì¾Í×öÁË¡£²ÉÓõĿª·¢¹¤¾ßÊÇ VB6.0
ʹÓ÷½·¨ÊÇͨ¹ý·¢ËÍ ARP°ü£¬¹ã²¥ IPµØÖ·µÄ·½Ê½À´»ñµÃ ¶ÔÓ¦µÄ MACµØÖ·£¬SendARP£¨£©¡£
ÓÐһЩϸ½ÚҪעÒ⣬¾ÍÊÇ Êä³öMACµØÖ ......
´ÓÍøÉÏËѼ¯µ½µÄVB´úÂ룬ÓÃEXE·½Ê½ÊµÏÖÁËÔ¶³Ì×¢È룬²»¹ýÔÚ·´²¡¶¾Èí¼þµÄ±£»¤Ï£¬ÓпÉÄܵ¼ÖÂ×¢Èëʧ°Ü¡£×ªÌùÕâ¸ö´úÂ룬½ö¹©´ó¼ÒѧϰºÍ²Î¿¼¡£
Ò»¡¢´°¿Ú´úÂ룺
Option Explicit
Private Sub cmdLock_Click()
If LockKeyboard(True) Then
cmdLock.Enabled = False
cmdUnLock.Enabled = Tr ......