root/swishctl/src/SwishCtl.cpp

Revision 1254, 3.1 kB (checked in by augur, 5 years ago)

Updated SwishCtl? ActiveX Control to link to the new libswish-e-mt multithreaded search library.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1 /*
2
3  * $Id$
4
5  *
6
7  * SwishCtl - SWISH-E API ActiveX Control
8
9  * Copyright (c) 2003 Peoples Resource Centre Wellington NZ
10
11  *
12
13  * This program is free software; you can redistribute it and/or modify
14
15  * it under the terms of the GNU General Public License as published by
16
17  * the Free Software Foundation; either version 2 of the License, or
18
19  * (at your option) any later version.
20
21  *
22
23  * This program is distributed in the hope that it will be useful,
24
25  * but WITHOUT ANY WARRANTY; without even the implied warranty of
26
27  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
28
29  * GNU General Public License for more details.
30
31  *
32
33  * You should have received a copy of the GNU General Public License
34
35  * along with this program; if not, write to the Free Software
36
37  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
38
39  */
40
41
42
43 // SwishCtl.cpp : Implementation of DLL Exports.
44
45
46
47
48
49 // Note: Proxy/Stub Information
50
51 //      To build a separate proxy/stub DLL,
52
53 //      run nmake -f SwishCtlps.mk in the project directory.
54
55
56
57 #include "stdafx.h"
58
59 #include "resource.h"
60
61 #include <initguid.h>
62
63 #include "SwishCtl.h"
64
65
66
67 #include "SwishCtl_i.c"
68
69 #include "swish-e.h"
70
71
72
73 #include "CSwishCtl.h"
74
75
76
77 CComModule _Module;
78
79
80
81 BEGIN_OBJECT_MAP(ObjectMap)
82
83 OBJECT_ENTRY(CLSID_CSwishCtl, CCSwishCtl)
84
85 END_OBJECT_MAP()
86
87
88
89
90
91 bool GetModulePath(char filename[ _MAX_PATH ])
92
93 {
94
95                
96
97         DWORD result = GetModuleFileName( _Module.m_hInst, filename,  _MAX_PATH );
98
99         if ( result > 0 ) {
100
101                 char drive [_MAX_DIR ];
102
103                 char dir [_MAX_PATH ]; 
104
105                 _splitpath( filename, drive, dir, NULL, NULL);
106
107                 _makepath( filename, drive, dir, NULL, NULL );
108
109                 return true;
110
111         }
112
113         return false;
114
115 }
116
117
118
119 /////////////////////////////////////////////////////////////////////////////
120
121 // DLL Entry Point
122
123
124
125 extern "C"
126
127 BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
128
129 {
130
131     if (dwReason == DLL_PROCESS_ATTACH)
132
133     {
134
135         _Module.Init(ObjectMap, hInstance, &LIBID_SWISHCTLLib);
136
137         DisableThreadLibraryCalls(hInstance);
138
139     }
140
141     else if (dwReason == DLL_PROCESS_DETACH)
142
143         _Module.Term();
144
145     return TRUE;    // ok
146
147 }
148
149
150
151 /////////////////////////////////////////////////////////////////////////////
152
153 // Used to determine whether the DLL can be unloaded by OLE
154
155
156
157 STDAPI DllCanUnloadNow(void)
158
159 {
160
161     return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
162
163 }
164
165
166
167 /////////////////////////////////////////////////////////////////////////////
168
169 // Returns a class factory to create an object of the requested type
170
171
172
173 STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
174
175 {
176
177     return _Module.GetClassObject(rclsid, riid, ppv);
178
179 }
180
181
182
183 /////////////////////////////////////////////////////////////////////////////
184
185 // DllRegisterServer - Adds entries to the system registry
186
187
188
189 STDAPI DllRegisterServer(void)
190
191 {
192
193     // registers object, typelib and all interfaces in typelib
194
195
196
197     return _Module.RegisterServer(TRUE);
198
199 }
200
201
202
203 /////////////////////////////////////////////////////////////////////////////
204
205 // DllUnregisterServer - Removes entries from the system registry
206
207
208
209 STDAPI DllUnregisterServer(void)
210
211 {
212
213     return _Module.UnregisterServer(TRUE);
214
215 }
216
217
218
219
220
Note: See TracBrowser for help on using the browser.