找回密码
 加入
搜索
楼主: yiruirui

[AU3基础] 关于GUI登陆新浪微薄,但是新浪微薄站的网页中没有表单,无法得到相应控件。(已解决)

 火.. [复制链接]
发表于 2010-7-20 23:30:53 | 显示全部楼层
我知道C++能写一个音乐播放器,但是我翻遍ANSI C++的文档也没见介绍啊?
 楼主| 发表于 2010-7-20 23:45:24 | 显示全部楼层
回复 16# thesnow

你说的方法是获取网页源码吗?然后用正则表达式?
http://www.autoitx.com/forum.php ... 85&highlight=IE  这个帖子吧?
发表于 2010-7-20 23:53:27 | 显示全部楼层
1.成功后应该出现个文本啥的.(已成功登录,退出什么的)(检测这个对象存不存在)
2.成功后应该有不同的文本,检测这个文本存不存在.
 楼主| 发表于 2010-7-21 10:18:10 | 显示全部楼层
回复 18# thesnow

难到方法就是读取网页原代码吗?从点击登陆之后的原代码中获取信息?
我刚测试了一下,http://pass.kingsoft.com/ksgweb/jsp/login/Register.jsp
在登陆前后的原代码就没有变的.你不想告诉我太多没关系,我只想知道服务器返回的那些信息(比如密码错误等)都放在什么地方?如果可以从网页中得到,请告诉哪个网页就OK.
发表于 2010-7-21 11:00:31 | 显示全部楼层
举个例子:
http://my.qq.com/
1.成功后应该出现个文本啥的.(已成功登录,退出什么的)(检测这个对象存不存在)
打开有个用户登录的按钮.
2.成功后应该有不同的文本,检测这个文本存不存在.
登录后有个"欢迎您XXX"的文本和一个退出按钮.

思路比实现重要.我给你写出代码,你没明白,等于没写.
发表于 2010-7-29 20:10:22 | 显示全部楼层
回复 1# yiruirui

拿去自己改吧,没有技术含量
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("登录新浪微博", 617, 516, 192, 124)
$Obj = _IECreateEmbedded()
$Obj_ctrl = GUICtrlCreateObj($Obj, 0, 0, 614, 476)
$Label1 = GUICtrlCreateLabel("用户名:", 6, 488, 43, 17)
$Input1 = GUICtrlCreateInput("", 50, 486, 121, 21)
$Label2 = GUICtrlCreateLabel("密码:", 178, 488, 31, 17)
$Input2 = GUICtrlCreateInput("", 210, 486, 121, 21)
$Button1 = GUICtrlCreateButton("登录", 346, 484, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1
                        _login(GUICtrlRead($Input1),GUICtrlRead($Input2))
        EndSwitch
WEnd

Func _login($name,$pass)
$oHTTP = ObjCreate("microsoft.xmlhttp")
$oHTTP.Open("post","http://login.sina.com.cn/sso/login.php?client=ssologin.js(v1.3.9)",false)
$oHTTP.setRequestHeader("Cache-Control", "no-cache")
$oHTTP.setRequestHeader("Content-Type","application/x-www-form-urlencoded")  
$oHTTP.setRequestHeader("Content-Length","298")
$oHTTP.Send("service=miniblog&client=ssologin.js(v1.3.9)&entry=miniblog&encoding=utf-8&gateway=1&savestate=0&from=&useticket=0&username="&$name&"&password="&$pass&"&url=http:\\t.sina.com.cn\ajaxlogin.php?framelogin=1&callback=parent.sinaSSOController.feedBackUrlCallBack&returntype=META")
$a = $oHTTP.responseText 
if StringInStr($a,"sina sso crossdomain") then 
_IENavigate($Obj, "http://t.sina.com.cn")
Else
        MsgBox(0,"","用户名或密码错误!")
EndIf
EndFunc
 楼主| 发表于 2010-7-31 00:52:58 | 显示全部楼层
回复 21# guland


    多谢斑竹!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-10-3 12:25 , Processed in 0.077186 second(s), 13 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表