Реферат Курсовая Конспект
ADDR IID_SomeOtherInterface, ADDR ppv_new - раздел Образование, Accessing COM Objects from Assembly I Hope You Find This As Wonderfully Simple As I Do. ...
|
I hope you find this as wonderfully simple as I do.
Note we must pass in the pointer we used, this lets the interface know which object (literally "this" object) we are using.
Note the register must be type cast (IUnknown PTR [edx]). This lets the compiler know what structure to use to get the correct offset in the vtable for the .QueryInterface function (in this case it means an offset of zero from [edx]). Actually, the information contained by the interface name and function name called disappear at compile time, all that is left is a numeric offset from an as of yet value unspecified pointer.
One more semi-obscure point. Notice I changed the interface method name from simply "QueryInterface" to "IUnknown_QueryInterface". This is a bit of name decoration I've found necessary. When you get to larger COM projects with many similar interfaces you will run into a problem, that is different interfaces with identical method names. This is quite valid, in fact it's called polymorphism, but can confuse the compiler a bit.
Without this name decoration scheme things will be safe until you have two different interfaces with identical method names but different parameters to that method. This is more common then you might first think, but just consider how many interfaces might have a PRINT method.
The coinvoke Macro
--------------------------------------------------------------------------------------------------------------------
We can simplify a COM invoke further with a macro. This coinvoke macro is part of the oaidl.inc file.
;---------------------------------------------------------------------
– Конец работы –
Эта тема принадлежит разделу:
IUnknown methods IUnknown QueryInterface QueryInterface Pointer IUnknown AddRef AddRef Pointer IUnknown Release Release Pointer... AddRef Pointer typedef ptr AddRef Proto Release Pointer typedef ptr...
Если Вам нужно дополнительный материал на эту тему, или Вы не нашли то, что искали, рекомендуем воспользоваться поиском по нашей базе работ: ADDR IID_SomeOtherInterface, ADDR ppv_new
Если этот материал оказался полезным ля Вас, Вы можете сохранить его на свою страничку в социальных сетях:
Твитнуть |
Новости и инфо для студентов