vb函数声明,大神救命
OptionExplicitPrivateDeclareSubkeybd_eventLib"user32"(ByValbvkAsByte,_ByValbScanAsByt...
Option Explicit
Private Declare Sub keybd_event Lib "user32" (ByVal bvk As Byte, _
ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long 请问错哪里了
我是要做一个干涉光学仿真软件
我先大体说说我咋弄出错的:
先用matlab做出ganshe.m,输入相应的x y z 通过干涉函数就可以做出图像,单独在matlab是可以出图像的。
然后用matcom把 ganshe.m 转化出相应的.cls .bas .dll文件,然后用vb调用的时候就出现被拒了
他提示找不到dll入口点_ganshe_@20 in ganshe.dll
我的ganshe.cls为Option Private Module
Declare Function ganshe_v Lib "ganshe.dll" Alias "_ganshe_v@20" (ByVal emsg As String, ByVal nlhs As Long, ByRef plhs As Long, ByVal nrhs As Long, ByRef prhs As Long) As Long
这句是用matcom4.5转化的,不是我自己的写的,怀疑和这个有关系,补充下
函数声明如果没问题。我用matlab单独运行ganshe.m可以出图像,为什么最后变成用vb调用就提示没有找到dll入口点呢,具体问题如上 展开
Private Declare Sub keybd_event Lib "user32" (ByVal bvk As Byte, _
ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long 请问错哪里了
我是要做一个干涉光学仿真软件
我先大体说说我咋弄出错的:
先用matlab做出ganshe.m,输入相应的x y z 通过干涉函数就可以做出图像,单独在matlab是可以出图像的。
然后用matcom把 ganshe.m 转化出相应的.cls .bas .dll文件,然后用vb调用的时候就出现被拒了
他提示找不到dll入口点_ganshe_@20 in ganshe.dll
我的ganshe.cls为Option Private Module
Declare Function ganshe_v Lib "ganshe.dll" Alias "_ganshe_v@20" (ByVal emsg As String, ByVal nlhs As Long, ByRef plhs As Long, ByVal nrhs As Long, ByRef prhs As Long) As Long
这句是用matcom4.5转化的,不是我自己的写的,怀疑和这个有关系,补充下
函数声明如果没问题。我用matlab单独运行ganshe.m可以出图像,为什么最后变成用vb调用就提示没有找到dll入口点呢,具体问题如上 展开
1个回答
展开全部
三个API函数声明 均没问题 测试有效
Private Declare Sub keybd_event Lib "user32" (ByVal bvk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Sub Command1_Click()
MsgBox "Click"
End Sub
Private Sub Form_click()
Call keybd_event(vbKeyNumlock, 69, 0, 0) '小键盘指示灯
Call keybd_event(vbKeyNumlock, 69, &H2, 0)
End Sub
Private Sub Form_Load()
a = FindWindow(vbNullString, "Form1")
Debug.Print Me.hwnd, a
PostMessage Command1.hwnd, &HF5, 0, 0
End Sub
Private Declare Sub keybd_event Lib "user32" (ByVal bvk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Sub Command1_Click()
MsgBox "Click"
End Sub
Private Sub Form_click()
Call keybd_event(vbKeyNumlock, 69, 0, 0) '小键盘指示灯
Call keybd_event(vbKeyNumlock, 69, &H2, 0)
End Sub
Private Sub Form_Load()
a = FindWindow(vbNullString, "Form1")
Debug.Print Me.hwnd, a
PostMessage Command1.hwnd, &HF5, 0, 0
End Sub
追问
但是最后没有dll入口点啊 大哥帮我解决下啊,赶紧不禁,要多少分有多少分,虽然分数不能代表什么,但是我真的很急啊
追答
你说的是matlab做出来的DLL吧。。
你试试 工程--引用 将你的matlab DLL 引用进来
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询