April 29, 2024, 10:39:24 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


first COM server

Started by sapero, January 07, 2006, 11:06:23 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

sapero

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 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

Ionic Wind Support Team

January 07, 2006, 11:13:37 AM #1 Last Edit: January 07, 2006, 11:30:32 AM by Ionic Wizard
 ;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.

Ionic Wind Support Team

Parker

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.

sapero

January 07, 2006, 12:41:55 PM #3 Last Edit: January 07, 2006, 12:47:38 PM by sapero
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 ?

Parker

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"

sapero

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 ???

Ionic Wind Support Team

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.
Ionic Wind Support Team

Steven Picard

Awesome!  Sapero is on the team!

Zen

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