VB 6.0 µ÷ÓÃdllµÄÎÊÌâ - .NET¼¼Êõ / VB.NET
ÎÒÔÚVC 6.0ÖÐдÁËÒ»¸öexample.dll£¬ÀïÃæÒ»¸öº¯Êý
extern "C" __declspec(dllexport)
HRESULT __stdcall Connect(LPCSTR IpAddr)
{
...
}
example.dllÖиú¯ÊýÃû³ÆΪ _Connect@4 £¨ÓÃdepends¹¤¾ß²é¿´£©
ÎÒÔÚVB 6.0Öе÷Óô˺¯Êý
Private Declare Function Connect Lib "example.dll" Alias "_Connect@4" (ByVal IpAddr As String) As Long
Dim result As Long
result = Connect("138.139.0.230")
If result <> 0 Then
MsgBox ("error_connect")
Else
MsgBox ("connect_ok")
End If
½á¹û·µ»Ø¶¼ÊÇ·Ç0£¬Á¬½Óʧ°Ü¡£
µ«ÎÒÓÃVC±àдµÄ´úÂëÒÔ¼°ÓÃVB.NET±àдͬÑù¹¦ÄܵĴúÂ붼¿ÉÒÔÁ¬½ÓÉÏ¡£
²»ÖªµÀÕâ¶ÎVB 6.0µÄ´úÂëÓÐʲô²»¶ÔµÄµØ·½¡£
£¨Ö»ÓÐ45·ÖÁË£¬È«É¢ÁË£©
VB.NETºÍVCµ÷ÓÃʱ£¬example.dllûÓмÓ__stdcall¡££¨ÒòΪVB 6.0ÐèÒªÊÇstdcall£©
¼´£º
extern "C" __declspec(dllexport)
HRESULT Connect(LPCSTR IpAddr)
{
...
}
VB.NET´úÂëÈçÏ£º
Imports System.Runtime.InteropServices
<DllImport("./example.dll", CallingConvention:=CallingConvention.Cdecl)> _
Public Function Connect(ByVal IpAddr As String) As Integer
End Function
Dim result As Integer
result = Connect("138.139.0.230") 'Á¬½Óµ¥°å
If result &
Ïà¹ØÎÊ´ð£º
ÔÚvbÖÐÈçºÎ¶ÁÈ¡WordÄÚÈÝ(°üº¬±í¸ñ£¬Í¼Æ¬£¬µÈ£©
¾¹È»²»ÊÇzero¡£
²»ÖªµÀÔõôʵÏֵIJ»ÒªËµ»°
Õâ¸öÖ»ÄܶÁÎı¾,
VB code:
Private Sub Command1_Click()
Dim WordApp As Object
Set WordApp = CreateObject(& ......
ÏÖÔÚÓиöxmlÎļþÊÇ<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xm ......
form1ÖÐÓÐtext1-8£¬ ºÍcommand1
text8ÖÐΪ³ÌÐò´úÂ루Éú³É´°ÌåΪform2£¨ÒÑ×öºÃ£©£©
µ¥»÷command1ºó½«text2ÖеĴúÂëÉú³ÉEXEµ½d:\ ²¢ÇÒtext1-7·Ö±ð¶ÔÓ¦
²úÆ·Ãû ¹«Ë¾Ãû ºÏ·¨°æȨ ºÏ·¨É̱ê ÎļþÃèÊö ×¢ÊÍ ±êÌâ
......
¸÷λ¸ßÊÖ£¬Ð¡µÜ×î½üÅöµ½Ò»¸öÎÊÌ⣺ÔÏÈдµÄ³ÌÐò´ó¸ÅµÄ˼·ÊÇ£ºÊ×ÏÈwebbrowser´ò¿ªÍøÖ·£¬ÍøÖ·ÏÔʾºó£¬µã»÷ÍøÖ·ÉϵÄijһ¸öÁ¬½Ó£¬µ±webbrowser¼ì²âµ½ÍøÖ·ÒѾÁ¬½Óµ½ÏëÒªµÄµØַʱºò¾Í¿ªÊ¼ÏÂÔØÎļþ£¬µ±ÓÃIE6µÄʱºòÏÂÔ ......
ÓÐÁ½¸öÎÊÌâ
µÚÒ»¸öÎÊÌ⣺
ÍøÒ³Ô´Âë
<td><select name="question" onchange="showcustomquest(this.value)" tabindex="4"><option value="0">ÎÞ°²È«ÎÊ ......