如对这个进程进行以下操作
1.自动打开。我知道可以用process.start
2.将textbox1.text 写入 账号的框。textbox2.text 写入密码的编辑框
3.判断记住密码的复选框。如果没勾选。勾选。
4.点击 登陆 按钮。
这个登陆窗口。我放在http://pan.baidu.com/s/1sjpVCD3 了。您可以下载来分析下。要求使用.net 2.0 版本。。。
9 个解决方案
#1
新手学vb.net 。只为工作的效率可以提高 。。希望各位朋友帮帮忙
#2
加分求关注 。。。。百度了好几天没有合适的实例参考 。
#3
這個太簡單,一般簡單程序還是別設置密碼了!
#4
WinForm程序记住密码,这个最好用数据库操作,进行判断存取!!!
#5
1.获取相关控件的的句柄
2.设置值
参考函数:findwindowex sendmessage
2.设置值
参考函数:findwindowex sendmessage
#6
不就是写在From_Load里面么
#7
Const WM_GETTEXT = &HD '定义SendMessage WM_GETTEXT消息
Const WM_SETFOCUS = &H7 '定义SendMessage WM_SETFOCUS消息
Const WM_KILLFOCUS = &H8 '定义SendMessage WM_KILLFOCUS消息
Const WM_CLOSE = &H10 '定义SendMessage WM_CLOSE消息
Const WM_SYSCOMMAND = &H112 '定义SendMessage WM_SYSCOMMAND消息
Const SC_CLOSE = &HF060& '定义SendMessage SC_CLOSE消息
Const SC_MINIMIZE = &HF020& '定义SendMessage SC_MINIMIZE消息
'如下内容引入函数原始模型,此处采用Windows底层API函数进行控制
Private Declare Auto Function FindWindow Lib "user32" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer
Private Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Integer) As Integer
Public Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Integer, ByVal hWnd2 As Integer, ByVal lpsz1 As String, ByVal lpsz2 As String) As Integer
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Integer, ByVal lpString As String, ByVal cch As Integer) As Integer
Private Declare Function GetDlgItem Lib "user32" Alias "GetDlgItem" (ByVal hDlg As Integer, ByVal nIDDlgItem As Integer) As Integer
Private Declare Function GetDlgCtrlID Lib "user32" Alias "GetDlgItem" (ByVal hDlg2 As Integer) As Integer
Public Declare Function ShowWindow Lib "user32" (ByVal hwnd As Integer, ByVal nCmdShow As Integer) As Integer
Declare Auto Function SendMessage Lib "user32 " (ByVal hWnd As IntPtr, ByVal msg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As IntPtr
Public Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As String) As Integer
Declare Function GetKeyState Lib "user32" Alias "GetKeyState" (ByVal nVirtKey As Integer) As Integer
Declare Function GetAsyncKeyState Lib "user32" Alias "GetAsyncKeyState" (ByVal vKey As Integer) As Integer
Dim hWnd2 As Integer
Dim tWnd2 As Integer
Dim LineHandle As Integer
Dim WorkStationHandle As Integer
hWnd2 = FindWindow(vbNullString, "CFPT IDE - [ Execution Control - Standard Version ]") '捕捉Chroma主窗体
If hWnd2 > 0 Then
tWnd2 = FindWindowEx(hWnd2, 0, "MDIClient", vbNullString) '判断主窗体存在与否,存在,向下进行
If tWnd2 > 0 Then
tWnd2 = GetDlgItem(tWnd2, 65280) '捕捉第二层
If tWnd2 > 0 Then
tWnd2 = FindWindowEx(tWnd2, 0, "AfxMDIFrame42", vbNullString) '捕捉第三层
If tWnd2 > 0 Then
tWnd2 = FindWindowEx(tWnd2, 0, "#32770", vbNullString) '开始捕捉CHroma软体上面的文本框
LineHandle = GetDlgItem(tWnd2, 3009) '通过Control ID获取文本框-线别的具体句柄
WorkStationHandle = GetDlgItem(tWnd2, 3011) '通过Control ID获取文本框-站别的具体句柄
Dim LineHandleText As IntPtr = Marshal.AllocHGlobal(200) '创建数组存储线别内容
Dim WorkStationText As IntPtr = Marshal.AllocHGlobal(200) '创建数组存储站别内容
Dim NumText3 As Integer
Dim NumText4 As Integer
NumText3 = SendMessage(LineHandle, WM_GETTEXT, 200, LineHandleText) 'OK,搞定,从内存中开辟数组控件接收线别文本
NumText4 = SendMessage(WorkStationHandle, WM_GETTEXT, 200, WorkStationText) '同上,接收站别文本
Dim LineHandleTextFull As String = Marshal.PtrToStringUni(LineHandleText) '创建一个字符串变量,接收存在内存中的线别内容
Dim WorkStationTextFull As String = Marshal.PtrToStringUni(WorkStationText) '创建一个字符串变量,接收在内存中的站别内容
lblLineDisplay.Text = LineHandleTextFull '前台显示
lblWorkStationDisplay.Text = WorkStationTextFull '前台显示
End If
End If
End If
End If
End Sub
#8
可能还用到
EnumWindow , EnumChildWindow(?)
#9
您这个还是没有针对我程度来着。。虽然我从百度知道得到了相对应的分析方式。还是想请教下您。。
如果我用spy分析后。我想要的东西在 “窗格”下。。要如何处理呢
#1
新手学vb.net 。只为工作的效率可以提高 。。希望各位朋友帮帮忙
#2
加分求关注 。。。。百度了好几天没有合适的实例参考 。
#3
這個太簡單,一般簡單程序還是別設置密碼了!
#4
WinForm程序记住密码,这个最好用数据库操作,进行判断存取!!!
#5
1.获取相关控件的的句柄
2.设置值
参考函数:findwindowex sendmessage
2.设置值
参考函数:findwindowex sendmessage
#6
不就是写在From_Load里面么
#7
Const WM_GETTEXT = &HD '定义SendMessage WM_GETTEXT消息
Const WM_SETFOCUS = &H7 '定义SendMessage WM_SETFOCUS消息
Const WM_KILLFOCUS = &H8 '定义SendMessage WM_KILLFOCUS消息
Const WM_CLOSE = &H10 '定义SendMessage WM_CLOSE消息
Const WM_SYSCOMMAND = &H112 '定义SendMessage WM_SYSCOMMAND消息
Const SC_CLOSE = &HF060& '定义SendMessage SC_CLOSE消息
Const SC_MINIMIZE = &HF020& '定义SendMessage SC_MINIMIZE消息
'如下内容引入函数原始模型,此处采用Windows底层API函数进行控制
Private Declare Auto Function FindWindow Lib "user32" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer
Private Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Integer) As Integer
Public Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Integer, ByVal hWnd2 As Integer, ByVal lpsz1 As String, ByVal lpsz2 As String) As Integer
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Integer, ByVal lpString As String, ByVal cch As Integer) As Integer
Private Declare Function GetDlgItem Lib "user32" Alias "GetDlgItem" (ByVal hDlg As Integer, ByVal nIDDlgItem As Integer) As Integer
Private Declare Function GetDlgCtrlID Lib "user32" Alias "GetDlgItem" (ByVal hDlg2 As Integer) As Integer
Public Declare Function ShowWindow Lib "user32" (ByVal hwnd As Integer, ByVal nCmdShow As Integer) As Integer
Declare Auto Function SendMessage Lib "user32 " (ByVal hWnd As IntPtr, ByVal msg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As IntPtr
Public Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As String) As Integer
Declare Function GetKeyState Lib "user32" Alias "GetKeyState" (ByVal nVirtKey As Integer) As Integer
Declare Function GetAsyncKeyState Lib "user32" Alias "GetAsyncKeyState" (ByVal vKey As Integer) As Integer
Dim hWnd2 As Integer
Dim tWnd2 As Integer
Dim LineHandle As Integer
Dim WorkStationHandle As Integer
hWnd2 = FindWindow(vbNullString, "CFPT IDE - [ Execution Control - Standard Version ]") '捕捉Chroma主窗体
If hWnd2 > 0 Then
tWnd2 = FindWindowEx(hWnd2, 0, "MDIClient", vbNullString) '判断主窗体存在与否,存在,向下进行
If tWnd2 > 0 Then
tWnd2 = GetDlgItem(tWnd2, 65280) '捕捉第二层
If tWnd2 > 0 Then
tWnd2 = FindWindowEx(tWnd2, 0, "AfxMDIFrame42", vbNullString) '捕捉第三层
If tWnd2 > 0 Then
tWnd2 = FindWindowEx(tWnd2, 0, "#32770", vbNullString) '开始捕捉CHroma软体上面的文本框
LineHandle = GetDlgItem(tWnd2, 3009) '通过Control ID获取文本框-线别的具体句柄
WorkStationHandle = GetDlgItem(tWnd2, 3011) '通过Control ID获取文本框-站别的具体句柄
Dim LineHandleText As IntPtr = Marshal.AllocHGlobal(200) '创建数组存储线别内容
Dim WorkStationText As IntPtr = Marshal.AllocHGlobal(200) '创建数组存储站别内容
Dim NumText3 As Integer
Dim NumText4 As Integer
NumText3 = SendMessage(LineHandle, WM_GETTEXT, 200, LineHandleText) 'OK,搞定,从内存中开辟数组控件接收线别文本
NumText4 = SendMessage(WorkStationHandle, WM_GETTEXT, 200, WorkStationText) '同上,接收站别文本
Dim LineHandleTextFull As String = Marshal.PtrToStringUni(LineHandleText) '创建一个字符串变量,接收存在内存中的线别内容
Dim WorkStationTextFull As String = Marshal.PtrToStringUni(WorkStationText) '创建一个字符串变量,接收在内存中的站别内容
lblLineDisplay.Text = LineHandleTextFull '前台显示
lblWorkStationDisplay.Text = WorkStationTextFull '前台显示
End If
End If
End If
End If
End Sub
#8
可能还用到
EnumWindow , EnumChildWindow(?)
#9
您这个还是没有针对我程度来着。。虽然我从百度知道得到了相对应的分析方式。还是想请教下您。。
如果我用spy分析后。我想要的东西在 “窗格”下。。要如何处理呢