作者weiyi0321 (weiyi)
看板Visual_Basic
標題Re: [VB6 ] 使用ActiveX DLL
時間Tue May 6 15:27:52 2008
直接把DLL component拉進設計框架使用ABC_Get
跟
透過reference引入DLL (
Dim temp As ABCLib.MyABC←這是Class的名稱
Set temp = New MyABC
Dim s As String
Dim a As Boolean
s = "YES,5"
a = temp.ABC_Get(s)
^^^^^^^^^這會被標示起來
)
在執行時會出現下面的錯誤訊息
Compiler error:
Function or interface marked as restricted, or the function uses an
Automation type not supported in Visual Basic
而被標示起來的function就是DLL裡面提供的method..也就是下面的ABC_Get
DLL interface中method的宣告為
[id(1), helpstring("method ABC_Get")] HRESULT ABC_Get([in]CHAR* Cmd,
[out, retval]BOOL* F);
--
另外我在寫code的時候..
通常寫完function name( ←不是會自動出現提示嗎?
我在寫呼叫DLL method的時候都沒有出現..
麻煩板友們解惑了..感謝
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.114.75.117
※ 編輯: weiyi0321 來自: 140.114.75.117 (05/06 15:29)
推 albb0920:那 Call MyABC.ABC_Get(s,a) 呢? 05/06 16:05
※ 編輯: weiyi0321 來自: 140.114.75.117 (05/06 17:09)
※ 編輯: weiyi0321 來自: 140.114.75.117 (05/06 17:14)
※ weiyi0321:轉錄至看板 Programming 05/06 18:35
推 markart:class的名稱不是被重新定義為temp? 05/07 10:26
→ markart:不是應該叫做temp.ABC_Get(s)嗎? 05/07 10:26
→ weiyi0321:對~我這邊po上來筆誤了~修改一下 05/07 12:08
※ 編輯: weiyi0321 來自: 140.114.75.117 (05/07 12:09)
推 markart:看你要不要確認一下DLL的內容,我自己寫的是沒啥問題 05/07 13:30
→ markart:至於提示,不一定會有 05/07 13:31
→ markart:我剛剛測試一下,自訂的元件跟Class不會有提示 05/07 13:32
→ markart:只有VB內建的元件跟函數、控制項等等才會有 05/07 13:33