Results 1 to 3 of 3

Thread: Win32API grab mohconsole

  1. #1
    Client Beta Testers Appelpitje's Avatar
    Join Date
    Jan 2012
    Location
    Belgium
    Posts
    571

    Default Win32API grab mohconsole

    So i wanted to grab the text from moh console but doesn't seem to work with the following code:

            hwnd = win32gui.FindWindow("MOHAA WinConsole", None)
    texthwnd = win32gui.FindWindowEx(hwnd, None, "Edit", None)

    buffer = win32gui.PyMakeBuffer(2555)
    length = win32gui.SendMessage(texthwnd, win32con.WM_GETTEXT, 2555, buffer)
    result = buffer[:length]
    print result


    The code above works for notepad if i change MOHAA WinConsole to Notepad and then it grabs what i typed in notepad.
    So i select the MOHAA console which does work because i can change the window title etc. But when i use spy++ to see what class the console is, its "Edit" and when i try to use it, it just doesn't give me anything.
    Anyone had this issue before or knows what im doing wrong?

  2. #2

  3. #3
    Client Beta Testers Appelpitje's Avatar
    Join Date
    Jan 2012
    Location
    Belgium
    Posts
    571

    Default

    Thanks ryback, but Ley0ks solution is less code and easier

    win32gui.GetDlgItem(hwnd, 100)


    Did the trick.

Posting Permissions

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