Create your own ActiveX ocx for visual control with Freebasic , prototype

Started by Marc Pons, October 11, 2016, 07:50:43 AM

Previous topic - Next topic

Marc Pons

As a vb6 guy, I was always using the activeX controls,
that why i was interested by the huge work done by Jose on COM.

I'm not the inventor of the following , it comes originally from Alober
I've just worked on it to understand more on COM,  so i've adapted it to be easy to understand at least for me.

Thanks to Jose, Alober and also Loe from the freebasic Forum , following/using/adapting their codes
i was able to understand better, even its not finished...

but i think, it is possible to share here, a sample of visual activeX component
totally done with Freebasic (except the .tlb wich is produced by midl.exe / part of visual c++ )

and an exe test to play with.

Its not complete because i'm still not understanding how to play with some interfaces,
but functionnal as activeX definition with 1 class and 1 event class

The test shows how to use 2 controls on the same application and detect the events from each of them

sorry: the attachment was not the right one , updated now :-\

aloberr


Marc Pons

New evolution,

this time, with embeeded manifest file on the exe test  (no more need to have it on the same folder as the exe )

more important modification, the server (ocx) use the implemented   IoleWindow : getWindow method
to "attach" the component to a "pseudo-container" provided by the client (exe)

it is closer to the normal Atl container way than, the previous work-arround, searching a specific window as parent...

But still not implementing full container, not needed for simple visual component like that:
2 OleAutomation interfaces inheriting fom IUnknown, (not IDispatch)

remember, it is just a proof of concept to create Visual ActiveX Component with FreeBasic, but works.


ganlinlao

Very good, thank you, I can learn how to use Freebasic to write activeX, COM technology is still very important, especially the use of existing Report and chart components.