求助,大神帮忙看下有难度的VB回调,来自VC的dll
函数原型是:extern BOOL __stdcall voRegisterMrzCallback(voDataCallback Callback, LPVOID Parameter);这是回调给的vc源码是:
voRegisterMrzCallback(MRZDataCallback, this);
void WINAPI MRZDataCallback(LPVOID Parameter, VIDEOOCRMRZDATA *pData)
{
// convert the void parameter back into a this pointer
CMFCDemoDlg *pThis = (CMFCDemoDlg *)Parameter;
// now take the unicode string & convert back to be displayed
CString Display;
Display.Format("%ws", pData->RawMRZ);
// store the raw MRZ data in to the dialog class & force a display update
pThis->MRZ = Display;
if (pThis->hRFIDPicture)
{
DeleteObject(pThis->hRFIDPicture);
pThis->hRFIDPicture = NULL;
}
if (pThis->hBitmap)
{
DeleteObject(pThis->hBitmap);
pThis->hBitmap = NULL;
}
}
我自己写的是:
Private Type VIDEOOCRMRZDATA
RawMRZ As Long
DocumentNumber As String
DOB As String
Expiry As String
Issuer As String
Nationality As String
LastNames As String
FirstNames As String
Type1 As String
Discretionary1 As String
Discretionary2 As String
Gender As String
End Type
Public Declare Function voRegisterMrzCallback Lib "C:\Documents and Settings\Administrator\桌面\VB工程\OCR_test1\VideoOCR.dll" (ByRef lpCallback As Long, ByVal parameter As Any) As Long
call voRegisterMrzCallback(AddressOf Callback, parameter1)
Function Callback(ByVal parameter As String, pData As VIDEOOCRMRZDATA)
astr = pData.Nationality
MsgBox "callback"
Callback = 1
End Function
(其实我就想获取pData里的数据)求高手看看哪里有问题,已运行系统就崩溃,谢谢,我的积分不多,有的话全给了。
[ 本帖最后由 Crazyzhu 于 2013-7-27 09:15 编辑 ]