Search code examples
pythonwinapipywin32

any way to get a window handle by its title using win32 api?


so the main problem is i need to use the SetPixel command to draw pixels on a specific window . lets say cmd . i do need the window handler and i dont know anyway to access the HWND of a window I didnt create . anyway to do this ? or anyway to get an array of HWND's for a pid ? and THEN check them to match the specific title ?

many thanks in advance

PS : i found a couple of similar questions here . please note i want an answer using bare win32api since im using python and not .net .


Solution

  • As far as I understand it, you want FindWindow;

    Retrieves a handle to the top-level window whose class name and window name match the specified strings.

    ...

    If lpClassName is NULL, it finds any window whose title matches the lpWindowName parameter.