| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 5133 人关注过本帖
标题:求:vfp 如何在指定的网页输入密码、用户名并登录
只看楼主 加入收藏
wangjiayu45
Rank: 1
等 级:新手上路
帖 子:189
专家分:0
注 册:2010-4-23
收藏
得分:0 
回复 20楼 schtg
求代码!怎么实现的。谢谢
2018-11-17 13:41
yewxj
Rank: 3Rank: 3
等 级:论坛游侠
威 望:5
帖 子:157
专家分:153
注 册:2015-6-18
收藏
得分:0 
回复 21楼 wangjiayu45
用按键精灵
2018-11-21 21:03
zhangheyuan
Rank: 1
等 级:新手上路
帖 子:75
专家分:4
注 册:2018-5-23
收藏
得分:0 
我编写了单点登录系统,可以制动填写用户名密码:
oie = CreateObject("InternetExplorer.Application")
oie.Top=0
oie.Left=0
oie.Height=898
oie.Width=1430
oie.MenuBar=.t. &&窗口是否有菜单。
oie.StatusBar=.t.   &&显示IE对象 状态栏
oie.Navigate(b.url)  && "http://10.90.144.7"    "http://10.90.150.11:89"
oie.FullScreen=.F.   &&全屏显示
oie.ToolBar=.t.   &&显示IE对象工具栏
oie.Visible=.t.  && 窗口是否可见;
oie.AddressBar=.t.   &&显示IE对象 地址栏
oie.Resizable=.t.   &&设置IE对象 大小是否可以被改动

=SetForegroundWindow(oie.hWnd)  && IE10,不在此加此语句,在选择“系统界面”后面打开网页,IE6在前面打开。
zzz=""
do while oie.busy .or. oie.ReadyState#4  &&此法可行!
 zzz=zzz+transform(oie.ReadyState)
enddo
ChengGongDaKai=len(zzz)<25000 .or."33" $ zzz  &&成功打开
if ChengGongDaKai
Jv_Bing_str=Jv_bing_str+transform(xt_sb)+"_"+transform(oie.hWnd)+","
if !No_hum_mm
=sleep(2000+1000*delay)
=SetForegroundWindow(oie.hWnd)

if .not.zjsr
MOUSEEVENTF_LEFTDOWN=0x2
MOUSEEVENTF_LEFTUP=0x4
MOUSEEVENTF_MIDDLEDOWN=0x20
MOUSEEVENTF_MIDDLEUP=0x40
MOUSEEVENTF_MOVE=0x1
MOUSEEVENTF_ABSOLUTE=0x8000
MOUSEEVENTF_RIGHTDOWN=0x8
MOUSEEVENTF_RIGHTUP=0x10

Xmus=mus_x
Ymus=mus_y
*在鼠标坐标系统中,不管什么分辨率屏幕在水平和垂直方向上均匀分割成65535×65535个单元
=mouse_event(MOUSEEVENTF_ABSOLUTE+MOUSEEVENTF_MOVE,Xmus,Ymus,0,0) &&移动鼠标到绝对位置29800,29600
=mouse_event(MOUSEEVENTF_LEFTDOWN+MOUSEEVENTF_LEFTUP,0,0,0,0)  &&单击左键(按下再松开的组合)
=Sleep(100)
=mouse_event(MOUSEEVENTF_LEFTDOWN+MOUSEEVENTF_LEFTUP,0,0,0,0)  &&单击左键(按下再松开的组合)
*=mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0)
*=mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0)
*=Sleep(100)

do Tab_Enter_sr.prg with Q_Tab_s
endif

