How can i monitor windows are minimized

How can monitor that all window(s) are mimimized using VB.NET. The actual need is i want to show different wallpapers while the user see the desktop. i don;t want Timer control to periodically change the wallpaper.

LVL 2
VishnukumarAsked:
Who is Participating?
 
peetmConnect With a Mentor Commented:
>>what i  need is i have to capture the event, when other window(s) are minimized.  is this possible?

I don't know if that sort of facility is built-in to .NET, the way I would do it is to use a Windows Hook of some kind.
0
 
peetmCommented:
You could use EnumWindows and check their state using IsIconic perhaps?
0
 
VishnukumarAuthor Commented:
Thanks peetm.

So,  i can use Enumwindows periodicalloy using timer control. Is there any possiblity to trigger the event/code, when external minimized button clicked.

0
Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

 
peetmCommented:
Do you mean, do the check when your window(s) are in the process of being minimised?

Also, instead of using the Windows' API, you can use this:

For Each p As Process In Process.GetProcesses()

        Dim h As Long     = p.MainWindowHandle

        ...


Then use IsIconic(h) - perhaps with IsWindowVisible(h)

Actually, Explorer will show up as Visible and Not Iconic, so you'll want to filter that one.  

So, if you find a visible window that isn't iconic, you could use something like this to check that it's not Explorer ...

Dim IsExplorer As Boolean = p.MainModule.FileName.Contains("Explorer.EXE")
0
 
VishnukumarAuthor Commented:
// Do you mean, do the check when your window(s) are in the process of being minimised?

Thanks for the support peetm,

i have some partial solution/workaround, that i will execute your solution periodically using Timer control.
I have no problem about my own window(s) being minimized. Actually my program not visible in the desktop it is simply sits in system tray. what i  need is i have to capture the event, when other window(s) are minimized.  is this possible?
0
 
VishnukumarAuthor Commented:
Thanks for the support peerm. Myself also doing some research on this. Please let me know if you find any solution on it.

0
All Courses

From novice to tech pro — start learning today.