COM Initialisation via DllGetClassObject

The discussion area for general programming languages C/C++ Delphi Lua and others
Post Reply
kjh
Registered User
Posts: 7
Joined: Sun Jun 23, 2013 1:46 pm

COM Initialisation via DllGetClassObject

Post by kjh »

Hi guys
I found an article discussing initializing COM/ActiveX dll's without registering the COM object, ( see the attached pdf).
If possible it would mean that ActiveX Dll's could be handled as 'normal' dll's in APM without using luacom, eg. the Chilkat components.
The reason why i am interested in this is the possibility to create wrappers without writing a lot of code for converting the obj:something(x,x,x) syntax to the normal syntax, required to get the intellisense to work in AMS.

What i need is help for converting the VB code below to APM, using __DLL.LoadLibrary and __DLL.GetFunction

Code: Select all

Type IID 
 data1 As Long 
 data2 As Integer 
 data3 As Integer 
 data4(7) As Byte 
End Type 
Declare Function DllGetClassObject Lib "CodeSample1.dll" _ 
Alias "DllGetClassObject" _ 
 (REFCLSID As Long, REFIID As IID, PPV As Long) As Long 
Sub InitVBdll() ' Invoke "COM initialiser" in a VB6 dll 
Dim pIID As IID 
Dim pDummy As Long 
 ' Set pIID = IID of IClassFactory 
 ' = {00000001-0000-0000-C000-000000000046} 
 pIID.Data1 = 1 
 pIID.Data4(0) = &HC0 
 pIID.Data4(7) = &H46 
Call DllGetClassObject(pDummy, pIID, pDummy) 
End Sub
The full article can be found here http://filedb.experts-exchange.com/inco ... e-Rev1.pdf

Hope somebody has the time to look into it
Kjeld

Edit: Attching PDF-files is not allowed, so please get it from the rar
VB6-Library-Guide-Rev1_page6.rar
You do not have the required permissions to view the files attached to this post.
User avatar
Serkan
Developer
Developer
Posts: 214
Joined: Thu Jul 04, 2013 8:44 pm
Location: Windows.h
Contact:

Post by Serkan »

Hi Kjeld

I took a look at the article (pdf document)
Author mentions about auto initialization of com objects at first , but article follows as exporting normal dll functions from a com object
It simply turns into 'how to export a function from a VB dll' explanation
to be honest , i did not fully read article but ,what can i say is
you can not call com interface functions like normal dll functions

even if author explains how to initialize a com object for an application process , you still have to use CreateObject() to create an instance of interface
it is only a (not recomended) shortcut to initialize a com object for an application

in other side , this article about VB environment that is already based on COM , a VB application is using COM environment to process at most times
and article targets the VB environment

APM will contain a module (in next versions) called ComCtrl , this module will allow you to do everthing that can be done with LuaCom plugin
in addition to this; this module will allow you to create visual com objects (such as web browser, flash)
in short : ActiveX object plugin will be available in APM as a module

when time has come to this module i will try to add a function to autoinitialize a com object ,as explained in first paragraph of that article
but you still must use

Code: Select all

ComCtrl.CreateObject('CustomComObject.1')
to create an instance of interface

or

Code: Select all

ComCtrl.CreateControl('CustomVisualComObject.1',hWndParent,x,y,width,height)
to create a visual component
kjh
Registered User
Posts: 7
Joined: Sun Jun 23, 2013 1:46 pm

Post by kjh »

Hi Serkan
Thank you for taking the time to look into it, - the ComCtrl additions to APM would really be useful, there are lots of components that could be nice extensions to have in the AMS toolbox.

APM is a great tool - for now I am a writing a wrapper for the dll-edition of the Debenu Quick PDF Library (829 functions :shock: ) - and it would not have been possible with out the all-in-one solution that APM offers

Looking forward to see the next version, keep up the good work and thanks again.

Best regards, Kjeld
User avatar
BadKaiPanda
Registered User
Posts: 95
Joined: Fri Jun 14, 2013 8:49 pm

Post by BadKaiPanda »

Serkan wrote: APM will contain a module (in next versions) called ComCtrl , this module will allow you to do everthing that can be done with LuaCom plugin
in addition to this; this module will allow you to create visual com objects (such as web browser, flash)
in short : ActiveX object plugin will be available in APM as a module

when time has come to this module i will try to add a function to autoinitialize a com object ,as explained in first paragraph of that article
but you still must use

Code: Select all

ComCtrl.CreateObject('CustomComObject.1')
to create an instance of interface

or

Code: Select all

ComCtrl.CreateControl('CustomVisualComObject.1',hWndParent,x,y,width,height)
to create a visual component
I do like this idea removing the need for luaCom plugin will help a lot to keep plugins clean :)
BunnyHop CDD Obscurer Post | Home Page
Post Reply