keybd_event(17, 0, 0, 0)  &&ctr 是 17 或 0X11(十六进制11)Shift键:16 TAB键:9。 模拟ctr_A A字母要大写,输出的是小写的。
keybd_event(Asc('A'), 0, 0, 0)
=Sleep(8)
keybd_event(Asc('A'), 0, 2, 0)
keybd_event(17, 0, 2, 0)
*for ii=1 to 20
*keybd_event(8, 0, 0, 0) && BackSpace退格键是:8
*=Sleep(8)
*keybd_event(8, 0, 2, 0)
*keybd_event(46, 0, 0, 0) && Delete 键是46
*=Sleep(8)
*keybd_event(46, 0, 2, 0)
*endfor
*_ClipText=alltrim(a.xt_hum)
*keybd_event(17, 0, 0, 0)  &&ctr 是 17 或 0X11(十六进制11)Shift键:16 TAB键:9。 模拟ctr_V。
*keybd_event(Asc('V'), 0, 0, 0)
*= Sleep(8)
*keybd_event(Asc('V'), 0, 2, 0)
*keybd_event(17, 0, 2, 0)
do hum_mm_sr with alltrim(a.xt_hum)
keybd_event(9, 0, 0, 0)
=Sleep (5)
keybd_event(9, 0, 2, 0)
keybd_event(17, 0, 0, 0)  &&ctr 是 17 或 0X11(十六进制11)Shift键:16 TAB键:9。 模拟ctr_A。
keybd_event(Asc('A'), 0, 0, 0)
=Sleep(8)
keybd_event(Asc('A'), 0, 2, 0)
keybd_event(17, 0, 2, 0)
*for ii=1 to 20
*keybd_event(8, 0, 0, 0) && BackSpace退格键是:8
*= Sleep(8)
*keybd_event(8, 0, 2, 0)
*keybd_event(46, 0, 0, 0) && Delete 键是46
*= Sleep(8)
*keybd_event(46, 0, 2, 0)
*endfor
*_ClipText=alltrim(a.xt_mm)
*keybd_event(17, 0, 0, 0)
*keybd_event(Asc('V'), 0, 0, 0)
*= Sleep(5)
*keybd_event(Asc('V'), 0, 2, 0)
*keybd_event(17, 0, 2, 0)
*_ClipText=""  &&往系统剪切板中放入字串,以便用Ctr+V复制。
do hum_mm_sr with alltrim(a.xt_mm)
do Tab_Enter_sr.prg with H_Tab_s
if yn_yzm
  keybd_event(9, 0, 0, 0)
  =Sleep(5)
  keybd_event(9, 0, 2, 0)
* =messagebox("请按确定之后,在验证码栏输入本系统的验证码!",0+48,"系统提示您:")
* wait windows "请在验证码栏输入本系统的验证码!" nowait
else
  keybd_event(13, 0, 0, 0)  &&最后的回车键Enter:13。
  =Sleep(5)
  keybd_event(13, 0, 2, 0)
endif
endif
else
 oie.quit()
 =messagebox("无法打开:“"+alltrim(b.xt_mc)+"”的服务网页!"+chr(13)+chr(13)+"请检查网络连接、或本系统的状态是否正常。",0+48,"系统提示您:") &&48 改为16 是错误提示!
endif
endif
else
 ShowWindow(JBNoClose_BXT,1)  &&此语句不能少!
 SetForegroundWindow(JBNoClose_BXT) &&激活窗口


