The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: averpix on April 11, 2007, 04:46:31 PM

Title: COM Question
Post by: averpix on April 11, 2007, 04:46:31 PM
Hi Experts,
I'm a beginner in Assembly (I used to code in Delphi). I need to code a program to access COM/DCOM objects specifically to access OPC server - OLE for Process Control - (http://www.opcconnect.com) but I coudn't find a way to start. Can somebody help me?

regards,

AverPix
Title: Re: COM Question
Post by: ToutEnMasm on April 11, 2007, 05:05:43 PM
Hello,
Com are easy to use when you have a header file and the name of the API to connect it.
A sample in C can be useful also , C is very closer with asm.
                                                 ToutEnMasm

Title: Re: COM Question
Post by: averpix on April 11, 2007, 05:28:56 PM
@ToutEnMasm, thanks for you quick reply.
I see. I have to declare the interface along with all methods contained, is that right?
My next question are:
how to declare interface (and the methods)?
and
how to instantiate the interface?
In Delphi we might write: obj:= CreateComObject(some GUID);
Is There any docs/tutorial to use COM with MASM?
Thanks a lot,

regards,

AverPix
Title: Re: COM Question
Post by: Biterider on April 11, 2007, 05:51:09 PM
Hi
Use ObjAsm32, it has full support for COM clients and servers.
To experiment with the interfaces you want use, I recommend Japheth's COMView.

Regards,

Biterider

Title: Re: COM Question
Post by: averpix on April 11, 2007, 05:57:53 PM
Hi BiteRider, thank you,
I'll check this ObjAsm. I really need this stuff because of heavily use of COM in OPC.

regards,

AverPix
Title: Re: COM Question
Post by: ToutEnMasm on April 11, 2007, 06:25:18 PM
Hello,
First you have to know the name of the interface you want to use.
This name give you the API you have to call (search winhelp , the SDK or MSDN).
Translate the header with the translator in the windows.inc subforum.
The translation give you all the usable methods.
The translator give you a macro with the name of the interface.
Used this macro instead of invoke and you can use the methods of the interface exactly as it was an API.
                            ToutEnMasm

                                             
Title: Re: COM Question
Post by: averpix on April 11, 2007, 06:49:30 PM
@ToutEnMasm: Thank You,
I've downloaded the translator, I'll give a try...

ragards,

AverPix
Title: Re: COM Question
Post by: Biterider on April 11, 2007, 08:48:27 PM
Hi
The first thing you need to do is to get the definitions of at least the following interfaces:
Some other interfaces are also needed, but you can find their definitions in the OA32 COM folder.
Once you got this information, follow the examples to create the IOPCServer COM-Object.

Regards,

Biterider
Title: Re: COM Question
Post by: averpix on April 11, 2007, 09:15:19 PM
WOW! what a response, thank you Biterider,
I'm currently studying the OA32 docs and looking the Iczelion examples.
It's very interesting, just like coding in HLL.

Regards,

AverPix
Title: Re: COM Question
Post by: averpix on April 12, 2007, 12:45:59 AM
Okay,
I have now two different approach to code COM app, thanks to both of You, Biteride + ToutEnMasm. However I should read and try what you guys told me.
Please don't get bored if I ask more question about this.
Thank you,

regards,

AverPix
Title: Re: COM Question
Post by: ToutEnMasm on April 12, 2007, 03:33:20 PM
Hello,
a link where to start
http://www.win-tech.com/html/opcstk.htm
                                         ToutEnMasm

Title: Re: COM Question
Post by: averpix on April 12, 2007, 04:29:09 PM
Thank You TooutEnMasm,
It's a new OPC link to me. But however, I've been quite success implementing both OPC Server/Client in Delphi/VB, I released some data acquisition application for some plants in my area. Actually the problem is, I just wanna make Asm as my primary ProgLang besides Delphi, so I try to create same type of application I've created in Delphi. I'm currently working on what You (@ToutEnMasm) and BiteRide told me.

Regards,

AverPix