在pb中调用摄像关怎么没反应呀?急

sydzy_1972 2009-04-14 11:19:41
这是我的代码,看不出来错误,但执行时摄像头没反应,跟踪看了窗口句柄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
...全文
212 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
WorldMobile 2009-04-14
  • 打赏
  • 举报
回复
把这句
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";

然后再试试

sydzy_1972 2009-04-14
  • 打赏
  • 举报
回复
调用解决了,但保存为图像却没反应,真急人!
//cb_save
string s
s="e:\save.bmp"
if lhand<>0 then
Send(lhand,WM_CAP_SAVEDIB,0,s)
end if
还要请高手指点也
sydzy_1972 2009-04-14
  • 打赏
  • 举报
回复
还是不行,真急呀
sydzy_1972 2009-04-14
  • 打赏
  • 举报
回复
谢谢了,以前我以遇到过别名的问题,谢谢你 的提醒。我再试试

680

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder API 调用
社区管理员
  • API 调用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