分类
请教!我如何在vb中使用这个dll中的函数
c++中函数定义如下:
HRESULT DSStream_SetVideoStandard(int iCardID, VideoStandard vs) 设置视频制式。
vs: 视频制式。
typedef enum
{
VideoStandard_None = 0x00000000,
VideoStandard_NTSC_M = 0x00000001,
VideoStandard_NTSC_M_J = 0x00000002,
VideoStandard_NTSC_433 = 0x00000004,
VideoStandard_PAL_B = 0x00000010,
VideoStandard_PAL_D = 0x00000020,
VideoStandard_PAL_H = 0x00000080,
VideoStandard_PAL_I = 0x00000100,
VideoStandard_PAL_M = 0x00000200,
VideoStandard_PAL_N = 0x00000400,
VideoStandard_PAL_60 = 0x00000800,
VideoStandard_SECAM_B = 0x00001000,
VideoStandard_SECAM_D = 0x00002000,
VideoStandard_SECAM_G = 0x00004000,
VideoStandard_SECAM_H = 0x00008000,
VideoStandard_SECAM_K = 0x00010000,
VideoStandard_SECAM_K1 = 0x00020000,
VideoStandard_SECAM_L = 0x00040000,
VideoStandard_SECAM_L1 = 0x00080000,
} VideoStandard;
我在vb中的使用:
Option Explicit
Private Declare Function DSStream_SetVideoStandard Lib "DSStream" (iCardID As Long, VS As Long)
Private Sub Command1_Click()
Dim i As Long, j As Long
i = 0
j = &H2
DSStream_SetVideoStandard ByVal i, ByVal j
End Sub
但是执行的时候出现:实时错误49 ,dll调用约定错误
请问在vb6.0中应该如何使用,谢谢!
大家帮帮我吧,新人多谢了!
Option Explicit
Private Declare Function DSStream_SetVideoStandard Lib "DSStream" (Byval iCardID As Long, ByVal VS As Long) as long
试试
这个也试过,不行,还是报错:dll调用约定错误
多谢了,请再帮我看看。
videostand这个用户自定义的类型在vb中该如何定义?我可以用long这个类型来代替吗?
参考:
[请教高手]DLL中的API函数调用问题?200分
http://community.csdn.net/Expert/topic/3520/3520075.xml?temp=7.641017E-03
可以用long这个类型来代替。
大概是你的DSStream_SetVideoStandard不是stdcall,vb6无法直接调用.可以先用VC写个DLL把DSStream_SetVideoStandard封装一下
你用VB还是VB.NET?
在VB和VB.NET中函数的参数传递写法是有区别的
VB用Function F(ByVal x As Integer, y As Integer) As Integer
VB.NET是Function F(ByVal x As Integer, ByRef y As Integer) As Integer
我用的是vb,
Rotaxe 请问如何在vc中重新封装?什么是stdcall?请赐教,多谢了
up
c里面函数的调用约定主要用stdcall和cdecl两种,msdn上写的比较清楚。
mk:@MSITStore:C:Program%20FilesMicrosoft%20Visual%20StudioMSDN9898VS2052vccore.chm::/html/_core___stdcall.htm
vb6无法指定调用约定。可以先用VC写个DLL
里面函数声明
HRESULT __stdcallmyDSStream_SetVideoStandard(int iCardID, VideoStandard vs)
{
调用DSStream_SetVideoStandard
}
up
帮顶
rotaxe 多谢了,这几天出差,回来晚了,见谅!
我回去试一下