Results 1 to 7 of 7

Thread: Send program a message

  1. #1

    Thread Starter
    Fanatic Member Wynd's Avatar
    Join Date
    Dec 2000
    Location
    In a bar frequented by colossal death robots
    Posts
    772

    Send program a message

    I can see a program running in the Close Program box, but there is no window for it. How can I get a handle or something to it, and then send it a message?
    Alcohol & calculus don't mix.
    Never drink & derive.

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    Code:
    HWND h = FindWindow(NULL, "Title Of The Window");
    //h = the hwnd of the window
    I think.

    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  3. #3

    Thread Starter
    Fanatic Member Wynd's Avatar
    Join Date
    Dec 2000
    Location
    In a bar frequented by colossal death robots
    Posts
    772
    I tried that but it didn't work, because there is no window, Basically, it is minimized to the system tray.
    Alcohol & calculus don't mix.
    Never drink & derive.

  4. #4
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    GetProcessHandle or something like that?
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  5. #5
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Even something that is minimized to the tray needs a window. The problem is knowing it's class (try Spy++ to find out).
    e.g. ICQ always has the dialog window. Problem is, since it's created by the system, the class name is not always the same.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  6. #6

    Thread Starter
    Fanatic Member Wynd's Avatar
    Join Date
    Dec 2000
    Location
    In a bar frequented by colossal death robots
    Posts
    772
    2 things:

    1) If I don't know its class, is there any other way?
    2) Say I do get the class name. What do I do then? I don't see any API functions about getting a process handle other than the current one.
    Alcohol & calculus don't mix.
    Never drink & derive.

  7. #7
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    OpenProcess can give you a process handle by id, but I don't know how to get the id.

    Function names work only for WinNT, Win9x uses other methods.
    EnumProcesses will give you the IDs of all processes that are currently running. Use OpenProcess to get a handle from the ID. Then use EnumProcessModules to get all module handles of a process. Get the file name of the module with GetModuleFileNameEx and search for the .exe file.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

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