hum_mm_sr.prg 代码如下:
parameters str_c
clear typeahead
do while len(str_c)>0
 str_c1=left(str_c,1)
 do case
 case str_c1 $ "abcdefghijklmnopqrstuvwxyz"
  keybd_event(Asc(upper(str_c1)), 0, 0, 0)
  =sleep(8)
  keybd_event(Asc(upper(str_c1)), 0, 2, 0)
 case str_c1 $ "0123456789"
  keybd_event(Asc(str_c1), 0, 0, 0)
  =sleep(8)
  keybd_event(Asc(str_c1), 0, 2, 0)
 case str_c1 $ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
  keybd_event(16, 0, 0, 0)
  keybd_event(Asc(str_c1), 0, 0, 0)
  =sleep(8)
  keybd_event(Asc(str_c1), 0, 2, 0)
  keybd_event(16, 0, 2, 0)
 case str_c1=" "
  keybd_event(32, 0, 0, 0)
  =sleep(8)
  keybd_event(32, 0, 2, 0)
 case str_c1="`"
  keybd_event(192, 0, 0, 0)
  =sleep(8)
  keybd_event(192, 0, 2, 0)
 case str_c1="-"
  keybd_event(189, 0, 0, 0)
  =sleep(8)
  keybd_event(189, 0, 2, 0)
 case str_c1="="
  keybd_event(187, 0, 0, 0)
  =sleep(8)
  keybd_event(187, 0, 2, 0)
 case str_c1="\"
  keybd_event(220, 0, 0, 0)
  =sleep(8)
  keybd_event(220, 0, 2, 0)
 case str_c1="["
  keybd_event(219, 0, 0, 0)
  =sleep(8)
  keybd_event(219, 0, 2, 0)
 case str_c1="]"
  keybd_event(221, 0, 0, 0)
  =sleep(8)
  keybd_event(221, 0, 2, 0)
 case str_c1=";"
  keybd_event(186, 0, 0, 0)
  =sleep(8)
  keybd_event(186, 0, 2, 0)
 case str_c1="'"
  keybd_event(222, 0, 0, 0)
  =sleep(8)
  keybd_event(222, 0, 2, 0)
 case str_c1=","
  keybd_event(188, 0, 0, 0)
  =sleep(8)
  keybd_event(188, 0, 2, 0)
 case str_c1="."
  keybd_event(190, 0, 0, 0)
  =sleep(8)
  keybd_event(190, 0, 2, 0)
 case str_c1="/"
  keybd_event(191, 0, 0, 0)
  =sleep(8)
  keybd_event(191, 0, 2, 0)
 case str_c1="~"
  keybd_event(16, 0, 0, 0)
  keybd_event(192, 0, 0, 0)
  =sleep(8)
  keybd_event(192, 0, 2, 0)
  keybd_event(16, 0, 2, 0)
 case str_c1="_"
  keybd_event(16, 0, 0, 0)
  keybd_event(189, 0, 0, 0)
  =sleep(8)
  keybd_event(189, 0, 2, 0)
  keybd_event(16, 0, 2, 0)
 case str_c1="+"
  keybd_event(16, 0, 0, 0)
  keybd_event(187, 0, 0, 0)
  =sleep(8)
  keybd_event(187, 0, 2, 0)
  keybd_event(16, 0, 2, 0)
 case str_c1="|"
  keybd_event(16, 0, 0, 0)
  keybd_event(220, 0, 0, 0)
  =sleep(8)
  keybd_event(220, 0, 2, 0)
  keybd_event(16, 0, 2, 0)
 case str_c1="{"
  keybd_event(16, 0, 0, 0)
  keybd_event(219, 0, 0, 0)
  =sleep(8)
  keybd_event(219, 0, 2, 0)
  keybd_event(16, 0, 2, 0)
 case str_c1="}"
  keybd_event(16, 0, 0, 0)
  keybd_event(221, 0, 0, 0)
  =sleep(8)
  keybd_event(221, 0, 2, 0)
  keybd_event(16, 0, 2, 0)
 case str_c1=":"
  keybd_event(16, 0, 0, 0)
  keybd_event(186, 0, 0, 0)
  =sleep(8)
  keybd_event(186, 0, 2, 0)
  keybd_event(16, 0, 2, 0)
 case str_c1='"'
  keybd_event(16, 0, 0, 0)
  keybd_event(222, 0, 0, 0)
  =sleep(8)
  keybd_event(222, 0, 2, 0)
  keybd_event(16, 0, 2, 0)
 case str_c1="<"
  keybd_event(16, 0, 0, 0)
  keybd_event(188, 0, 0, 0)
  =sleep(8)
  keybd_event(188, 0, 2, 0)
  keybd_event(16, 0, 2, 0)
 case str_c1=">"
  keybd_event(16, 0, 0, 0)
  keybd_event(190, 0, 0, 0)
  =sleep(8)
  keybd_event(190, 0, 2, 0)
  keybd_event(16, 0, 2, 0)
 case str_c1="?"
  keybd_event(16, 0, 0, 0)
  keybd_event(191, 0, 0, 0)
  =sleep(8)
  keybd_event(191, 0, 2, 0)
  keybd_event(16, 0, 2, 0)
 case str_c1="!"
  keybd_event(16, 0, 0, 0)
  keybd_event(49, 0, 0, 0)
  =sleep(8)
  keybd_event(49, 0, 2, 0)
  keybd_event(16, 0, 2, 0)
case str_c1="@"
  keybd_event(16, 0, 0, 0)
  keybd_event(50, 0, 0, 0)
  =sleep(8)
  keybd_event(50, 0, 2, 0)
  keybd_event(16, 0, 2, 0)
