vb隐藏右下角图标(FindwindowEx) & 向已知句柄的窗口发送按键消息

右下角图标名称:abcdef 如何隐藏它的图标?? 向句柄为D hwd 的窗口发送按键“N”、空格、Alt+A

第1个回答  2019-10-08
.定义一个模块,
内容为:
Option
Explicit
Public
Declare
Function
GetNextWindow
Lib
"user32"
Alias
"GetWindow"
(ByVal
hwnd
As
Long,
ByVal
wFlag
As
Long)
As
Long
Public
Declare
Function
GetWindowText
Lib
"user32"
Alias
"GetWindowTextA"
(ByVal
hwnd
As
Long,
ByVal
lpString
As
String,
ByVal
cch
As
Long)
As
Long
Public
Declare
Function
FindWindowa
Lib
"user32"
Alias
"FindWindowA"
(ByVal
lpClassName
As
String,
ByVal
lpWindowName
As
String)
As
Long
Public
Declare
Function
GetForegroundWindow
Lib
"user32"
()
As
Long
2.
给窗口加一个按钮,
在按钮的click事件里写以下内容:
Option
Explicit
Private
Sub
Command1_Click()
Dim
hwnd
As
Long
hwnd
=
GetForegroundWindow
'
FindWindowa("Notepad",
"新建
文本文档.txt
-
记事本")
Dim
str1
As
String,
len1
As
Long
str1
=
Space(255)
'定义接收字串.
GetWindowText
hwnd,
str1,
1024
Do
While
hwnd
<>
0
hwnd
=
GetNextWindow(hwnd,
2)
'只有2才表示找下一个窗口
len1
=
GetWindowText(hwnd,
str1,
Len(str1))
If
(InStr(1,
str1,
"记事",
1)
>
0)
Then
MsgBox
"你要的窗口找到了,
它是:"
+
str1
Exit
Sub
'这一句看情况修改
End
If
Loop
MsgBox
"很遣憾,
没有你要找的窗口"
End
Sub
3.
测试,
一定会通过..

vb 隐藏已知句柄的窗口 & vb FindWindowEx的用法
Public 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 '以上两个申明放标准模块中。ShowWindow a,0 '0隐藏,5显示。hWindow = FindWindowEx(b, 0, "SHELLDLL_De...

vb 隐藏已知句柄的窗口 & vb FindWindowEx的用法
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 hWnd1 --- Long,在其中查找子的父窗口。如设为零,表示使用桌面窗口(通常说的顶级窗口都被认为是桌面的子窗口...

如何在VB中打开一个记事本窗口并获取窗口句柄,向其中发送富文本框中的...
WindowHandle = FindWindow(vbNullString, "无标题 - 记事本")If WindowHandle Then '如果获取句柄成功 ChildWindowHandle = FindWindowEx(WindowHandle, 0, "Edit", vbNullString)If ChildWindowHandle Then '如果成功获取子句柄 EnableWindow ChildWindowHandle, False '禁用子窗口 Else MsgBox "无法获取...

在VB中如何使用FindWindow或FindWindowEx函数查找某窗体句柄
Public Declare Function FindWindowa Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Public Declare Function GetForegroundWindow Lib "user32" () As Long 2. 给窗口加一个按钮, 在按钮的click事件里写以下内容:Option Explicit Private S...

VC 向后台窗口发送按键消息
你有检查到hClient的值么(即FindWindowEx的返回值)如果返回不成功的话你发的消息也无效了 另外:建议尝试使用SendMessage

...已知句柄窗体的控件的句柄,请老师用findwindowex和enumchildwindow举...
按钮1的代码(command1):Private Sub Command1_Click()Dim windows As Long ‘windows也是自定义的 windows = Getwindowsa(vbNullString, "QQ的窗口名。。不知道是什么,替换这个字符串") ‘赋值给windows If windows = 0 Then ’这里是判断找到木有 MsgBox "对不起,没有找到窗口句柄"Else MsgBox...

如何向另外一个进程的窗口里面的一个按钮发送点击消息
先用FindWindow函数找到程序句柄,再用findWindowEx扭句柄,然后调用sendmessage函数发送消息即可 Declare Function SendMessage Lib “user32" Alias “SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long SendMessage函数的hwnd参数为接收消息的...

如何向一个程序的某个一个按钮发送一个消息的例子用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,...

如何在VB中用PostMessage向指定窗口发送带有修饰键的组合键?
因为应用程序顶层窗口不一定就是接受按键的窗口(如“NotePad.exe”记事本程序,实际接受按键的窗口是Notepad主窗口下的Edit控件),可以通过ClassID或Caption来查找。假设目标窗口的句柄已取得(hwnd),然后要用PostMessage向该窗口发送按键消息,对于普通字符键,直接用WM_CHAR消息最简单,如下:PostMessage ...

VB 关闭 弹出窗口 通过类名获取句柄并关闭
给段代码你参考,通过查找窗口标题,然后再找按钮,模拟按钮单击事件。hWin = FindWindow(0, "退出确认")Sleep (100)PostMessage hWin, WM_LBUTTONDOWN, 0, 0 hButton = FindWindowEx(hWin, 0, "Button", 0)btnID = GetWindowLong(hButton, GWL_ID) '获取控件ID SendMessage hWin, WM_...

相似回答
大家正在搜