请帮我写一个,VB程序
当运行程序后,自动写入cookie值:
用户名:中国重庆
密码:chongqing
并打开一个网页,如:http://www.baidu.com
且网页处于全屏状态(没有标题栏、工具栏、按钮栏、地址栏等),即除了网页内容其它的都不要。谢谢各位!
当运行程序后,自动写入cookie值:
用户名:中国重庆
密码:chongqing
并打开一个网页,如:http://www.baidu.com
且网页处于全屏状态(没有标题栏、工具栏、按钮栏、地址栏等),即除了网页内容其它的都不要。谢谢各位!
直接运行VB所生成的exe文件,就打开网页
我就是这个意思,只要达到效果,也可以不写cookie 直接登陆数据库也行
用户名就用:中国北京
密码:beijing还有,登击后一定得全屏啊谢谢各位了,我对VB实在不熟悉,又需要这个功能
麻烦各位大侠
webbrowser.document.cookie="username:中国重庆;密码:chongqing"全屏使用api [DllImport("User32.dll")]
public static extern IntPtr FindWindowEx(IntPtr ph, IntPtr ch, String cn, String wn);
[DllImport("User32.dll")]
public static extern bool ShowWindow(IntPtr hWnd, long nCmdShow); IntPtr handle = FindWindowEx(IntPtr.Zero, IntPtr.Zero, "Shell_TrayWnd", null);c#代码 vb的自己找吧....
但是,这能打开如http://www.baidu.com 的页面吗?
慢慢研究了
但用VB实现全屏状态打开页面,好像不行啊?
求助啊...
inet发包,或者webbrowser好像也行.
全屏,你用webbrowser后按f11试试.记得可以直接全屏
WebBrowser1.Navigate "http://192.168.1.4/weblogin/login.asp"
End Sub
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Dim vDoc, vTag
Dim i As Integer Set vDoc = WebBrowser1.Document
If vDoc Is Nothing Then Exit Sub
For i = 0 To vDoc.All.length - 1
If UCase(vDoc.All(i).tagName) = "INPUT" Then ' 查找Object属性为Input的可输入项
Set vTag = vDoc.All(i)
If LCase(vTag.Type) = "text" Or LCase(vTag.Type) = "password" Then
Select Case LCase(vTag.Name)
Case "username" '如果是用户名的那个框
vTag.Value = "临江" '这个是用户名
Case "password"
vTag.Value = "123456" '这个是密码
End Select
With vDoc.All(i)
If UCase$(.tagName) = "INPUT" Then ' 查找Object属性为Input的可输入项
.Click '模拟鼠标单击
End If
End With
End If
End If
Next
End Sub
登陆按钮也可以用webbrowser控制document.getelementByid(按钮id).click()
已解决
现贴出来与大家分享一下成果吧:
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Const a& = -1
Private Const b& = &H1
Private Const c& = &H2Private Sub Form_Load()
WebBrowser1.Silent = True '禁止webbrowser控件打开网页出现“脚本错误”
'下面二句是form全屏
Me.WindowState = 0
Me.Move 0, 0, Screen.Width, Screen.Height
'WebBrowser1大小
SetWindowPos Me.hwnd, a, 0, 0, 0, 0, b Or c
Me.Left = Screen.Width / 2 - Me.Width / 2
Me.Top = Screen.Height / 2 - Me.Height / 2
WebBrowser1.Left = 0
WebBrowser1.Top = 0
WebBrowser1.Width = Me.Width
WebBrowser1.Height = Me.Height
'打开登陆页面
WebBrowser1.Navigate "http://192.168.1.4/weblogin/login.asp"
End Sub
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Dim vDoc, vTag
Dim i As Integer Set vDoc = WebBrowser1.Document
If vDoc Is Nothing Then Exit Sub
For i = 0 To vDoc.All.length - 1
If UCase(vDoc.All(i).tagName) = "INPUT" Then ' 查找Object属性为Input的可输入项
Set vTag = vDoc.All(i)
If LCase(vTag.Type) = "text" Or LCase(vTag.Type) = "password" Then
Select Case LCase(vTag.Name)
Case "username" '如果是用户名的那个框
vTag.Value = "临江" '这个是用户名
Case "password"
vTag.Value = "123456" '这个是密码
End Select
'自动登陆
If Not (WebBrowser1.Document Is Nothing) Then
If Not (WebBrowser1.Document.Body Is Nothing) Then
If Not (Me.WebBrowser1.Document.Body.All("send") Is Nothing) Then
Call Me.WebBrowser1.Document.Body.All("send").Click
End If
End If
End If
End If
End If
Next
End Sub
http://topic.csdn.net/u/20091123/09/6e31c696-e3ab-4cb9-8c2c-74f4a44fe1f8.html