How can we see other applications open in windows and know when they are minimized or maximi

Hi everyone

I need to know if there is a way i can seeother applications open in windowsand know when they are minimized or maximized.

So basically if there are five applications open like outlook, excel, word, a bowser, etc. How can i see this in vb.net code? Is it possible then to know when that form is minimzied or maximized (event)?

Thanks in advance :)

[403 byte] By [LouisDeGouveia] at [2007-12-23]
# 1

To get a list of the processes on the machine. Or if you looking for specific applications then there is a GetProcessByName method.

For Each Pr As Process In Process.GetProcesses
ComboBox1.Items.Add(Pr.ProcessName)
Next

I'm not sure if you can tell if the application is minimized or maximized easily though.

spotty at 2007-8-30 > top of Msdn Tech,Visual Basic,Visual Basic General...
# 2

Hi spotty

Thanks a lot. That does halp me a bit. But is there a way to now declare that with events like you do with other windows components?

I realy need to know when a specific application is minimized or going to be minimized. Also vica versa.

Any ideas?

Thanks in advance :)

LouisDeGouveia at 2007-8-30 > top of Msdn Tech,Visual Basic,Visual Basic General...
# 3

adventurous!

I have no idea how you would see when an app is 'going to be minimized', but I think you can use GetWindowPos and use the returned X & Y to see if it is minimised - I think these values are 0 if so, but you'd better check that!

Anarchy at 2007-8-30 > top of Msdn Tech,Visual Basic,Visual Basic General...
# 4

Hi anarchy

Do you have an example of your GetWindowsPos, will this work on another application that i have no control over. The only other thing is that i wanted it to be an event. Because if i use GetWindowsPos that means i have to constantly check if it has been minimized. Please remember that i need to do a specific action once a specific 3rd party application (not mine) is minimized/maximized.....needs to be immediate or if possible just before it is minimized.

Is there a way to catch when another applications minimized button is pressed?

Thanks in advance

LouisDeGouveia at 2007-8-30 > top of Msdn Tech,Visual Basic,Visual Basic General...
# 5

Hi, sorry no, I don't have any examples, I use SetWindowPos plenty, but not getWindowPos. In fact I'm not entirely sure that it will do what you need, but I do remember I have used it before to see if a window is minimised, so it must be possible!

I doubt very much you can trap a minimeze event before it happens, the best you can do would be to have a tight loop (1/4 second-ish) and checking the window state every time

Anarchy at 2007-8-30 > top of Msdn Tech,Visual Basic,Visual Basic General...
# 6

how to close one or all opened application

please help me.

libyan at 2007-8-30 > top of Msdn Tech,Visual Basic,Visual Basic General...
# 7

You can actually get notified when a window is about to be minimized or maximized. You will need to use the SetWindowsHook procedure to install and listen to a WH_CBT_Hook.

Here's the general information about WIndowsHooks:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/Windowing/Hooks/AboutHooks.asp

Here's a thread that shows you how to do something smiliar (for a WH_Mouse_Hook) in VB:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=581752&SiteID=1

Hope this helps,

MSFTAbelValadez at 2007-8-30 > top of Msdn Tech,Visual Basic,Visual Basic General...