Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Thanks for your comments. I've fixed the problem, although the solution is kind of embarrassing... In my defense, I'm still a student and new to this kind of stuff. </p> <p>I've used the Process Monitor to check what happens when I execute the VB script. I saw that the CLSID used there is the ID returned by <code>CLSIDFromProgID(OLESTR("CANape.Application"), &amp;ClassID);</code>, which meant that this had to be the right one and the problem had to be somewhere else. I've looked again at the <strong>CoCreateInstance</strong> and then took a look at the other parameters. Turns out that the context <strong>CLSCTX_LOCAL_SERVER</strong> was wrong, it has to be <strong>CLSCTX_INPROC_SERVER</strong>. I don't know why I've set it to local_server in the first place or why I've never questioned it. I wrote that part of the code a few days ago and then focused too much on the CLSID and IID rather than on the other parameters. I've also taken the first comment from Alex into account and created a tlb file.</p> <p>This is a simplified version of the code that works:</p> <pre><code>#import "CANape.tlb" int _tmain(int argc, _TCHAR* argv[]) { _bstr_t path = "C:\\Users\\Public\\Documents\\Vector\\CANape\\12\\Project"; CLSID idbpnt; CoInitialize(NULL); HRESULT hr = CLSIDFromProgID (L"CANape.Application", &amp;idbpnt); CANAPELib::IApplication *app; hr = CoCreateInstance(idbpnt,NULL,CLSCTX_INPROC_SERVER,__uuidof(CANAPELib::IApplication),(LPVOID*)&amp;app ); app-&gt;Open(path,0); CoUninitialize(); return 0; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload