Gamestudio Links
Zorro Links
Newest Posts
Camera always moves upwards?
by clonman. 11/13/25 14:04
brokerCommand PLOT_HLINE parameters
by M_D. 11/13/25 10:42
ZorroGPT
by TipmyPip. 11/10/25 11:04
Training with the R bridge does not work
by frutza. 11/05/25 00:46
Zorro 2.70
by opm. 10/24/25 03:44
Alpaca Plugin v1.4.0
by TipmyPip. 10/20/25 18:04
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (TipmyPip, AndrewAMD), 21,112 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sheliepaley, Blueguy, blobplayintennis, someone2, NotEBspark
19177 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: 7
Stuttgart
T
turbodom Offline OP
Newbie
turbodom  Offline OP
Newbie
T

Joined: Feb 2016
Posts: 7
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,809
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,809
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