1QAxAggregated(3qt) QAxAggregated(3qt)
2
3
4
6 QAxAggregated - Abstract base class for implementations of additional
7 COM interfaces
8
10 This class is part of the Qt ActiveQt Extension.
11
12 #include <qaxbindable.h>
13
14 Public Members
15 virtual long queryInterface ( const QUuid & iid, void ** iface ) = 0
16
17 Protected Members
18 IUnknown * controllingUnknown () const
19 QWidget * widget () const
20 QObject * object () const
21
23 This class is defined in the Qt ActiveQt Extension, which can be found
24 in the qt/extensions directory. It is not included in the main Qt API.
25
26 The QAxAggregated class is an abstract base class for implementations
27 of additional COM interfaces.
28
29 Create a subclass of QAxAggregated and reimplement queryInterface() to
30 support additional COM interfaces. Use multiple inheritance from those
31 COM interfaces. Implement the IUnknown interface of those COM
32 interfaces by delegating the calls to QueryInterface(), AddRef() and
33 Release() to the interface provided by controllingUnknown().
34
35 Use the widget() method if you need to make calls to the QWidget
36 implementing the ActiveX control. You must not store that pointer in
37 your subclass (unless you use QGuardedPtr), as the QWidget can be
38 destroyed by the ActiveQt framework at any time.
39
42 Returns the IUnknown interface of the ActiveX control. Implement the
43 IUnknown interface in your QAxAggregated subclass to delegate calls to
44 QueryInterface(), AddRef() and Release() to the interface provided by
45 this function.
46
47 HRESULT AxImpl::QueryInterface( REFIID iid, void **iface )
48 {
49 return controllingUnknown()->QueryInterface( iid, iface );
50 }
51 unsigned long AxImpl::AddRef()
52 {
53 return controllingUnknown()->AddRef();
54 }
55 unsigned long AxImpl::Release()
56 {
57 return controllingUnknown()->Release();
58 }
59
60 The QAXAGG_IUNKNOWN macro expands to the code above, and you can use it
61 in the class declaration of your subclass.
62
64 Returns a pointer to the QObject subclass implementing the COM object.
65 This function might return 0.
66
67 Warning: You must not store the returned pointer, unless you use a
68 QGuardedPtr, since the QObject can be destroyed by ActiveQt at any
69 time.
70
72 virtual]
73 Reimplement this pure virtual function to support additional COM
74 interfaces. Set the value of iface to point to this object to support
75 the interface iid. Note that you must cast the this pointer to the
76 appropriate superclass.
77
78 long AxImpl::queryInterface( const QUuid &iid, void **iface )
79 {
80 *iface = 0;
81 if ( iid == IID_ISomeCOMInterface )
82 *iface = (ISomeCOMInterface*)this;
83 else
84 return E_NOINTERFACE;
85 AddRef();
86 return S_OK;
87 }
88
89 Return the standard COM results S_OK (interface is supported) or
90 E_NOINTERFACE (requested interface is not supported).
91
92 Warning: Even though you must implement the IUnknown interface if you
93 implement any COM interface you must not support the IUnknown interface
94 in your queryInterface() implementation.
95
97 Returns a pointer to the QWidget subclass implementing the ActiveX
98 control. This function might return 0.
99
100 Warning: You must not store the returned pointer, unless you use a
101 QGuardedPtr, since the QWidget can be destroyed by ActiveQt at any
102 time.
103
104
106 http://doc.trolltech.com/qaxaggregated.html
107 http://www.trolltech.com/faq/tech.html
108
110 Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
111 license file included in the distribution for a complete license
112 statement.
113
115 Generated automatically from the source code.
116
118 If you find a bug in Qt, please report it as described in
119 http://doc.trolltech.com/bughowto.html. Good bug reports help us to
120 help you. Thank you.
121
122 The definitive Qt documentation is provided in HTML format; it is
123 located at $QTDIR/doc/html and can be read using Qt Assistant or with a
124 web browser. This man page is provided as a convenience for those users
125 who prefer man pages, although this format is not officially supported
126 by Trolltech.
127
128 If you find errors in this manual page, please report them to qt-
129 bugs@trolltech.com. Please include the name of the manual page
130 (qaxaggregated.3qt) and the Qt version (3.3.8).
131
132
133
134Trolltech AS 2 February 2007 QAxAggregated(3qt)