错误“尝试读取或写入受保护的内存。这通常指示其他内存已损坏”
做的是软件二次开发,提供的DLL文件本来是供C++二次开发用的,但我使用的编程软件是vb.net
dll文件函数手册(供C++使用的):
typedef struct
{
LONG cfHeight; //字符高度
LONG cfWidth; //字符宽度
LONG cfWeight; //字符粗细
LONG cfSpacing; //字符间距
BOOL cfItalic; //斜体
BOOL cfUnderline;//下划线
BOOL cfStrikeOut;//删除线
BOOL bTransparent; //透明
COLORREFcfBkColor; //背景色
COLORREFcfTextColor;//前景色
TCHAR cfFaceName[32];//字体名
}OSDPARAM;
/设置视频捕获时间、日期叠加,在VCASetVidCapDateTimeOSDPARAM()函数设置后调用有效
BOOL WINAPI VCASetVidCapDateTimeOSD( DWORD dwCard, BOOL bEnableOSD, POINT& ptTopLeft);
//设置视频捕获字幕叠加
BOOL WINAPI VCASetVidCapDateTimeOSDParam( OSDPARAM* pOSDParm );
Public Structure OSDParam
Dim cfHeight As Long
Dim cfWidth As Long
Dim cfWeight As Long
Dim cfSpacing As Long
Dim cfItalic As Boolean
Dim cfUnderline As Boolean
Dim cfStrikeOut As Boolean
Dim bTransparent As Boolean
Dim cfBkColor As Color
Dim cfTextColor As Color
Dim cfFaceName() As Byte
End Structure
'设置视频时间、日期叠加参数
Declare Function VCASetVidCapDateTimeOSDParam Lib "Sa7134Capture.dll" _
(ByVal pOSDParam As OSDParam) As Boolean
'设置视频时间、日期叠加
Declare Function VCASetVidCapDateTimeOSD Lib "Sa7134Capture.dll" _
(ByVal dwCard As Long, ByVal bEnableOSD As Long, ByVal ptTopLeft As Point) As Boolean
Public OsdParameter As OSDParam
Public OsdTimepoint As Point
'设置录像osd参数(本sdk相关的osd参数只对录像osd生效,预览osd自己来创建)
OsdParameter.cfHeight = 15 ' //字符高度
OsdParameter.cfWidth = 12 ' //字符宽度
OsdParameter.cfWeight = 10 ' //字符粗细
OsdParameter.cfSpacing = 0 ' //字符间距
OsdParameter.cfItalic = False ' //斜体
OsdParameter.cfUnderline = False ' //下划线
OsdParameter.cfStrikeOut = False ' //删除线
OsdParameter.bTransparent = True
OsdParameter.cfBkColor = System.Drawing.Color.FromArgb(255, 255, 255) ' //背景色
OsdParameter.cfTextColor = System.Drawing.Color.FromArgb(0, 0, 0) ' //前景色
ReDim OsdParameter.cfFaceName(31)
OsdParameter.cfFaceName(0) = 0
OsdTimepoint.X = 10
OsdTimepoint.Y = 20
VCASetVidCapDateTimeOSDParam(OsdParameter)
VCASetVidCapDateTimeOSD(i, 1, OsdTimepoint)
[解决办法]
还有
Declare Function VCASetVidCapDateTimeOSDParam Lib "Sa7134Capture.dll" _
(ByVal pOSDParam As OSDParam) As Boolean