Search code examples
c++unmanagedpowerpointidispatch

How to get the running version of Power Point using C++ unmanaged?


I am using C++ unmanaged with Power Point (2003 and 2007).

How do I get the running version of Power Point (2003 or 2007) with IDispatch?

Thanks, any help would be awesome.


Solution

  • I am sorry I was working in another project. I found a simple way to get the version using CComDispatchDriver instance.

    CComVariant ccVersion;

    //disp is CComDispatchDrive type

    disp.GetPropertyByName("Version", ccVersion);

    doing that I get ccVersion = "11.0" for 2003 and "12.0" for 2007.

    To cast it to string I used CString class:

    CString version;

    version = CString (V_BSTR(&ccVersion));

    Thanks for your help, I hope this can be useful for someone else