case str_c1="#"
  keybd_event(16, 0, 0, 0)
  keybd_event(51, 0, 0, 0)
  =sleep(8)
  keybd_event(51, 0, 2, 0)
  keybd_event(16, 0, 2, 0)
case str_c1="$"
  keybd_event(16, 0, 0, 0)
  keybd_event(52, 0, 0, 0)
  =sleep(8)
  keybd_event(52, 0, 2, 0)
  keybd_event(16, 0, 2, 0)
case str_c1="%"
  keybd_event(16, 0, 0, 0)
  keybd_event(53, 0, 0, 0)
  =sleep(8)
  keybd_event(53, 0, 2, 0)
  keybd_event(16, 0, 2, 0)
case str_c1="^"
  keybd_event(16, 0, 0, 0)
  keybd_event(54, 0, 0, 0)
  =sleep(8)
  keybd_event(54, 0, 2, 0)
  keybd_event(16, 0, 2, 0)
case str_c1="&"
  keybd_event(16, 0, 0, 0)
  keybd_event(55, 0, 0, 0)
  keybd_event(55, 0, 2, 0)
  keybd_event(16, 0, 2, 0)
case str_c1="*"
  keybd_event(16, 0, 0, 0)
  keybd_event(56, 0, 0, 0)
  =sleep(8)
  keybd_event(56, 0, 2, 0)
  keybd_event(16, 0, 2, 0)
case str_c1="("
  keybd_event(16, 0, 0, 0)
  keybd_event(57, 0, 0, 0)
  =sleep(8)
  keybd_event(57, 0, 2, 0)
  keybd_event(16, 0, 2, 0)
case str_c1=")"
  keybd_event(16, 0, 0, 0)
  keybd_event(48, 0, 0, 0)
  =sleep(8)
  keybd_event(48, 0, 2, 0)
  keybd_event(16, 0, 2, 0)
endcase
str_c=substr(str_c,2,50)
enddo
return


2018-11-26 19:30
zhangheyuan
Rank: 1
等 级:新手上路
帖 子:75
专家分:4
注 册:2018-5-23
收藏
得分:0 

Tab_Enter_sr.prg 代码如下:
parameters Cstr
Cstr=upper(alltrim(Cstr))
do while len(Cstr)>=2
 C1str=left(Cstr,1)  &&第一个字符:C1str,代表Tab、Shift+tab、Enter\。
 C2Num=val(substr(Cstr,2,1)) &&第二个字符:C2Num,代表击键次数。
 do Case
 Case C1str="T"
   for ii=1 to C2Num
     keybd_event(9, 0, 0, 0) &&ctr 是 17 或 0X11(十六进制11)Shift键:16, TAB键:9,回车键Enter:13。
     =Sleep(8)
     keybd_event(9, 0, 2, 0) &&Shift键:16, ALT键:18,大小写转换键Caps Lock:20。PageUP 33  PageDN 34
   endfor
 Case C1str="S"
   keybd_event(16, 0, 0, 0)
   for ii=1 to C2Num
     keybd_event(9, 0, 0, 0)
     =Sleep(8)
     keybd_event(9, 0, 2, 0)
   endfor
   keybd_event(16, 0, 2, 0)
 Case C1str="E"
   for ii=1 to C2Num
    keybd_event(13, 0, 0, 0)
    =Sleep(8)
    keybd_event(13, 0, 2, 0)
   endfor
 Case C1str="D"
   for ii=1 to C2Num
    keybd_event(34, 0, 0, 0)
    =Sleep(8)
    keybd_event(34, 0, 2, 0)
   endfor
 Case C1str="U"
   for ii=1 to C2Num
    keybd_event(33, 0, 0, 0)
    =Sleep(8)
    keybd_event(33, 0, 2, 0)
   endfor
 EndCase
 Cstr=Substr(Cstr,3,12)
Enddo
return
2018-11-26 19:31
zhangheyuan
Rank: 1
等 级:新手上路
帖 子:75
专家分:4
注 册:2018-5-23
收藏
得分:0 
在实践中, 高版本IE,好像不能用复制、粘贴来输入户名、密码的,所以采用了模拟键盘输入的方法。
但是采用汉字用户名、密码的只能用复制、粘贴来实现!
2018-11-26 19:34
快速回复:求:vfp 如何在指定的网页输入密码、用户名并登录
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.025063 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved