DgDrDemo
所属分类:界面编程
开发工具:C/C++
文件大小:17KB
下载次数:85
上传日期:2006-07-24 19:31:53
上 传 者:
lau_jia
说明: A proposal for creating COM interfaces with lcc-win32 with an extended structure holding the interface vtable and the required variables for one instance of the COM interface.
Demo for Drag and Drop.
(A proposal for creating COM interfaces wit h LCC- win32 with an extended structure holding the interface vtable and the required variable s for one instance of the COM interface. Demo for Drag and Drop.)
文件列表:
DragDropDemo.c (4861, 2003-01-30)
dragdropdemo.rc (796, 2003-01-25)
DragDropDemores.h (176, 2003-01-25)
icon.ico (766, 1996-11-26)
IDataObject.c (6142, 2003-01-24)
IDragDrop.h (6197, 2003-01-24)
IDropSource.c (2851, 2003-01-24)
IEnumFORMATETC.c (4240, 2003-01-24)
lcc (0, 2003-01-30)
lcc\dgdrdemo.exe (11808, 2003-01-30)
lcc\Makefile (1774, 2003-01-30)
OleDragDrop.c (5736, 2003-01-30)
A proposal for creating COM interfaces with lcc-win32
with an extended structure holding the interface vtable
and the required variables for one instance of the
COM interface.
The idea is to have as much similarity to CPP COM
classes as possible because 99% of examples are
CPP, especially MS code and, using COM will become
very important in the future. Also some interfaces
(an example is IEnumFORMATETC) requires clone-ing
which creates problems with variables attached to
the interface when using the usual vtable method.
[History:] I wanted to implement dragging files onto
the Desktop/Explorer - the only examples found were CPP.
An example of an interface that needs clone-ing is
CEnumFormatEtc. A CPP Class that implements the
IEnumFORMATETC COM interface and it has these
vars as private class members -
DWORD m_cRefCount;
LPFORMATETC m_pStrFE;
ULONG m_iCur;
ULONG m_cItems;
With this proposed way one can also access the interface
function (methods) without using the vtable pointer by
casting a pointer to the struct that's used to hold the
interface and vars - which might be convenient sometimes!
Example: create the interface struct so that the vtable is
the first part of the struct and the variables are
the second part.
// create the interface
IDropSource * pDropSource = DropSource_CDropSource();
This pDropSource points to a struct that has the vtable
but also has variables which can be accessed by casting
the pDropSource pointer to a pointer to DropSourceEx.
DropSourceEx * pDSEx = (DropSourceEx *) pDropSource;
pDSEx->Release(pDropSource);
One can also of course use the normal way of accessing
the vtable functions which any other COM service will
use.
pDropSource->lpVtbl->Release(pDropSource);
The zip file contains four other files, IDataObject.c,
IDropSource.c, IEnumFormatEtc.c and IDragDrop.h which
are sufficient for implementing dragging onto/into
Explorer folders like the desktop.
John
近期下载者:
相关文件:
收藏者: