The Prepar3D version we are using is v4 and it is able to connect to DIS. We created a PDK add-on and within this add-on we would like to know either call signs or dis entity id's, but we aren't able to get a hold of P3D::IDISManagerV450. What do we need to do differently to be able to get a reference to P3D::IDISManagerV450?
Code: Select all
#include <Pdk.h>
#include <InitGuid.h>
#include <ISimObject.h>
#include <ISimObjectDIS.h>
#pragma comment(lib,"user32.lib")
void DisplayQueryDisManagerResult(HRESULT result);
STDMETHODIMP_(void) DLLStart(__in __notnull P3D::IPdk* pPdk)
{
if (pPdk) {
CComPtr<P3D::IDISManagerV450> disManager;
HRESULT result = pPdk->QueryService(P3D::SID_SimObjectManager, P3D::IID_IDISManagerV450, (void**)&disManager);
DisplayQueryDisManagerResult(result);
}
return;
}
STDMETHODIMP_(void) DLLStop()
{
}
void DisplayQueryDisManagerResult(HRESULT result) {
if (SUCCEEDED(result))
MessageBox(nullptr, "Loaded \"P3D::IID_IDISManagerV450\" successfully", "message", MB_OK);
else
{
if (result == E_NOINTERFACE)
MessageBox(nullptr, "Interface not supported error for \"P3D::IID_IDISManagerV450\"", "error", MB_OK);
else
MessageBox(nullptr, ("error code: " + std::to_string(result)).c_str(), "error", MB_OK);
}
}