Results 1 to 7 of 7

Thread: Icon of currently running programs

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2007
    Posts
    9

    Icon of currently running programs

    Hello,

    I am creating a program and would like so somehow be able to get the Icons of all the currently running programs and then place them into an image control that i created in my program.

    I can get the name and everything else of all the currently running programs but i am not able to find a way of how to get that icons.

    Thanks alot for anyhelp

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Icon of currently running programs

    Have you tried to use SendMessage API with the WM_GETICON message?

    Edited: Another option, probably more in line with what you are asking for.
    1. Get the module name that started the process (GetModuleFileNameEx)
    2. Then use ExtractAssociatedIcon.

    WM_GETICON obviously won't work if there is no window to get an icon from.
    Last edited by LaVolpe; Oct 20th, 2007 at 06:55 PM.

  3. #3

    Thread Starter
    New Member
    Join Date
    Oct 2007
    Posts
    9

    Re: Icon of currently running programs

    Thanks alot for the help, would it be possible to find the file or the file name of the running program?

  4. #4
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Icon of currently running programs

    You said you have the name for all running programs? If so, then ExtractAssociatedIcon is what you want. If you have the process IDs of all current processes, then use GetModuleFileNameEx to get that name.

  5. #5

    Thread Starter
    New Member
    Join Date
    Oct 2007
    Posts
    9

    Re: Icon of currently running programs

    Hello, sorry again but im getting quite confused with all these numbers i get, i am able to get the handle to the window, like hwnd, and then i am able to get that process ID using GetWindowThreadProcessId, but GetModuleFileNameEx calls for a handle to the process and a handle to the module, maybe im just missing something but i am getting confused with all the different numbers, maybe i just dont understand it with all the different handles, thanks alot for the help!

  6. #6

    Thread Starter
    New Member
    Join Date
    Oct 2007
    Posts
    9

    Re: Icon of currently running programs

    Hello, ok sorry about the last post, i finally figured it out, i got it im not sure how but i did, now the only thing is that GetModuleFileNameEx returns a number, the length of the string of the file name, so how could i get the actually file name into a string, so the string would equaly C:/Program Files/ whatever and so on

  7. #7
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Icon of currently running programs

    Can you share what you are using to get "the names of all the currently running programs"? Your quote from post#1. I assume the icon is the one you want that is associated with the main app (i.e., the one you would see in Explorer for an exe for example). FYI: Not all processes have windows.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width