рефераты конспекты курсовые дипломные лекции шпоры

Реферат Курсовая Конспект

ADDR IID_SomeOtherInterface, ADDR ppv_new

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.

 

;---------------------------------------------------------------------

– Конец работы –

Эта тема принадлежит разделу:

Accessing COM Objects from Assembly

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

Что будем делать с полученным материалом:

Если этот материал оказался полезным ля Вас, Вы можете сохранить его на свою страничку в социальных сетях:

Все темы данного раздела:

Accessing COM Objects from Assembly
  Ernest Murphy ernie@surfree.com   Revised Dec 26 2000 for inclusion as part of MASM32 Revised July 10 2000 for the new form of coinvoke. &nb

IUnknown ENDS
  That's it, just 12 bytes long. It holds 3 DWORD pointers to the procedures that actually implement the methods. It is the infamous "vtable" you may have heard of. The poin

AddRef_Pointer typedef PROTO :DWORD Release_Pointer typedef PROTO :DWORD
  In keeping with the MASM32 practice of "loose" type checking, function parameters are just defined as DWORDs. Lots of work to set things up, but it does keeps lots of erro

ADDR ppnew
  Note that now the name decoration is done for us by the macro.   The only 'gotcha' (well, the most obvious) is that no parameters to a COM call should be pass

Хотите получать на электронную почту самые свежие новости?
Education Insider Sample
Подпишитесь на Нашу рассылку
Наша политика приватности обеспечивает 100% безопасность и анонимность Ваших E-Mail
Реклама
Соответствующий теме материал
  • Похожее
  • Популярное
  • Облако тегов
  • Здесь
  • Временно
  • Пусто
Теги