Coclass MyCom - раздел Образование, Creating a COM object in ASM {
[Default] Interface Imycom;
...
{
[default] interface IMyCom;
};
};
This file can be used as a prototype for further interface definitions. Notice it contains 3 GUIDs, one each for the Interface, the coclass, and the type library. These MUST be changed and distinct for new applications.
This definition file should look pretty well self-explanatory, except for the interface itself:
[propget, helpstring("property Value")] HRESULT Value([out, retval] long *pVal); [propput, helpstring("property Value")] HRESULT Value([in] long newVal); [helpstring("method Raise")] HRESULT Raise(long Value);
aggregate REFIID riid... Reference to the interface identifier... Oid ppvObject Address of output variable that receives...
Если Вам нужно дополнительный материал на эту тему, или Вы не нашли то, что искали, рекомендуем воспользоваться поиском по нашей базе работ:
Coclass MyCom
Что будем делать с полученным материалом:
Если этот материал оказался полезным ля Вас, Вы можете сохранить его на свою страничку в социальных сетях:
Increments or decrements the lock count
LockServer keeps the class factory instanced (helpful if one has to make numerous object copies). CreateInstance is the workhorse here, it is used to creates the object's "work
MyComObject ENDS
The first point is I have great latitude in defining this structure. The only element that the COM contract imposes on it is that it contain a DWORD pointer to the vtable of functio
RaiseValue PROTO :DWORD, :DWORD
BIG difference... but for a simple reason. Interfaces written for type libraries are as general as can be, and are directed at clients such as Visual Basic, and VB is designed to ho
Typelib MyCom.tlb
Making it the first resource element is important, as later on we will be using the LoadTypeLib API function to extract this library, and this function expects to find the library a
AddRef_MC endp
AddRef is a bit unusual in that it does not return a HRESULT (failure code), instead it returns the object count. The return value is undefined in the COM contract, but it is tradit
RaiseValue ENDP
MyCom.dll, the server code
---------------------------------------------------------------------------------------------------------------------To build the
End Sub
Now you can run the application and test the server by clicking the Raise button. Do be careful, there is no error checking to see if you put a valid number in Text2. What you are s
Хотите получать на электронную почту самые свежие новости?
Подпишитесь на Нашу рассылку
Наша политика приватности обеспечивает 100% безопасность и анонимность Ваших E-Mail
Новости и инфо для студентов