📄 vfw.ef
字号:
import efapi;
公开 类 vfw
{ /*
公开 初始化()
{
}*/
//----------------------------------------------
//本类库由halflifezy完成,转载请保留原作者名,谢谢|
//-----------------------------------------------
public static int WS_CHILD=0x40000000;
public static int WS_VISIBLE=0x10000000;
//private static int WM_USER=0x0400;
//private static int WM_CAP_DRIVER_CONNEC=WM_USER+10;
private static int WM_CAP_DRIVER_DISCONNECT=0x400+11;
private static int WM_CAP_SET_SCALE=0x0400+53;
private static int WM_CAP_SET_PREVIEWRATE=0x0400+52;
private static int WM_CAP_SET_PREVIEW=0x0400+50;
private static int WM_CAP_FILE_SAVEDIB=0x0400+100+25;
private static DestroyWindow(int hWnd)
{ int dllhandle=efapi.装载DLL("user32.dll");
int procaddr=efapi.取API地址(dllhandle,"DestroyWindow");
efapi.调用(procaddr,hWnd);
efapi.卸载DLL(dllhandle);
}
private static int SendMessageW(int hWnd,int Msg,int wParam,int lParam)
{ int dllhandle=efapi.装载DLL("user32.dll");
int procaddr=efapi.取API地址(dllhandle,"SendMessageW");
int result=efapi.调用(procaddr,hWnd,Msg, wParam,lParam);
efapi.卸载DLL(dllhandle);
return result;
}
private static int capCreateCaptureWindowW( string WindowName,int dwStyle,int x,int y,int nWidth,int nHeight,int hWnd,int nID)
{
int WindowNameAddr=efapi.取文本地址(WindowName);
int dllhandle=efapi.装载DLL("avicap32.dll");
int procaddr=efapi.取API地址(dllhandle,"capCreateCaptureWindowW");
int wnd;
wnd=efapi.调用(procaddr,WindowNameAddr,dwStyle,x,y,nWidth,nHeight,hWnd,nID);
//efapi.卸载DLL(dllhandle); //该函数无法使用这句,不然出错
return wnd;
}
public static int 创建采集窗口(string 窗口名字,int 窗口风格,int x,int y,int nWidth,int nHeight,int 窗口句柄,int nID)
{ return capCreateCaptureWindowW( 窗口名字, 窗口风格, x, y, nWidth, nHeight, 窗口句柄, nID);
}
public static 连接设备(int 窗口句柄)
{ int WM_CAP_DRIVER_CONNECT=0x0400+10; SendMessageW(窗口句柄,WM_CAP_DRIVER_CONNECT,0,0);
}
public static 设置缩放允许(int 窗口句柄)
{
SendMessageW(窗口句柄,WM_CAP_SET_SCALE,1,0);
}
public static 预览(int 窗口句柄)
{ SendMessageW(窗口句柄,WM_CAP_SET_PREVIEWRATE, 66, 0);
SendMessageW(窗口句柄,WM_CAP_SET_PREVIEW,1, 0);
}
public static 照相(int 窗口句柄,string 文件名)
{ int straddr=efapi.取文本地址(文件名); SendMessageW(窗口句柄,WM_CAP_FILE_SAVEDIB,0,straddr);
}
public static 停止(int 窗口句柄)
{ SendMessageW(窗口句柄,WM_CAP_DRIVER_DISCONNECT,0,0);
}
public static 销毁采集窗口(int 窗口句柄)
{ //int wm_destroy=0x0002; //SendMessageW(窗口句柄,wm_destroy,0,0);
DestroyWindow(窗口句柄);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -