1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
---|
4 | ** All rights reserved.
|
---|
5 | ** Contact: Nokia Corporation ([email protected])
|
---|
6 | **
|
---|
7 | ** This file is part of the documentation of the Qt Toolkit.
|
---|
8 | **
|
---|
9 | ** $QT_BEGIN_LICENSE:LGPL$
|
---|
10 | ** Commercial Usage
|
---|
11 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
---|
12 | ** accordance with the Qt Commercial License Agreement provided with the
|
---|
13 | ** Software or, alternatively, in accordance with the terms contained in
|
---|
14 | ** a written agreement between you and Nokia.
|
---|
15 | **
|
---|
16 | ** GNU Lesser General Public License Usage
|
---|
17 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
---|
18 | ** General Public License version 2.1 as published by the Free Software
|
---|
19 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
---|
20 | ** packaging of this file. Please review the following information to
|
---|
21 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
---|
22 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
---|
23 | **
|
---|
24 | ** In addition, as a special exception, Nokia gives you certain additional
|
---|
25 | ** rights. These rights are described in the Nokia Qt LGPL Exception
|
---|
26 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
---|
27 | **
|
---|
28 | ** GNU General Public License Usage
|
---|
29 | ** Alternatively, this file may be used under the terms of the GNU
|
---|
30 | ** General Public License version 3.0 as published by the Free Software
|
---|
31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
32 | ** packaging of this file. Please review the following information to
|
---|
33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
---|
34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
---|
35 | **
|
---|
36 | ** If you have questions regarding the use of this file, please contact
|
---|
37 | ** Nokia at [email protected].
|
---|
38 | ** $QT_END_LICENSE$
|
---|
39 | **
|
---|
40 | ****************************************************************************/
|
---|
41 |
|
---|
42 | //! [0]
|
---|
43 | TEMPLATE = app
|
---|
44 | CONFIG += qaxserver
|
---|
45 |
|
---|
46 | RC_FILE = qaxserver.rc
|
---|
47 | ...
|
---|
48 | //! [0]
|
---|
49 |
|
---|
50 |
|
---|
51 | //! [1]
|
---|
52 | TEMPLATE = lib
|
---|
53 | CONFIG += qaxserver dll
|
---|
54 |
|
---|
55 | DEF_FILE = qaxserver.def
|
---|
56 | RC_FILE = qaxserver.rc
|
---|
57 | ...
|
---|
58 | //! [1]
|
---|
59 |
|
---|
60 |
|
---|
61 | //! [2]
|
---|
62 | TEMPLATE = lib
|
---|
63 | VERSION = 2.5
|
---|
64 | ...
|
---|
65 | //! [2]
|
---|
66 |
|
---|
67 |
|
---|
68 | //! [3]
|
---|
69 | #include <QWidget>
|
---|
70 |
|
---|
71 | class MyActiveX : public QWidget
|
---|
72 | {
|
---|
73 | Q_OBJECT
|
---|
74 | //! [3]
|
---|
75 |
|
---|
76 |
|
---|
77 | //! [4]
|
---|
78 | Q_CLASSINFO("ClassID", "{1D9928BD-4453-4bdd-903D-E525ED17FDE5}")
|
---|
79 | Q_CLASSINFO("InterfaceID", "{99F6860E-2C5A-42ec-87F2-43396F4BE389}")
|
---|
80 | Q_CLASSINFO("EventsID", "{0A3E9F27-E4F1-45bb-9E47-63099BCCD0E3}")
|
---|
81 | //! [4]
|
---|
82 |
|
---|
83 |
|
---|
84 | //! [5]
|
---|
85 | Q_PROPERTY(int value READ value WRITE setValue)
|
---|
86 | //! [5]
|
---|
87 |
|
---|
88 |
|
---|
89 | //! [6]
|
---|
90 | public:
|
---|
91 | MyActiveX(QWidget *parent = 0)
|
---|
92 | ...
|
---|
93 |
|
---|
94 | int value() const;
|
---|
95 |
|
---|
96 | public slots:
|
---|
97 | void setValue(int v);
|
---|
98 | ...
|
---|
99 |
|
---|
100 | signals:
|
---|
101 | void valueChange(int v);
|
---|
102 | ...
|
---|
103 |
|
---|
104 | };
|
---|
105 | //! [6]
|
---|
106 |
|
---|
107 |
|
---|
108 | //! [7]
|
---|
109 | #include <QAxBindable>
|
---|
110 | #include <QWidget>
|
---|
111 |
|
---|
112 | class MyActiveX : public QWidget, public QAxBindable
|
---|
113 | {
|
---|
114 | Q_OBJECT
|
---|
115 | //! [7]
|
---|
116 |
|
---|
117 |
|
---|
118 | //! [8]
|
---|
119 | QAXFACTORY_BEGIN("{ad90301a-849e-4e8b-9a91-0a6dc5f6461f}",
|
---|
120 | "{a8f21901-7ff7-4f6a-b939-789620c03d83}")
|
---|
121 | QAXCLASS(MyWidget)
|
---|
122 | QAXCLASS(MyWidget2)
|
---|
123 | QAXTYPE(MySubType)
|
---|
124 | QAXFACTORY_END()
|
---|
125 | //! [8]
|
---|
126 |
|
---|
127 |
|
---|
128 | //! [9]
|
---|
129 | #include <QApplication>
|
---|
130 | #include <QAxFactory>
|
---|
131 |
|
---|
132 | int main(int argc, char *argv[])
|
---|
133 | {
|
---|
134 | QApplication app(argc, argv);
|
---|
135 | if (!QAxFactory::isServer()) {
|
---|
136 | // create and show main window
|
---|
137 | }
|
---|
138 | return app.exec();
|
---|
139 | }
|
---|
140 | //! [9]
|
---|
141 |
|
---|
142 |
|
---|
143 | //! [10]
|
---|
144 | MyFactory(const QUuid &, const QUuid &);
|
---|
145 | //! [10]
|
---|
146 |
|
---|
147 |
|
---|
148 | //! [11]
|
---|
149 | HMODULE dll = LoadLibrary("myserver.dll");
|
---|
150 | typedef HRESULT(__stdcall *DllRegisterServerProc)();
|
---|
151 | DllRegisterServerProc DllRegisterServer =
|
---|
152 | (DllRegisterServerProc)GetProcAddress(dll, "DllRegisterServer");
|
---|
153 |
|
---|
154 | HRESULT res = E_FAIL;
|
---|
155 | if (DllRegisterServer)
|
---|
156 | res = DllRegisterServer();
|
---|
157 | if (res != S_OK)
|
---|
158 | // error handling
|
---|
159 | //! [11]
|
---|
160 |
|
---|
161 |
|
---|
162 | //! [12]
|
---|
163 | cabarc N simpleax.cab simpleax.exe simple.inf
|
---|
164 | //! [12]
|
---|
165 |
|
---|
166 |
|
---|
167 | //! [13]
|
---|
168 | <object ID="MyActiveX1" CLASSID="CLSID:ad90301a-849e-4e8b-9a91-0a6dc5f6461f">
|
---|
169 | ...
|
---|
170 | <\object>
|
---|
171 | //! [13]
|
---|
172 |
|
---|
173 |
|
---|
174 | //! [14]
|
---|
175 | <object ID=...>
|
---|
176 | <param name="name" value="value">
|
---|
177 | <\object>
|
---|
178 | //! [14]
|
---|
179 |
|
---|
180 |
|
---|
181 | //! [15]
|
---|
182 | class MyActiveX : public QWidget
|
---|
183 | {
|
---|
184 | Q_OBJECT
|
---|
185 | Q_CLASSINFO("Version", "2.0")
|
---|
186 | Q_CLASSINFO("ClassID", "{7a4cffd8-cbcd-4ae9-ae7e-343e1e5710df}")
|
---|
187 | Q_CLASSINFO("InterfaceID", "{6fb035bf-8019-48d8-be51-ef05427d8994}")
|
---|
188 | Q_CLASSINFO("EventsID", "{c42fffdf-6557-47c9-817a-2da2228bc29c}")
|
---|
189 | Q_CLASSINFO("Insertable", "yes")
|
---|
190 | Q_CLASSINFO("ToSuperClass", "MyActiveX")
|
---|
191 | Q_PROPERTY(...)
|
---|
192 |
|
---|
193 | public:
|
---|
194 | MyActiveX(QWidget *parent = 0);
|
---|
195 |
|
---|
196 | ...
|
---|
197 | };
|
---|
198 | //! [15]
|
---|
199 |
|
---|
200 |
|
---|
201 | //! [16]
|
---|
202 | class MyLicensedControl : public QWidget
|
---|
203 | {
|
---|
204 | Q_OBJECT
|
---|
205 | Q_CLASSINFO("LicenseKey", "<key string>")
|
---|
206 | ...
|
---|
207 | };
|
---|
|
---|