Microsoft Powerpoint Automation Using Comate

Just starting out? Need help? Post your questions and find answers here.
PeteM
User
User
Posts: 12
Joined: Thu Mar 05, 2015 8:44 pm

Microsoft Powerpoint Automation Using Comate

Post by PeteM »

I am trying to get the Hwnd of the current Powerpoint running slideshow window. The documentation describes it as SlideShowWindow.HWND, and I am trying to retrieve it with this code:

Code: Select all

Declare.i Hwnd
Hwnd = PPTObject\GetIntegerProperty("Presentation\SlideShowWindow\HWND")
but it returns a "Method/property not supported by this object error".

The VB example given by Microsoft is:

Code: Select all

'Declaration
ReadOnly Property HWND As Integer
	Get
'Usage
Dim instance As SlideShowWindow
Dim value As Integer

value = instance.HWND
I guess the problem is that I am not declaring the SlideShowWindow object, but I dont know its structure (if that is indeed the way to do this).

Help appreciated!
User avatar
spikey
Enthusiast
Enthusiast
Posts: 771
Joined: Wed Sep 22, 2010 1:17 pm
Location: United Kingdom

Re: Microsoft Powerpoint Automation Using Comate

Post by spikey »

I'm not sure because I can't test it for myself but I think you're having problems because the Presentation object is indeterminate when you issue the call. An indeterminate object will have no methods or properties.

Try using the ActivePresentation or Presentations(1) objects which should be determinate. Failing that try getting a Presentation as an intermediate object with GetObjectProperty on the application object then getting the SlideShowWindow\HWND from the intermediate object.

You didn't include the application instantiation code so I'm assuming that it is properly instantiated here, if not that will be the cause of the problem.
Post Reply