這是我的代碼,看不出來錯誤,但執行時攝像頭沒反應,跟蹤看了視窗句柄ul_llt和回傳值變數都非空,請高手看看指點,急!
//global var:
uint lhand
constant long WM_USER=1024
constant long WM_CAP_START = WM_USER
constant long WM_CAP_STOP = WM_CAP_START + 68
constant long WM_CAP_DRIVER_CONNECT = WM_CAP_START + 10
constant long WM_CAP_DRIVER_DISCONNECT = WM_CAP_START + 11
constant long WM_CAP_SAVEDIB = WM_CAP_START + 25
constant long WM_CAP_GRAB_FRAME = WM_CAP_START + 60
constant long WM_CAP_SEQUENCE = WM_CAP_START + 62
constant long WM_CAP_FILE_SET_CAPTURE_FILEA = WM_CAP_START + 20
constant long WM_CAP_SEQUENCE_NOFILE =WM_CAP_START+ 63
constant long WM_CAP_SET_OVERLAY =WM_CAP_START+ 51
constant long WM_CAP_SET_PREVIEW =WM_CAP_START+ 50
constant long WM_CAP_SET_CALLBACK_VIDEOSTREAM = WM_CAP_START +6
constant long WM_CAP_SET_CALLBACK_ERROR=WM_CAP_START +2
constant long WM_CAP_SET_CALLBACK_STATUSA= WM_CAP_START +3
constant long WM_CAP_SET_CALLBACK_FRAME= WM_CAP_START +5
constant long WM_CAP_SET_SCALE=WM_CAP_START+ 53
constant long WM_CAP_SET_PREVIEWRATE=WM_CAP_START+ 52
//global external function
public function ulong capCreateCaptureWindowA(string lpszWindowName,ulong dwStyle,long x,long y,long nWidth,long nHeight,ulong ParentWin,long nId) library "AVICAP32.DLL";
//w_video中的cb_start
string lpszName
ulong ul_ll
ul_ll=handle(w_video)
lpszName='照片采集'
lhand= capCreateCaptureWindowA(lpszName,262144+12582912+1073741824+268435456,0,0,200,200,ul_ll,0)
if lhand<> 0 then
Send(lhand, WM_CAP_SET_CALLBACK_VIDEOSTREAM,0,0);
Send(lhand, WM_CAP_SET_CALLBACK_ERROR, 0,0);
Send(lhand, WM_CAP_SET_CALLBACK_STATUSA, 0,0);
Send(lhand, WM_CAP_DRIVER_CONNECT, 0,0);
Send(lhand, WM_CAP_SET_SCALE,1,0);
Send(lhand, WM_CAP_SET_PREVIEWRATE, 66, 0);
Send(lhand, WM_CAP_SET_OVERLAY, 1, 0);
Send(lhand, WM_CAP_SET_PREVIEW, 1, 0);
end if
uj5u.com熱心網友回復:
把這句public function ulong capCreateCaptureWindowA(string lpszWindowName,ulong dwStyle,long x,long y,long nWidth,long nHeight,ulong ParentWin,long nId) library "AVICAP32.DLL";
改為
public function ulong capCreateCaptureWindowA(string lpszWindowName,ulong dwStyle,long x,long y,long nWidth,long nHeight,ulong ParentWin,long nId) library "AVICAP32.DLL" alias for "capCreateCaptureWindowA;Ansi";
然后再試試
uj5u.com熱心網友回復:
謝謝了,以前我以遇到過別名的問題,謝謝你 的提醒。我再試試uj5u.com熱心網友回復:
還是不行,真急呀uj5u.com熱心網友回復:
呼叫解決了,但保存為影像卻沒反應,真急人!//cb_save
string s
s="e:\save.bmp"
if lhand<>0 then
Send(lhand,WM_CAP_SAVEDIB,0,s)
end if
還要請高手指點也
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/97902.html
標籤:API 調用
上一篇:pb 中連接access出錯
下一篇:請幫忙看哈,哪里出來問題?
