Book a Demo

Author Topic: Generating code with attributed COM  (Read 2324 times)

ronid

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Generating code with attributed COM
« on: March 08, 2007, 04:25:46 am »
Hi,

I am using attributed COM. This means that before my interfaces and classes I have the following code:


[
object,
uuid("76713711-15B4-4AA9-AAC5-73431671EBCA"),
helpstring("IFoo Interface"),
pointer_default(unique)
]
__interface IFoo : IUnknown
{
}

or

[
coclass,
threading("both"),
support_error_info("IFoo"),
event_source("com"),
vi_progid("Foo.CFoo"),
progid("Foo.CFoo.1"),
version(1.0),
uuid("1FC9DD93-B7D4-4B5E-A649-CE6AE15FFC5B"),
helpstring("CFoo Class")
]
class ATL_NO_VTABLE CFoo:
public IFoo
{

};


When converting from code to EA the converstion is OK, but when updating the model and then generate the code the attribute part gets deleted. I can't use the code generation templates since I need to create the code with a special GUID (i.e. a unique key).

Any suggestions?

Thanks,
Roni.

ronid

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Generating code with attributed COM
« Reply #1 on: March 08, 2007, 09:42:55 am »
Hi again,

I have managed to progress a little bit. I defined the following in the transformation templates for class declaration:

%elseIf classStereotype=="coclass"%
[\n

coclass, \n

threading("both"),\n

support_error_info("ICimE30"),\n

aggregatable("never"),\n

vi_progid("SECSGemDriver.CimE30"),\n

progid("SECSGemDriver.CimE30.1"),\n

version(1.0),\n

uuid(%classGUID%),\n

helpstring("CimE30 Class")\n
]\n

Now I have 2 problems:

1. The uuid(%classGUID%) gives me the following:
uuid({DBE4CA33-8B67-432a-83D9-DBDF107F4A4B})
but what I need is
uuid("DBE4CA33-8B67-432a-83D9-DBDF107F4A4B").

2. Once problem 1 solved, I am ok with generating new COM objects from the model. But what happen if the class were add to the model from the code, then I modify from the model and I want to stick with the original GUID.

Thanks,
Roni