C ++を使用してsimul8ファイルを開きたい
#include "stdafx.h"
#include "windows.h"
#import "C:\Program Files\SIMUL8\S8.exe" named_guids
using namespace SIMUL8;
int _tmain(int argc, _TCHAR* argv[])
{
IS8Simulation* MYSIMUL8 = NULL;
IUnknown* pUnk = NULL;
HRESULT hr = ::CoCreateInstance(SIMUL8::CLSID_S8Simulation,NULL,CLSCTX_ALL,__uuidof(IUnknown),(void**)&pUnk);
_bstr_t bstrFileName = ::SysAllocString(L"D:\\Demo1.s8");
hr = MYSIMUL8->Open(bstrFileName);
MYSIMUL8->RunSim(2400);
}
エラー メッセージ Unhandled exception at 0x004017e7 in SimTest.exe: 0xC0000005: Access violation reading location 0x00000000 が表示されます。s8.tliで
inline HRESULT IS8Simulation::Open ( _bstr_t FileName ) {
HRESULT _hr = raw_Open(FileName); ON THIS LINE
if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
return _hr;
}
私が間違っていることを親切に助けてください