再发一个摄像头显示ocx控件, 比较老问题比较多,不建议用
By
admin
at 2022-01-22 • 0人收藏 • 547人看过
这个是09年的控件 , 我说的不好用主要是以下几点:
没有自适应大小功能, 拖动界面变大后, 摄像头画面大小并不会改变
打开摄像头只能按照指定名称来, 这样如果电脑里有大于2个同名称一样型号的摄像头,其他摄像头就别想打开了, 只能打开第一个....
主要是我测试过了, 那么就算了,分享出来吧..... 要用摄像头请找别的帖子里的用...
import win.ui; /*DSG{{*/ mainForm = win.form(text="aardio工程2";right=498;bottom=509) mainForm.add( audioList={cls="combobox";left=177;top=472;right=340;bottom=498;db=1;dl=1;dr=1;edge=1;items={};mode="dropdown";z=4}; button={cls="button";text="<--打开此摄像头";left=350;top=472;right=492;bottom=498;db=1;dr=1;z=2}; picturebox={cls="picturebox";left=0;top=0;right=499;bottom=466;bgcolor=8421376;db=1;dl=1;dr=1;dt=1;z=1}; videoList={cls="combobox";left=7;top=472;right=162;bottom=498;db=1;dl=1;edge=1;items={};mode="dropdown";z=3} ) /*}}*/ import console console.open() import fsys; import com.activeX; try{ com.CreateObject("{D0F69A92-6534-40AA-A9C7-C5C3DC15CCCD}"); } catch(e){ if(!io.exist(fsys.appdata("\com\VideoCapture.lic"))) { string.save(fsys.appdata("\com\VideoCapture.lic"),$"\res\VideoCapture.lic"); } if(!io.exist(fsys.appdata("\com\VideoCapture.ocx"))) { string.save(fsys.appdata("\com\VideoCapture.ocx"),$"\res\VideoCapture.ocx"); } com.activeX.regsvr32(fsys.appdata("\com\VideoCapture.ocx")); } var video = mainForm.picturebox.createEmbedEx("{D0F69A92-6534-40AA-A9C7-C5C3DC15CCCD}",,{ Click = function(){ video._object.Click(); }; DblClick = function(){ video._object.DblClick(); }; MouseDown = function(){ video._object.MouseDown(); }; MouseMove = function(){ video._object.MouseMove(); }; MouseUp = function(){ video._object.MouseUp(); }; }); //音频 for(i=1;video.GetAudioDevicesCount( );1){ mainForm.audioList.add(video.GetAudioDevicesName(i)); } //视频 for(i=1;video.GetVideoDevicesCount( );1){ mainForm.videoList.add(video.GetVideoDevicesName(i)); } //事件 video.Click = function(){ console.log("Click") } video.DblClick = function(){ console.log("DblClick") } video.MouseDown = function(){ console.log("MouseDown") } //video.MouseMove = function(){ // console.log("MouseMove") //} video.MouseUp = function(){ console.log("MouseUp") } //打开 mainForm.button.oncommand = function(id,event){ video.SetAudioDevicesName(mainForm.audioList.text); video.SetVideoDevicesName(mainForm.videoList.text); } mainForm.show(); return win.loopMessage();
登录后方可回帖