VB中findwindowex函数的用法。。

PrivateSubCommand1_Click()   hWnd2=FindWindow(vbNullString,"计算器") ... Private Sub Command1_Click()    hWnd2 = FindWindow(vbNullString, "计算器")    MsgBox hWnd2, , "  。"    hwnd = FindWindowEx(vbNullString, hWnd2, "edit", vbNullString)    MsgBox hwnd, , "   "        End Sub我这样来。hwnd这句话就有问题。说什么函数或接口标记为限制或VB使用了不支持的自动类型 类型错应该不会,我定义过也是这样错的。 麻烦再附上之后给计算器的"edit"类用sendmessage函数发送一个字符串str1的代码 展开
 我来答
牛人影视
2011-11-28 · TA获得超过1395个赞
知道大有可为答主
回答量:1491
采纳率:0%
帮助的人:1613万
展开全部
用法错误:
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 Sub Command1_Click()
Dim hwnd2 As Long
hwnd2 = FindWindow(vbNullString, "计算器")
MsgBox hwnd2, , " 。"
hwnd2 = FindWindowEx(hwnd2, 0&, "edit", vbNullString)
MsgBox hWnd, , " "
End Sub
llp01
2011-11-28 · TA获得超过324个赞
知道小有建树答主
回答量:413
采纳率:0%
帮助的人:247万
展开全部
FindwindowEx的用法实例 2007-04-13 07:14:21| 分类: 01人生——程序人 | 标签: |字号大中小 订阅 .

'添加 Command1

Const WS_CHILD = &H40000000
Const WM_LBUTTONDOWN = &H201
Const WM_LBUTTONUP = &H202
Const SW_HIDE = 0
Const SW_NORMAL = 1
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
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 FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Private Declare Function CreateWindowEx Lib "user32" Alias "CreateWindowExA" (ByVal dwExStyle As Long, ByVal lpClassName As String, ByVal lpWindowName As String, ByVal dwStyle As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hWndParent As Long, ByVal hMenu As Long, ByVal hInstance As Long, lpParam As Any) As Long
Private Declare Function DestroyWindow Lib "user32" (ByVal hwnd As Long) As Long
Dim tWnd As Long, bWnd As Long, ncWnd As Long
Private Sub Form_Load()
Dim R As RECT
tWnd = FindWindow("Shell_TrayWnd", vbNullString)
bWnd = FindWindowEx(tWnd, ByVal 0&, "BUTTON", vbNullString)
GetWindowRect bWnd, R
ncWnd = CreateWindowEx(ByVal 0&, "BUTTON", "Hello!", WS_CHILD, 0, 0, R.Right - R.Left, R.Bottom - R.Top, tWnd, ByVal 0&, App.hInstance, ByVal 0&)
ShowWindow ncWnd, SW_NORMAL
ShowWindow bWnd, SW_HIDE
End Sub

Private Sub Form_Unload(Cancel As Integer)
ShowWindow bWnd, SW_NORMAL
DestroyWindow ncWnd
End
End Sub

Private Sub Command1_Click()
Unload Me
End Sub
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
tianlidon
2011-11-29 · TA获得超过1219个赞
知道小有建树答主
回答量:676
采纳率:85%
帮助的人:107万
展开全部
引用API函数声明了没有啊??
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 2条折叠回答
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式