调用后输出直接为1,但是中间的创建窗口,连接设备等的语句都没有运行。程序如下:
HANDLE ghInstance; // application instance
HWND hwndMain; // main window handle
HWND hwndSelCapDrvDlg; // Select the capture driver dialog
CAPDRIVERCAPS CapDrvCaps; // driver capabilitiesBOOL _stdcall DllMain( HINSTANCE histDLL,
DWORD fdwReason,
LPVOID lpReserved
)
{
return TRUE;
}
long int _declspec(dllexport) CaptureBMP()
{
hwndMain = capCreateCaptureWindow(
"Super Video",
WS_CHILD|WS_VISIBLE,
0,
0,
320,
240,
NULL,
1
);
int sel = 0;
SendMessage( hwndMain, WM_CAP_DRIVER_CONNECT, sel, 0L);
char name[100];
strcpy(name,"Bpic");
strcat(name,".bmp");
capFileSaveDIB(hwndMain, name);
SendMessage(hwndMain,WM_SYSCOMMAND,SC_CLOSE,0);
return 1;}
HANDLE ghInstance; // application instance
HWND hwndMain; // main window handle
HWND hwndSelCapDrvDlg; // Select the capture driver dialog
CAPDRIVERCAPS CapDrvCaps; // driver capabilitiesBOOL _stdcall DllMain( HINSTANCE histDLL,
DWORD fdwReason,
LPVOID lpReserved
)
{
return TRUE;
}
long int _declspec(dllexport) CaptureBMP()
{
hwndMain = capCreateCaptureWindow(
"Super Video",
WS_CHILD|WS_VISIBLE,
0,
0,
320,
240,
NULL,
1
);
int sel = 0;
SendMessage( hwndMain, WM_CAP_DRIVER_CONNECT, sel, 0L);
char name[100];
strcpy(name,"Bpic");
strcat(name,".bmp");
capFileSaveDIB(hwndMain, name);
SendMessage(hwndMain,WM_SYSCOMMAND,SC_CLOSE,0);
return 1;}
BOOL _stdcall DllMain( HINSTANCE histDLL,
DWORD fdwReason,
LPVOID lpReserved
)
在capCreateCaptureWindow函数后面用GetLastError()看看有没错误