Jump to content
Tuts 4 You

How to minimize open windows?


LCF-AT

Recommended Posts

Hi,

just have a tiny question.So I was just looking for a small code what can send a minimize command for all open windows and also these who are not present in the taskbar and only using tray icon.So I found something like that...

invoke FindWindow,chr$("Shell_TrayWnd"),0
invoke SendMessage,eax,WM_COMMAND,419,0

....its also working to minimize all at once which are also present in taskbar but I also have running a other app which isnt present in taskbar and just using a try icon to show & minimize the window there and this keeps open.So what lpClassName parameter name I have to use for this to minimize that too?

Shell_TrayWnd
 + ReBarWindow32
 + TryNotifyWnd
   + SysPager
     ToolbarWindow32

Would like to know same function like the show desktop button on Win 7 in the right corner.One press / all away or minimized.

greetz

Link to comment

Hi,

so I found that example in MASM too but its working same as my short example using 2 APIs to minimize only windows which are also present in task.Apps who have no task window and only a tray icon keeps present.So its not working same as the Win 7 desktop button to minimize everything.

.386
.model flat,stdcall
option casemap:none

include     \masm32\include\windows.inc
include     \masm32\include\kernel32.inc
include     \masm32\include\ole32.inc
include     MinimizeAll.inc

includelib  \masm32\lib\kernel32.lib
includelib  \masm32\lib\ole32.lib

.data

CLSID_Shell   GUID sCLSID_Shell

IID_IDispatch GUID sIID_IDispatch


.data?

pShell         dd ?

.code

start:

    invoke      CoInitialize,NULL

    invoke      CoCreateInstance,ADDR CLSID_Shell,NULL,\ 
                CLSCTX_INPROC_SERVER,ADDR IID_IDispatch,ADDR pShell            

    coinvoke    pShell,IShellDispatch,MinimizeAll

    coinvoke    pShell,IShellDispatch,Release

    invoke      CoUninitialize
    
    invoke      ExitProcess,0

END start
IShellDispatch STRUCT

    QueryInterface          dd ?
    AddRef                  dd ?
    Release                 dd ?
    
    GetTypeInfoCount        dd ?
    GetTypeInfo             dd ?
    GetIDsOfNames           dd ?
    _Invoke                 dd ?

    get_Application         dd ?
    get_Parent              dd ?
    NameSpace               dd ?
    BrowseForFolder         dd ?
    Windows                 dd ?
    Open                    dd ?
    Explore                 dd ?
    MinimizeAll             dd ?
    UndoMinimizeALL         dd ?
    FileRun                 dd ?
    CascadeWindows          dd ?
    TileVertically          dd ?
    TileHorizontally        dd ?
    ShutdownWindows         dd ?
    Suspend                 dd ?
    EjectPC                 dd ?
    SetTime                 dd ?
    TrayProperties          dd ?
    Help                    dd ?
    FindFiles               dd ?
    FindComputer            dd ?
    RefreshMenu             dd ?
    ControlPanelItem        dd ?
    
IShellDispatch ENDS



sCLSID_Shell   TEXTEQU <{13709620h,0C279h,011CEh,{0A4h,09Eh,044h,045h,053h,054h,0,0}}>

sIID_IDispatch TEXTEQU <{00020400h,00000h,0000h,{0C0h,0,0,0,0,0,0,046h}}>



coinvoke MACRO ppv:REQ,interface:REQ,member:REQ,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16

    FOR arg,<p16,p15,p14,p13,p12,p11,p10,p9,p8,p7,p6,p5,p4,p3,p2,p1>

        IFNB <arg>

            push arg

        ENDIF

    ENDM

    mov     eax,ppv
    push    eax
    mov     eax,DWORD PTR [eax]
    call    interface.member[eax]

ENDM

You see its much code but works same like my 2 APIs I do use to get same results.Only that tray apps keeps untouched.

greetz

Link to comment

Why not simulate keypress Windows key + M?

Example (Delphi) attached...

ShowDesktop.rar

Or is this not what you need and maybe need more control of what to minimize?

Edited by NOP
  • Like 1
Link to comment

Hi NOP,

so also Windows key + M if I press it dosent minimize the apps which only used tray icon and nothing in taskbar.Thats the issue.Only the dektop button of Windows in the right corner (Win 7) does minimize everything.So the function of this should work anyhow else.

Example app: Below a small app what only used tray icon and  now window in taskbar to minimize there.Just test it to see what I mean.

WINFORCE.ZIP

greetz

Link to comment
  • 2 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...