Hi, I tried to read as most topics here as I could, but still haven't found the answer. I try to get handle of PowerPoint from my applivation. PowerPoint has different titles (depending on opened file), so I can't use FindWindow. I also tried EnumWindows, but didn't work (probably my mistake). I have console application and in my situation, it doesn't matter on time when I switch PowerPoint to be active. After PowerPoint is active, I start manualy sending WM_KEYDOWN messages over serial port. Most easy way for me can be something like this:

HWND prog = GetActiveWindow();
if (!prog) printf("next time...");

I can't understand why, but "next time..." appears every time, doesn't matter on which window is active. Any ideas what I'm doing wrong?