dll 动态调用
HINSTANCE hDllInst = LoadLibrary("averc727api.dll");
if( hDllInst)
{
//LONG WINAPI AVerCreateCaptureObject(DWORD dwDeviceIndex, HWND hWnd, HANDLE* CaptureObject)
typedef LONG (WINAPI *MYFUNC_Object)(DWORD, HWND, HANDLE);
MYFUNC_Object GetVideoSourceHwnd = NULL;
GetVideoSourceHwnd = (MYFUNC_Object)GetProcAddress(hDllInst,"AVerCreateCaptureObject");
if(GetVideoSourceHwnd &&(0==state))
{
state = GetVideoSourceHwnd(0, hd_std, &hdCapture_std);
}
if( GetVideoSourceHwnd &&(0==state))
{
state = GetVideoSourceHwnd(1, hd_tec, &hdCapture_tec);
}
//LONG WINAPI AVerSetVideoSource(HANDLE hCaptureObject, DWORD dwVideoSource)
typedef LONG (WINAPI *MYFUNC_Set)(HANDLE, DWORD);
MYFUNC_Set SetVideoSource = NULL;
SetVideoSource = (MYFUNC_Set)GetProcAddress(hDllInst,"AVerSetVideoSource");
if(SetVideoSource &&(0==state))
{
state = SetVideoSource(hdCapture_std, VIDEOSOURCE_SVIDEO);
}
if( SetVideoSource &&(0==state))
{
state = SetVideoSource(hdCapture_tec, VIDEOSOURCE_SVIDEO);
}
}
FreeLibrary(hDllInst);
编译没问题,但是功能实现不了。各位大侠帮我看看是不是dll的调用有什么问题。谢谢!