那个帖子删掉了,也许是我误会了,我来这里做这个小版主,水平一般化,只不过比其他人稍微好点而已.
就目前来说,在我有限的时间里,能为大家解决一些常见的计算机问题,还是有这个能力的.
既然你我都热衷于计算机.我希望我们能更好的交流.过去的误会就让他过去吧.毕竟网络只是生活的调味品.
你热衷于计算机,且有能力.我把这段源代码送给你.希望能共同学习和提高自己.
.386
.model flat, stdcall ;32 bit memory model
option casemap :none ;case sensitive
include captest.inc
include avicap32.inc
includelib avicap32.lib
.code
m2m MACRO M1, M2
push M2
pop M1
ENDM
start:
invoke GetModuleHandle,NULL
mov hInstance,eax
invoke InitCommonControls
invoke DialogBoxParam,hInstance,IDD_DIALOG1,NULL,addr DlgProc,NULL
invoke ExitProcess,0
;########################################################################
DlgProc proc hWin:HWND,uMsg:UINT,wParam:WPARAM,lParam: LPARAM ;LPARAM 前的空格去掉
LOCAL hmenu
LOCAL rec:RECT
mov eax,uMsg
.if eax==WM_INITDIALOG
.elseif eax==WM_SIZE
invoke GetClientRect,hWin,addr rec
invoke MoveWindow,hWndC,rec.left,rec.top,rec.right,rec.bottom,TRUE
.elseif eax==WM_COMMAND
.if wParam==10002
invoke GetMenu,hWin
mov hmenu,eax
invoke EnableMenuItem,hmenu,10005,MF_ENABLED
invoke EnableMenuItem,hmenu,10006,MF_ENABLED
invoke EnableMenuItem,hmenu,10003,MF_ENABLED
invoke EnableMenuItem,hmenu,10004,MF_ENABLED
invoke GetClientRect,hWin,addr rec
invoke capCreateCaptureWindowA,0,WS_CHILD or WS_VISIBLE,rec.left,rec.top,rec.right,rec.bottom,hWin,0
mov hWndC,eax
invoke SendMessage,hWndC, WM_CAP_SET_CALLBACK_VIDEOSTREAM, 0, 0
invoke SendMessage,hWndC, WM_CAP_SET_CALLBACK_ERROR, 0, 0
invoke SendMessage,hWndC, WM_CAP_SET_CALLBACK_STATUSA, 0, 0
invoke SendMessage,hWndC, WM_CAP_DRIVER_CONNECT, 0, 0
invoke SendMessage,hWndC, WM_CAP_SET_SCALE, 1, 0
invoke SendMessage,hWndC, WM_CAP_SET_PREVIEWRATE, 66, 0
invoke SendMessage,hWndC, WM_CAP_SET_OVERLAY, 1, 0
invoke SendMessage,hWndC, WM_CAP_SET_PREVIEW, 1, 0
.elseif wParam==10004
invoke SendMessage,hWndC,WM_CAP_STOP, 0, 0
invoke DestroyWindow,hWndC
mov hWndC,0
invoke GetMenu,hWin
mov hmenu,eax
invoke EnableMenuItem,hmenu,10003,MF_GRAYED
invoke EnableMenuItem,hmenu,10004,MF_GRAYED
invoke EnableMenuItem,hmenu,10005,MF_GRAYED
invoke EnableMenuItem,hmenu,10006,MF_GRAYED
invoke EnableMenuItem,hmenu,10007,MF_GRAYED
;invoke EnableMenuItem,hmenu,10007,MF_GRAYED
.elseif wParam==10003
mov save.lStructSize,sizeof save
m2m save.hwndOwner,hWin
m2m save.hInstance,hInstance
m2m save.Flags,OFN_EXPLORER
m2m save.lpstrFilter,offset Filter
m2m save.lpstrFile,offset buff
m2m save.nMaxFile,256
mov save.lpstrDefExt,offset szDefExt
mov save.lpstrTitle,offset szSaveCaption
invoke GetSaveFileName,addr save
invoke SendMessage,hWndC,WM_CAP_SAVEDIB,0,offset buff
.elseif wParam==10006
invoke GetMenu,hWin
mov hmenu,eax
invoke EnableMenuItem,hmenu,10007,MF_ENABLED
mov save.lStructSize,sizeof save
m2m save.hwndOwner,hWin
m2m save.hInstance,hInstance
m2m save.Flags,OFN_EXPLORER
m2m save.lpstrFilter,offset Filter2
m2m save.lpstrFile,offset buff
m2m save.nMaxFile,256
mov save.lpstrDefExt,offset szDefExt2
mov save.lpstrTitle,offset szSaveCaption
invoke GetSaveFileName,addr save
invoke SendMessage,hWndC,WM_CAP_FILE_SET_CAPTURE_FILEA,0,offset buff
invoke SendMessage,hWndC, WM_CAP_SEQUENCE, 0, 0
.elseif wParam==10007
invoke SendMessage,hWndC,WM_CAP_STOP,0,offset buff
invoke GetMenu,hWin
mov hmenu,eax
invoke EnableMenuItem,hmenu,10003,MF_GRAYED
;invoke EnableMenuItem,hmenu,10004,MF_GRAYED
invoke EnableMenuItem,hmenu,10005,MF_GRAYED
invoke EnableMenuItem,hmenu,10006,MF_GRAYED
invoke EnableMenuItem,hmenu,10007,MF_GRAYED
.endif
.elseif eax==WM_CLOSE
invoke EndDialog,hWin,0
.else
mov eax,FALSE
ret
.endif
mov eax,TRUE
ret
DlgProc endp
[ 本帖最后由 忆年华 于 2008-6-21 00:47 编辑 ] |