Jump to content

Get process location?


 Share

Recommended Posts

Hello forumers..

I've been at autoit for weeks and I'm loving it, very addiction!

I have a quick question I couldn't find in the help file.. How do I get a running process location, and icon?

Link to comment
Share on other sites

I'm not sure what you mean by "location" of a running process, but you can get the Process ID of a process (WinGetProcess).

I have a project myself that would benefit from the ability to get the icon from a window (WinGetIcon?), but I'm not really sure how it would be stored so I could use it in my script.

Every open window has an icon on the title bar, and it makes sense that the icons would have to be stored in memory somewhere, simply because the windows may need to be re-drawn at a moments notice. From what I can tell, AutoIt can display icons when they are referred to in one of two ways:

1. By filename and icon offset

2. As bitmap by filename.

So far, there is no easy way that I know of to have any of the autoit functions draw an icon that is already stored somewhere in memory. Does anyone have any different exerience?

Link to comment
Share on other sites

to answer freeze

$Button = GUICtrlCreateButton("", 100, 35, 73, 41, $BS_ICON)
GUICtrlSetImage(-1, "my_File.exe")

and

$nPathButton= GUICtrlCreateButton("...", 410, 2, 25, 20, BitOr($BS_ICON, $BS_FLAT))
GUICtrlSetImage(-1, "shell32.dll", 3, 0)

will set the icon of that exe on the button

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

to answer freeze

$Button = GUICtrlCreateButton("", 100, 35, 73, 41, $BS_ICON)
GUICtrlSetImage(-1, "my_File.exe")

and

$nPathButton= GUICtrlCreateButton("...", 410, 2, 25, 20, BitOr($BS_ICON, $BS_FLAT))
GUICtrlSetImage(-1, "shell32.dll", 3, 0)

will set the icon of that exe on the button

8)

Yes, I knew that. In the examples you gave, the icon is stored in a file. But what if I wanted to display an icon and I didn't know the name of it's file, or what it's icon location in the file would be?

Say that I just know that a currently open window has an icon on the left side of the title bar, and I want to display that icon along with the window title as a listview item.

This would be mainly for use as a replacement to Task Manager, where it would list all the applications and their icons.

Link to comment
Share on other sites

Yes this is something I would like to know as well...how to get the window/process icon without knowing beforehand what file it is.

Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Link to comment
Share on other sites

gafrost posted a nice script here that accomplishes what you're looking for (minus the icons, which others have already helped you with).

Note that it was written in an older beta version, so get the latest version and change these lines:

DLLStructDelete($Process)
to this:
$Process=0

Good luck!

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...