BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved)
{
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
Public Type CAPWND
lpszWindowName As String
x As Long
y As Long
nWidth As Long
nHeight As Long
hWnd As Long
nID As Long
cpr As Long
cpf As Long
End Type
Public Type CAPHRGN
hrgn As Long
bRedraw As Long
End Type
Public Type POINTAPI
x As Long
y As Long
End Type
Public Declare Function VideocapWindow Lib "capVIDEO.dll" Alias "_VideocapWindow@12" (cWnd As CAPWND, cHrgn As CAPHRGN, ByVal pWindowName As String) As Long
Public Declare Function CloseVideocapWindow Lib "capVIDEO.dll" Alias "_CloseVideocapWindow@0" () As Long
Public Declare Function CreatePolygonRgn Lib "gdi32" (lpPoint As POINTAPI, ByVal nCount As Long, ByVal nPolyFillMode As Long) As Long
VB调用
Dim cWnd As CAPWND, cHrgn As CAPHRGN, cHandle As Long
Private Sub Form_Load()
Form1.ScaleMode = 3
With cWnd
.lpszWindowName = "capWindow"
.nWidth = 500
.nHeight = 400
.x = 50
.y = 50
.hWnd = Form1.hWnd
.nID = 1
.cpf = 1
.cpr = 33
End With
With cHrgn
.hrgn = 0
.bRedraw = 0
End With
cHandle = VideocapWindow(cWnd, cHrgn, Form1.Name)
StatusBar1.SimpleText = cHandle & "," & Form1.hWnd
End Sub
Private Sub Form_Unload(Cancel As Integer)
CloseVideocapWindow
End Sub