Declare 关键字是干什么的?

wohaorende 2010-01-17 01:12:10
我个人理解,Declare 就是用来访问System32下面东西的。
还请高人耐心解释一下!谢谢。
我也写了一个非常简单的DLL。(上网找资料发现,貌似不是标准DLL
我甚至都不知道为什么要写System32下面的DLL。不过觉得有意思。)
Public Class test

Public Function test1(ByVal a As Long, ByVal b As Long) As Long
Return a + b
End Function
End Class

在别的工程里引用,实例化一个对象,引用非常好用。

但是放到System32下面用regsvr32.exe注册,就报错。
就提示"无法在 DLL“test.dll”中找到名为“test”的入口点。"
请问这个test.dll应该怎么写?
怎么添加入口dllregisterserver?
先谢谢!
...全文
272 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
解释多余的 2010-01-19
  • 打赏
  • 举报
回复
mark
wohaorende 2010-01-19
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 wuyq11 的回复:]
[DllImport("trest.dll ", EntryPoint = "")]

[/Quote]
您帮助看看我哪里写错?
System32下面的DLL是这样写的
Public Class test

Public Function test1(ByVal a As Long, ByVal b As Long) As Long
Return a + b
End Function
End Class


调用DLL的窗体是这样写的
Public Class Form1
Public Declare Function test Lib "test.dll" (ByVal x, ByVal y) As Integer

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
MsgBox(test(3, 5))
End Sub
End Class

一运行就报错,说“无法在 DLL“test.dll”中找到名为“test”的入口点。”
您给的语句我也不知道放在函数的那个地方。
还有,为什么有些DLL放在System32下?
wuyq11 2010-01-17
  • 打赏
  • 举报
回复
[DllImport("trest.dll ", EntryPoint = "")]
wild_wolf99 2010-01-17
  • 打赏
  • 举报
回复
public declare function 函数名 "xxx.dll"(参数) 类型
调用C/C++封装的DLL函数用的,现在的卡表系统,包括售电售水系统都是这样来做的,封装了读卡器函数,和一些加密算法(3DES等),层层封装。

16,721

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