Question for add new interface?

09/02/2004 - 05:12 por Frank | Informe spam
hi,there

For some reason, I used ATL object wizard created a simple object, you know,
it created a default interface of that object. And then, I wanna add a NEW
INTERFACE into that simple object created without type library, NEW
INTERFACE means a real new interface, which has not IID and any type
library. I dont know how to add a new interface into my simple object, how
to create a IID associated with that interface and...
As you see, I am a perfect beginner. Tell me how you do that or give me some
tricks or suggestions.

Any reply is appreciated :p

Frank F.Han

+--+
| winsays@:-)hotmail:-).com |
+--+

Preguntas similare

Leer las respuestas

#1 Andrew Jarvis
09/02/2004 - 12:08 | Informe spam
IDL file
=
The easiest way is to copy the wizard generated interface and rename it.

Create a new uuid by incrementing the eight digit hex number in the existing
uuid. If you run guidgen.exe and keep clicking 'New GUID' you will see that
it does just that.

Find the coclass declaration and add your new interface, omitting the
[default] specifier as you can't have two defaults.

Class header file
=If you are using custom interfaces then simply derive the class from your
interface and add a COM_INTERFACE_ENTRY for it.

If you are using dual interfaces, copy and modify the IDispatchImpl line for
the default interface, and add a COM_INTERFACE_ENTRY for it.

You will also need to change the line
COM_INTERFACE_ENTRY(IDispatch)
to
COM_INTERFACE_ENTRY2(IDispatch, xxx)
where xxx is the name of the default interface.

I think that's covered everything.

AJ


"Frank" wrote in message
news:
hi,there

For some reason, I used ATL object wizard created a simple object, you


know,
it created a default interface of that object. And then, I wanna add a NEW
INTERFACE into that simple object created without type library, NEW
INTERFACE means a real new interface, which has not IID and any type
library. I dont know how to add a new interface into my simple object, how
to create a IID associated with that interface and...
As you see, I am a perfect beginner. Tell me how you do that or give me


some
tricks or suggestions.

Any reply is appreciated :p

Frank F.Han

+--+
| winsays@:-)hotmail:-).com |
+--+


Respuesta Responder a este mensaje
#2 Kim Gräsman
09/02/2004 - 12:21 | Informe spam
Andrew,

Create a new uuid by incrementing the eight digit hex number in the


existing
uuid. If you run guidgen.exe and keep clicking 'New GUID' you will see


that
it does just that.



This is a bad idea, IMH(and not so informed)O. I believe the GUID generation
algorithm changed in Windows 2000 (or some SP of NT4) to use a less
predictable algorithm.

Apparently, to save from duplicates, this was reflected in a version bit
inside the GUID [1].
Depending on what algorithm was used by the IDE to generate the GUID you're
cutting and pasting from, what you're doing can be disastrous.

So, I'd always use guidgen.exe to generate GUIDs, even if the results appear
to be the same.

[1] http://blogs.msdn.com/adam_nathan/a...56779.aspx

Best regards,
Kim Gràsman
Respuesta Responder a este mensaje
#3 Frank
11/02/2004 - 02:53 | Informe spam
Thanx Andrew :p

"Andrew Jarvis"
:
IDL file
=>
The easiest way is to copy the wizard generated interface and rename it.

Create a new uuid by incrementing the eight digit hex number in the


existing
uuid. If you run guidgen.exe and keep clicking 'New GUID' you will see


that
it does just that.

Find the coclass declaration and add your new interface, omitting the
[default] specifier as you can't have two defaults.

Class header file
=> If you are using custom interfaces then simply derive the class from your
interface and add a COM_INTERFACE_ENTRY for it.

If you are using dual interfaces, copy and modify the IDispatchImpl line


for
the default interface, and add a COM_INTERFACE_ENTRY for it.

You will also need to change the line
COM_INTERFACE_ENTRY(IDispatch)
to
COM_INTERFACE_ENTRY2(IDispatch, xxx)
where xxx is the name of the default interface.

I think that's covered everything.

AJ


"Frank" wrote in message
news:
> hi,there
>
> For some reason, I used ATL object wizard created a simple object, you
know,
> it created a default interface of that object. And then, I wanna add a


NEW
> INTERFACE into that simple object created without type library, NEW
> INTERFACE means a real new interface, which has not IID and any type
> library. I dont know how to add a new interface into my simple object,


how
> to create a IID associated with that interface and...
> As you see, I am a perfect beginner. Tell me how you do that or give me
some
> tricks or suggestions.
>
> Any reply is appreciated :p
>
> Frank F.Han
>
> +--+
> | winsays@:-)hotmail:-).com |
> +--+
>
>


email Siga el debate Respuesta Responder a este mensaje
Ads by Google
Help Hacer una preguntaRespuesta Tengo una respuesta
Search Busqueda sugerida