Gamestudio Links
Zorro Links
Newest Posts
Max Number of Strategies in /Strategy folder
by Martin_HH. 06/16/26 11:13
Z9 getting Error 058
by jcl. 06/16/26 09:51
How to select between IB accounts by script?
by AndrewAMD. 06/13/26 15:44
Zorro tutorial ideas?
by AndrewAMD. 06/13/26 15:01
Zorro 3.01 recoded MMI function issue
by 11honza11. 06/13/26 11:40
Stooq now requires an API key
by AndrewAMD. 06/11/26 17:55
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
2 registered members (Martin_HH, AndrewAMD), 3,476 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Student_64151, Koti, curry, DeepxKalsi, Samed
19219 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,819
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

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