Student
Student

Reputation: 205

Send Enter key press to active windows in winAPI

I have opened a process using CreateProcess like this:

CreateProcess(NULL,"C:\\Program Files (x86)\\Microsoft Office\\OFFICE11\\PPTVIEW.EXE C:\\Users\\DRILON\\Desktop\\a.pps",NULL,NULL,FALSE,0,NULL,NULL,&sai,&pi);

As you can see this process opens a pps file. Now I want to send and enter key press to the presentation (which will change the slides). I have tried a lot of codes but none is working. I have tried:

HWND powerpoint = GetActiveWindow();
PostMessage(powerpoint, WM_KEYDOWN, VK_RETURN, 0);

Also

SendMessage(powerpoint, WM_KEYDOWN, VkKeyScan('c'), 1);

Is there a way to do this?

Upvotes: 1

Views: 1657

Answers (1)

icktoofay
icktoofay

Reputation: 129001

You can use PowerPoint's object model, using the equivalent in your language of:

CreateObject("Powerpoint.Application").ActivePresentation.SlideShowWindow.View.Next

Upvotes: 1

Related Questions