我需要通过代码执行与 WindowsKey + M 相同的任务,即。最小化所有打开的窗口。这必须通过 Win32 API 而不是 .Net 来完成。
我在 FreeBasic 中尝试了以下操作,但没有任何反应:
Dim hWndConsole As HWND
'Shell_TrayWnd = class name of taskbar
Dim WindowName as String = "Shell_TrayWnd"
hWndConsole = FindWindow(0, strptr(WindowName))
ShowWindow(hWndConsole, SW_MINIMIZE) 'outta my sight
有人知道该怎么做吗?
谢谢你。
编辑:这是工作解决方案:
#include "Windows.bi"
Dim hWndConsole As HWND
'Shell_TrayWnd = class name of taskbar
Dim WindowName as String = "Shell_TrayWnd"
Dim res as LRESULT
CONST minall = 419
hWndConsole = FindWindow( "Shell_TrayWnd",null)
res = postMessage(hWndConsole, WM_COMMAND, minall, null )