快捷键

留下些什么 2004-09-02 01:03:23
能不能用某个快捷键调出已经压入系统托盘的窗体呢?
...全文
180 12 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
xanger 2004-09-02
  • 打赏
  • 举报
回复
:(
留下些什么 2004-09-02
  • 打赏
  • 举报
回复
谢谢了
orsharp 2004-09-02
  • 打赏
  • 举报
回复
呵呵 别搞得那么复杂, 上面贴的代码 可以实现呼出 压入托盘的程序(用户看到的),你在快捷键呼出中 加入 Show出窗口的代码不就行了,怎么会出来很多副本了?
留下些什么 2004-09-02
  • 打赏
  • 举报
回复
是调用本身没错,可调用一次就运行它的一个副本,要是调用多了,不是很烦吗?不止如何改进?
rainstormmaster 2004-09-02
  • 打赏
  • 举报
回复
//我要的是所要调出的程序已经运行了,而你的程序是启动还未运行的程序?

什么意思?难道你要调用的是其它的应用程序?如果是的话,请具体说明是什么程序?
留下些什么 2004-09-02
  • 打赏
  • 举报
回复
我要的是所要调出的程序已经运行了,而你的程序是启动还未运行的程序?
rainstormmaster 2004-09-02
  • 打赏
  • 举报
回复
上面的有乱码,我重贴一下:
Option Explicit

Private Const MOD_ALT = &H1
Private Const MOD_CONTROL = &H2
Private Const MOD_SHIFT = &H4
Private Const PM_REMOVE = &H1
Private Const WM_HOTKEY = &H312
Private Type POINTAPI
x As Long
y As Long
End Type
Private Type Msg
hWnd As Long
Message As Long
wParam As Long
lParam As Long
time As Long
pt As POINTAPI
End Type
Private Declare Function RegisterHotKey Lib "user32" (ByVal hWnd As Long, ByVal id As Long, ByVal fsModifiers As Long, ByVal vk As Long) As Long
Private Declare Function UnregisterHotKey Lib "user32" (ByVal hWnd As Long, ByVal id As Long) As Long
Private Declare Function PeekMessage Lib "user32" Alias "PeekMessageA" (lpMsg As Msg, ByVal hWnd As Long, ByVal wMsgFilterMin As Long, ByVal wMsgFilterMax As Long, ByVal wRemoveMsg As Long) As Long
Private Declare Function WaitMessage Lib "user32" () As Long
Private bCancel As Boolean
Private Sub ProcessMessages()
Dim Message As Msg
'loop until bCancel is set to True
Do While Not bCancel
'wait for a message
WaitMessage
'check if it's a HOTKEY-message
If PeekMessage(Message, Me.hWnd, WM_HOTKEY, WM_HOTKEY, PM_REMOVE) Then
'minimize the form
Shell "notepad", vbNormalFocus '换成你的代码
End If
DoEvents
Loop
End Sub

Private Sub Command1_Click()
Me.Caption = "test"
End Sub

Private Sub Form_Load()
Dim ret As Long
bCancel = False
ret = RegisterHotKey(Me.hWnd, &HBFFF&, MOD_CONTROL, vbKeyM) '注册ctrl-M为热键
Show
ProcessMessages
End Sub
Private Sub Form_Unload(Cancel As Integer)
bCancel = True
'unregister hotkey
Call UnregisterHotKey(Me.hWnd, &HBFFF&)
End Sub
rainstormmaster 2004-09-02
  • 打赏
  • 举报
回复
注册热键就可以了:
Option Explicit

Private Const MOD_ALT = &H1
Private Const MOD_CONTROL = &H2
Private Const MOD_SHIFT = &H4
Private Const PM_REMOVE = &H1
Private Const WM_HOTKEY = &H312
Private Type POINTAPI
x As Long
y As Long
End Type
Private Type Msg
hWnd As Long
Message As Long
wParam As Long
lParam As Long
time As Long
pt As POINTAPI
End Type
Private Declare Function RegisterHotKey Lib "user32" (ByVal hWnd As Long, ByVal id As Long, ByVal fsModifiers As Long, ByVal vk As Long) As Long
Private Declare Function UnregisterHotKey Lib "user32" (ByVal hWnd As Long, ByVal id As Long) As Long
Private Declare Function PeekMessage Lib "user32" Alias "PeekMessageA" (lpMsg As Msg, ByVal hWnd As Long, ByVal wMsgFilterMin As Long, ByVal wMsgFilterMax As Long, ByVal wRemoveMsg As Long) As Long
Private Declare Function WaitMessage Lib "user32" () As Long
Private bCancel As Boolean
Private Sub ProcessMessages()
Dim Message As Msg
'loop until bCancel is set to True
Do While Not bCancel
'wait for a message
WaitMessage
'check if it's a HOTKEY-message
If PeekMessage(Message, Me.hWnd, WM_HOTKEY, WM_HOTKEY, PM_REMOVE) Then
'minimize the form
Shell "notepad", vbNormalFocus '»»³ÉÄãµÄ´úÂë
End If
DoEvents
Loop
End Sub

Private Sub Command1_Click()
Me.Caption = "test"
End Sub

Private Sub Form_Load()
Dim ret As Long
bCancel = False
ret = RegisterHotKey(Me.hWnd, &HBFFF&, MOD_CONTROL, vbKeyM) '×¢²áctrl-MΪÈȼü
Show
ProcessMessages
End Sub
Private Sub Form_Unload(Cancel As Integer)
bCancel = True
'unregister hotkey
Call UnregisterHotKey(Me.hWnd, &HBFFF&)
End Sub
落伍者 2004-09-02
  • 打赏
  • 举报
回复
注册系统热键 api
RegisterHotKey
zyg0 2004-09-02
  • 打赏
  • 举报
回复
可以用菜单作,菜单不是支持快捷健吗
sssss342072 2004-09-02
  • 打赏
  • 举报
回复
还差几分4个内裤了接分
wwqna 2004-09-02
  • 打赏
  • 举报
回复
你要在VB中注册自己的热键,

7,785

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