News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Minimizing open applications

Started by Vortex, January 01, 2011, 04:30:51 PM

Previous topic - Next topic

Vortex

Here is how to minimize all open windows with the usage of COM :



.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

Vortex

Another version synthesizing the Windows key + M combination :



; Reference :

; http://support.microsoft.com/kb/194914/en-us

include MinimizeAllWnd.inc

.code

start:

    invoke  keybd_event,VK_LWIN,0,0,0

    invoke  keybd_event,'M',0,0,0

    invoke  keybd_event,VK_LWIN,0,KEYEVENTF_KEYUP,0
         
    invoke  ExitProcess,0

END start

dedndave

very cool, Erol

now, i have more stuff to learn   :red

caseys

Uf, never been so hard to understand