vb用sendmessage给其他程序赋值和取值问题
我这里想用vb做一个开票辅助软件,请问为什么我修改不了商品名称,也不能取得商品名称的值?PrivateDeclareFunctionFindWindowLib"user3...
我这里想用vb做一个开票辅助软件,请问为什么我修改不了商品名称,也不能取得商品名称的值?
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const WM_GETTEXT = &HD
Private Const EM_REPLACESEL = &HC2
Private Const BM_CLICK = &HF5
Private Sub Command1_Click()
QQHwnd = FindWindow("TInvListForm", "销货清单填开")
QQHwnd = FindWindowEx(QQHwnd, 0, "TRecordDisplayForm", vbNullString)
QQHwnd = FindWindowEx(QQHwnd, 0, "TPanel", vbNullString)
QQHwnd = FindWindowEx(QQHwnd, 0, "TStaticText", vbNullString)
MsgBox QQHwnd
MsgBox SendMessage(QQHwnd, EM_REPLACESEL, 0, ByVal "商品名称")
Dim lLen As Long
GetWinText = String(255, Chr(0))
lLen = SendMessage(QQHwnd, WM_GETTEXT, Len(GetWinText), ByVal GetWinText)
GetWinText = Left(GetWinText, lLen)
MsgBox GetWinText
End Sub
这里得到的值分别为132148,0和一个空值,
分剩下的不多了 展开
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const WM_GETTEXT = &HD
Private Const EM_REPLACESEL = &HC2
Private Const BM_CLICK = &HF5
Private Sub Command1_Click()
QQHwnd = FindWindow("TInvListForm", "销货清单填开")
QQHwnd = FindWindowEx(QQHwnd, 0, "TRecordDisplayForm", vbNullString)
QQHwnd = FindWindowEx(QQHwnd, 0, "TPanel", vbNullString)
QQHwnd = FindWindowEx(QQHwnd, 0, "TStaticText", vbNullString)
MsgBox QQHwnd
MsgBox SendMessage(QQHwnd, EM_REPLACESEL, 0, ByVal "商品名称")
Dim lLen As Long
GetWinText = String(255, Chr(0))
lLen = SendMessage(QQHwnd, WM_GETTEXT, Len(GetWinText), ByVal GetWinText)
GetWinText = Left(GetWinText, lLen)
MsgBox GetWinText
End Sub
这里得到的值分别为132148,0和一个空值,
分剩下的不多了 展开
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励10(财富值+成长值)+提问者悬赏10(财富值+成长值)
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询