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:
Mostrar la cita
know,
Mostrar la cita
some
Mostrar la cita
#2 Kim Gräsman
09/02/2004 - 12:21 | Informe spam
Andrew,

Mostrar la cita
existing
Mostrar la cita
that
Mostrar la cita
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
#3 Frank
11/02/2004 - 02:53 | Informe spam
Thanx Andrew :p

"Andrew Jarvis"
:
Mostrar la cita
existing
Mostrar la cita
that
Mostrar la cita
for
Mostrar la cita
NEW
Mostrar la cita
how
Mostrar la cita
Ads by Google
Search Busqueda sugerida