本程序思路是通过定时截取屏幕图形,来作为被控端。源码如下所示 code: option explicitprivate type bitmap bmtype as long bmwidth as long bmheight as long bmwidthbytes as long bmplanes as integer bmbitspixel as integer bmbits as longend typeprivate declare function getobj lib \"gdi32\" alias \"getobjecta\" (byval hobject as long, byval ncount as long, lpobject as any) as longprivate declare function getdesktopwindow lib \"user32\" () as longprivate declare function getdc lib \"user32\" (byval hwnd as long) as longprivate declare function releasedc lib \"user32\" (byval hwnd as long, byval hdc as long) as longprivate declare function bitblt lib \"gdi32\" (byval hdestdc as long, byval x as long, byval y as long, byval nwidth as long, byval nheight as long, byval hsrcdc as long, byvalxsrc as long, byval ysrc as long, byval dwrop as long) as longprivate declare sub copymemory lib \"kernel32\" alias \"rtlmovememory\" (destination as any, source as any, byval length as long)private declare function getbitmapbits lib \"gdi32\" (byval hbitmap as long, byval dwcount as long, lpbits as any) as longprivate declare function setbitmapbits lib \"gdi32\" (byval hbitmap as long, byval dwcount as long, lpbits as any) as longprivate declare function createcompatiblebitmap lib \"gdi32\" (byval hdc as long, byval nwidth as long, byval nheight as long) as longprivate declare function createcompatibledc lib \"gdi32\" (byval hdc as long) as longprivate declare function selectobject lib \"gdi32\" (byval hdc as long, byval hobject as long) as longprivate declare function deletedc lib \"gdi32\" (byval hdc as long) as longprivate declare function deleteobject lib \"gdi32\" (byval hobject as long) as longprivate myhdc1 as long, mybmp1 as long, myoldbmp1 as long, scrw as long, scrh as longprivate startt as singleprivate sub form_load()dim bm as bitmap, bmpsize as longtimer1.enabled = false '间隔时间获取图形me.scalemode = 3scrw = screen.width \ screen.twipsperpixelxscrh = screen.height \ screen.twipsperpixely'这只是方便调试的示例,实用程序中,不用临时dc,可直接取窗体的bmp,会快一些myhdc1 = createcompatibledc(frmclient.hdc)mybmp1 = createcompatiblebitmap(frmclient.hdc, scrw, scrh)myoldbmp1 = selectobject(myhdc1, mybmp1)'ws2为winsock控件,用于发送数据 'ws2.remotehost = inputbox(\"请输入远程服务器ip地址\", \"远程监控测试\", \"127.0.0.1\")'ws2.remoteport = 2345'ws2.connecttimer1.interval = 10000timer1.enabled = trueend subprivate sub form_unload(cancel as integer)'ws2.closeselectobject myhdc1, myoldbmp1deleteobject mybmp1deletedc myhdc1end subprivate sub timer1_timer()dim i as long, d as long, b as long, bm as bitmap, dat() as byte, bmpsize as longstartt = timerd = getdesktopwindowi = getdc(d)bitblt myhdc1, 0, 0, scrw, scrh, i, 0, 0, vbsrccopyreleasedc d, igetobj mybmp1, len(bm), bmbmpsize = bm.bmwidthbytes * bm.bmheightredim dat(bmpsize - 1)getbitmapbits mybmp1, bmpsize, dat(0)redim preserve dat(bmpsize + 1)dat(bmpsize) = 13dat(bmpsize + 1) = 10'startt = timer'ws2.senddata datdebug.print dat 'dat为获取到的屏幕图形数据end subprivate sub ws2_close()statu *** ar1.simpletext = ws2.remotehost & \" disconnected..\"ws2.closeend subprivate sub ws2_connect()statu *** ar1.simpletext = ws2.remotehost & \" connected..\"end subprivate sub ws2_error(byval number as integer, description as string, byval scode as long, byval source as string, byval helpfile as string, byval helpcontext as long, canceldisplay as boolean)on error resume nextstatu *** ar1.simpletext = ws2.remotehost & \" error : \" & descriptionws2.closeend sub'============================================================='项目名称: server (远程屏幕监控端)'窗口名称: frmserver'winsock控件:ws1'statu *** ar控件:statu *** ar1 (注意:statu *** ar1.style = *** rsimple)'=============================================================option explicitprivate type bitmap bmtype as long bmwidth as long bmheight as long bmwidthbytes as long bmplanes as integer bmbitspixel as integer bmbits as longend typeprivate declare function getobj lib \"gdi32\" alias \"getobjecta\" (byval hobject as long, byval ncount as long, lpobject as any) as longprivate declare function getdesktopwindow lib \"user32\" () as longprivate declare function getdc lib \"user32\" (byval hwnd as long) as longprivate declare function releasedc lib \"user32\" (byval hwnd as long, byval hdc as long) as longprivate declare function bitblt lib \"gdi32\" (byval hdestdc as long, byval x as long, byval y as long, byval nwidth as long, byval nheight as long, byval hsrcdc as long, byvalxsrc as long, byval ysrc as long, byval dwrop as long) as longprivate declare sub copymemory lib \"kernel32\" alias \"rtlmovememory\" (destination as any, source as any, byval length as long)private declare function getbitmapbits lib \"gdi32\" (byval hbitmap as long, byval dwcount as long, lpbits as any) as longprivate declare function setbitmapbits lib \"gdi32\" (byval hbitmap as long, byval dwcount as long, lpbits as any) as longprivate declare function createcompatiblebitmap lib \"gdi32\" (byval hdc as long, byval nwidth as long, byval nheight as long) as longprivate declare function createcompatibledc lib \"gdi32\" (byval hdc as long) as longprivate declare function selectobject lib \"gdi32\" (byval hdc as long, byval hobject as long) as longprivate declare function deletedc lib \"gdi32\" (byval hdc as long) as longprivate declare function deleteobject lib \"gdi32\" (byval hobject as long) as longprivate scrw as long, scrh as longprivate myhdc as long, mybmp as long, myoldbmp as long, bmpdat() as byte, revbyte as longprivate startt as singleprivate sub form_load()dim bm as bitmap, bmpsize as longon error goto errloadme.scalemode = 3scrw = screen.width \ screen.twipsperpixelxscrh = screen.height \ screen.twipsperpixely'这只是方便调试的示例,实用程序中,不用临时dc,可直接取窗体的bmp,会快一些myhdc = createcompatibledc(frmserver.hdc)mybmp = createcompatiblebitmap(frmserver.hdc, scrw, scrh)myoldbmp = selectobject(myhdc, mybmp) getobj mybmp, len(bm), bmbmpsize = bm.bmwidthbytes * bm.bmheightredim bmpdat(bmpsize - 1)getbitmapbits mybmp, bmpsize, bmpdat(0)ws1.localport = 2345ws1.listenexit suberrload:msgbox errorend subsub getscreen()end subprivate sub form_unload(cancel as integer)on error resume nextws1.closeselectobject myhdc, myoldbmpdeleteobject mybmpdeletedc myhdcend subprivate sub ws1_close()statu *** ar1.simpletext = ws1.remotehostip & \" disconnected..\"ws1.closeif ws1.state = scklistening then ws1.closeelse ws1.localport = 2345 ws1.listenend ifend subprivate sub ws1_connectionrequest(byval requestid as long)if ws1.state <> sckclosed then ws1.closestatu *** ar1.simpletext = ws1.remotehostip & \" connecting..\"ws1.accept requestidif ws1.state = 7 then statu *** ar1.simpletext = ws1.remotehostip & \" connected..\"end subprivate sub ws1_dataarrival(byval bytestotal as long)dim dat() as byte, i as long, ntime as longon error resume nextws1.getdata dat, vbarray or vbbytei = instrb(1, dat, chrb(13) & chrb(10))if i > 0 then 'startt = timer if i > 1 then copymemory bmpdat(revbyte), dat(0), i - 1 setbitmapbits mybmp, ubound(bmpdat) + 1, bmpdat(0) revbyte = 0 '实用程序中,不用临时dc,下面一步可省 bitblt me.hdc, 0, 0, me.scalewidth, me.scaleheight, myhdc, 0, 0, vbsrccopy ntime = timer - val(me.
现在生活压力越来越大,工作也越来越难找,尤其是想找一个各方面都比较合适的更是难上加难,因此,很多人就选择在家创业,那么在家创业都干什么比较赚钱呢? 1.纯兼职 如果你甘于做一个收入稳定的小白领,不...
本文导读目录: 1、轰动的网络的黑客案有哪些? 2、黑客是什么? 3、著名的黑客事件都有哪些 4、世界上十大黑客事件 5、给我介绍一下世界各国的有名黑客事迹 6、世界黑客排名是怎样...
网络上有一批这样的人,专门租别人的微信账号站街、发广告、投票、刷公众号、互加好友等,通常情况下租一个微信号价格在20-40元一天不等,当然大多数得看你的微信质量,所以他们在租你账号之前会先试用一天或者...
零食,能够说成大家每一个人的必不可少了,无论老老少少,都喜爱在如今没事儿的情况下吃点零食解解乏,有时觉得吃了自身喜爱的零食以后,人生道路的满足感和成就感一瞬间提高了许多。不清楚大伙儿选购零食的情况下是...
伦敦地铁(伦敦地铁称明年通4G) 伦敦交通局19日透露,到2020年中期,伦敦地铁将覆盖4G网络。消息一出,立刻引起英国网友的讨论。 ▲伦敦地铁(Getty) 英国《每日电讯报》19日称,银...
王者荣耀S21赛季开始时间是很多玩家关注的重点,本次就为大家带来了王者荣耀S21赛季开始时间,告诉大家S21赛季什么时候开始,还不清楚的朋友可以参考,希望能帮到大家。 S21赛季开始时间 昨天王者...