how about receiving windows messages via Python from Totalcommander

378 Views Asked by At

I'm able to send Windows Messages via Python to Totalcommander with that code

import win32gui
hwnd = win32gui.FindWindow("TTOTAL_CMD", None)          # catch Totalcommander handle
win32gui.SetForegroundWindow(hwnd)
nothing = win32api.SendMessage(hwnd, 1075, 4001, 0)     # setting Focus on Totalcommander-left-window

But I've no clue how to receive answers of those windows messages which I can sent to Totalcommander too.

When I try that,

import win32gui
hwnd = win32gui.FindWindow("TTOTAL_CMD", None)          # catch Totalcommander handle
buf = win32gui.PyMakeBuffer(255)
result_length = win32api.SendMessage(hwnd, 1074, 17, buf)      # getting Path-Info from Window
result = buf[0:result_length*2+2]
tc_path_string = result.decode('utf-16')

I'm getting a "'memoryview' object has no attribute 'decode'" at last line

I should get that Info back from Totalcommander- made that working in Autohotkey/AHK from which I now try to change to python.

Jovanni

0

There are 0 best solutions below