vb findwindow用法,,,入门。
PrivateDeclareFunctionFindWindowLib"user32"Alias"FindWindowA"(ByVallpClassNameAsStrin...
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Sub Command1_Click()
k = FindWindow(0, "登陆")
If k = 0 Then
MsgBox " 未找到窗口", 48, "提示"
Else
MsgBox "找到窗口,请确认", 48, "提示"
End If
End Sub
为什么总是返回的是0,那个登陆程序是我自己做的。里面就加了一句me.caption="登陆"
为什么呢?麻烦解答。 展开
Private Sub Command1_Click()
k = FindWindow(0, "登陆")
If k = 0 Then
MsgBox " 未找到窗口", 48, "提示"
Else
MsgBox "找到窗口,请确认", 48, "提示"
End If
End Sub
为什么总是返回的是0,那个登陆程序是我自己做的。里面就加了一句me.caption="登陆"
为什么呢?麻烦解答。 展开
3个回答
2011-04-02
展开全部
k = FindWindow(vbNullString, "登陆")
=======================================
示例:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long
Private Sub Command1_Click()
Dim hw&
hw& = FindWindow(vbNullString, "计算器")
If hw Then SetWindowText hw, "这样不好吧!"
End Sub
=======================================
示例:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long
Private Sub Command1_Click()
Dim hw&
hw& = FindWindow(vbNullString, "计算器")
If hw Then SetWindowText hw, "这样不好吧!"
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
k = FindWindow(vbNullString, "登陆")
不能用0,要使用vbNullString
不能用0,要使用vbNullString
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
k = FindWindow(vbnollstring, "登陆")
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询