Mutley2003
asked on
Application management
This is a follow on from
https://www.experts-exchange.com/questions/21153287/List-all-running-applications-and-automatically-refresh.html
Amir gave a final solution using enumwindows. That works fine but there are a couple of issues
1. If I have two instances of Excel running, I get THREE items listed .. the first of which has a caption prefixed by "Microsoft Excel-" . Why is this, and how can I get rid of this extra instance?. (Note : Task manager shows this extra instance, but the taskbar does not)
2. If I use the enumwindows approach, how do I then go on to do task (app) management -- eg switch to an app, kill an app. enumwindows will give me a handle, but where do I go from there? (previous task killing references have been based on the exe name? : dk if that will be any use given that Excel can give me multiple entries in the list)
3. What is the best way of refreshing the contents of the app list? I can use a timer, but would it be better to install a shell hook and monitor eg HSHELL_WINDOWCREATED?
4. If I want to go one step further and find out something about the current apps and what they are doing, is the handle that I get from enumwindows sufficient? Can I go back from the handle to work out the app name and arguments. For example, if I want to connect to a running instance of Excel and read some stuff from it, I need to do things like at http://www.djpate.freeserve.co.uk/AutoExcl.htm#OpenWorkbook .. I am going to need the filename of the xls at the very minimum.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ok, I will close this .. no action for a while now
Sorry, didn't notice your previous posting... if you want to get more info for a process based on the process handle, take a look at madshi's madProcess package... check out www.madshi.net
ASKER
DragonSlayer
I could not see madProcess on that site .. maybe he has reorganized it. It does not seem to be part of madShell or madKernel which is where I would have guessed it would be
Any clues?
I could not see madProcess on that site .. maybe he has reorganized it. It does not seem to be part of madShell or madKernel which is where I would have guessed it would be
Any clues?
ASKER
4. Again, since you have the handle, you can retrieve its caption using GetWindowText
"
yeah, but is there anything ELSE I can get from the handle apart from stuff about the window. Like the exe name and hopefully the arguments when it was called.
About 1. Originally I asked
" 1. If I have two instances of Excel running, I get THREE items listed .. the first of which has a caption prefixed by "Microsoft Excel-" . Why is this, and how can I get rid of this extra instance?. (Note : Task manager shows this extra instance, but the taskbar does not)"
I don't think the answer DragonSlayer gave to this quite gets to the point. Why are there THREE in task manager and what is the extra one and what can I do about it?
Thanks