IonicWind Software

Aurora Compiler => Software Projects => Topic started by: sapero on January 07, 2006, 11:06:23 AM

Title: first COM server
Post by: sapero on January 07, 2006, 11:06:23 AM
Hello Community :D

Yesterday got Aurora and played 24h with. The first thought was "how" and "cool"
Here's a dll COM server demo with one usual method - SayHello

I don't know how to post all the code, so please download the whole sample :)
First - download the required object file (http://www.ionicwind.com/forums/index.php?topic=172.msg1336#msg1336) to be able to compile dll's
Next step - create import library from advapi32.dll
as next - compile dll-server project from zip\ocx\ and register the dll using register.bat script
now compile second project in zip\test

I hope you are familiar with COM, and here are no bugs/leaks ;D
Title: Re: first COM server
Post by: Ionic Wind Support Team on January 07, 2006, 11:13:37 AM
 ;D  I knew it wouldn't be long before you dug your hands into Aurora COM.  Nice demo.

The layout of Aurora vtables was specifically designed so objects would work seamlessly with COM.

Title: Re: first COM server
Post by: Parker on January 07, 2006, 11:54:23 AM
Hey, that's something I understand ;D
Now that there's no assembly involved (well, the data statements I get) it's understandable and much more clear. I'm going to have to find some tutorials / articles on using COM now and start learning.
Title: Re: first COM server
Post by: sapero on January 07, 2006, 12:41:55 PM
I agree, now the code is readable.
Comming soon ... flash player control, already 99% done in ibdev with trackbar

how to use void type for "ppv" or any other pointer ?
Title: Re: first COM server
Post by: Parker on January 07, 2006, 12:55:53 PM
Do you mean a generic pointer type? It's called POINTER, same as in IBasic. "pointer x" - generic pointer, "int *x" - int pointer. You can also use casting to whatever type you want like IBasic's *<> operator, but using *() instead. For example, *(string)pText = "Hello"
Title: Re: first COM server
Post by: sapero on January 07, 2006, 02:29:58 PM
QueryInterface(GUID *refiid, void *ppv),HRESULT
the 'void' word is colorized as standard variable type like pointer, using it sometimes works ok, or says invalid assigment.

in test server.src - change the ppv type to void - it compiles fine
but changign it in CUnknown .src and .inc - here is undefined typecastCUnknown::QueryInterface(GUID *refiid, void *ppv),HRESULT
{
if IsEqualGUID(refiid, _IID_IUnknown)
or IsEqualGUID(refiid, IID_IAuroraTest1)
{
*(pointer)ppv = this; // only pointer works here
AddRef();
return S_OK;
}
*(int)ppv = NULL;
return E_NOINTERFACE;
}

I hope this "void" is supported by parser ???
Title: Re: first COM server
Post by: Ionic Wind Support Team on January 07, 2006, 02:55:43 PM
void is a non type and it is supported. 

void *blah;

Is a pointer to an unknown type.  You must use a typecast to access it properly.  for your ppv the correct access is *(pointer)blah; 

It would be the same as

pointer blah;
*(pointer)blah;

----------------

void blah;

Is invalid, blah will have an address, but no size and no type.  I don' t have an error message for that one yet.
Title: Re: first COM server
Post by: Steven Picard on January 07, 2006, 11:10:15 PM
Awesome!  Sapero is on the team!
Title: Re: first COM server
Post by: Zen on January 08, 2006, 09:19:08 AM
Ha Ha. Ive seen your name spero on the forums but saw no posts from you. I should of took bets that the first thing you made would be COM related. A very nice example.

Welcome aboard.

Lewis