Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (TipmyPip), 18,038 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Using COM Obejcts in Zorro #471212
02/23/18 15:04
02/23/18 15:04
Joined: Feb 2016
Posts: 5
Stuttgart
turbodom Offline OP
Newbie
turbodom  Offline OP
Newbie

Joined: Feb 2016
Posts: 5
Stuttgart
Hi. I'm struggling using classes from my C#.Net COM registered library. I wanna make use of <com.h> and the CoCreateInstance() method via my classe's Guids (interfaceid and classid). Here is some template code as far as I could make it. Can someone help me out with this code, it is not working when inserting my guids. Do I miss something? The Coinitilaize method is already returning no success.

#include <litec.h>
#include <com.h>


function Main()
{
// open the COM interface

HRESULT hr = CoInitialize(NULL);
if (hr!=S_OK)
{
printf("CoInitialize Failed: %xnn", hr);
return 0;
} else
printf("CoInitialize succeededn");

// define the GUIDs (Replace ? by real GUIDs)
GUID CLSID_MyObject;
IID IID_IFoo;
IIDFromStr("{????????-????-????-????-????????????}",&CLSID_MyObject);
IIDFromStr("{????????-????-????-????-????????????}",&IID_IFoo);

LPVOID *pIFoo;
// get a pointer to the class function table
hr = CoCreateInstance(&CLSID_MyObject, NULL, CLSCTX_ALL,&IID_IFoo, &pIFoo);
if (hr!=S_OK) {
printf("CoCreateInstance Failed: %xnn", hr);
return 0;
} else
printf("CoCreateInstance succeededn");

// use the class
//pIFoo->Func1();

// close the interface and exit
pIFoo->Release();
CoUninitialize();
}

Thank you very much in advance.

Re: Using COM Obejcts in Zorro [Re: turbodom] #471234
02/24/18 17:12
02/24/18 17:12
Joined: Feb 2017
Posts: 1,806
Chicago
AndrewAMD Offline
Serious User
AndrewAMD  Offline
Serious User

Joined: Feb 2017
Posts: 1,806
Chicago
I am also interested in the answer to this question.

That said, it might be preferable to expose unmanaged C functions if it can be done in your application.


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1