OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
module.h
Go to the documentation of this file.
1//----------------------------------------------------------------------------
2// ObjectWindows
3// Copyright (c) 1991, 1996 by Borland International, All Rights Reserved
4//
5/// \file
6/// Definition of class TModule. TModule defines the basic behavior for OWL
7/// libraries and applications.
8//----------------------------------------------------------------------------
9
10#if !defined(OWL_MODULE_H)
11#define OWL_MODULE_H
12
13#include <owl/private/defs.h>
14#if defined(BI_HAS_PRAGMA_ONCE)
15# pragma once
16#endif
17
18#include <owl/defs.h>
19#include <owl/objstrm.h>
20#include <owl/except.h>
21#include <owl/pointer.h>
22#include <owl/lclstrng.h>
23#include <owl/private/gmodule.h>
24#include <owl/wsyscls.h>
25#include <Unknwnbase.h>
26
27namespace owl {
28
29#include <owl/preclass.h>
30
31class _OWLCLASS TWindow;
32class _OWLCLASS TDialog;
33class _OWLCLASS TXInvalidModule;
34class _OWLCLASS TXModuleVersionInfo; // [VH 2005-04-03]
35
36/// \addtogroup module
37/// @{
38
39//
40/// Type-safe encapsulation of a Windows class name, a union between ATOM and LPCTSTR.
41/// In Windows a registered window class name is represented by an LPCTSTR pointer, which may
42/// actually contain an atom, an integer key stored in the lower 16 bits of the LPCTSTR.
43/// http://msdn.microsoft.com/en-us/library/windows/desktop/ms633576.aspx
44/// \sa TModule::GetClassInfo, TWindow::GetWindowClassName
45//
47{
48public:
49
50 explicit TWindowClassName(ATOM a) : Representation{static_cast<UINT_PTR>(a)} {}
51 explicit TWindowClassName(LPCTSTR s) : Representation{reinterpret_cast<UINT_PTR>(s)} {}
52
53 auto GetPointerRepresentation() const -> LPCTSTR {return reinterpret_cast<LPCTSTR>(Representation);}
54 auto IsString() const -> bool {return (Representation >> 16) != 0;}
55 auto IsAtom() const -> bool {return !IsString();}
56 auto GetString() const -> tstring;
57 auto GetAtom() const -> ATOM {PRECONDITION(IsAtom()); return static_cast<ATOM>(Representation);}
58
59private:
60
61 UINT_PTR Representation;
62};
63
64//
65/// Acts as an object-oriented stand-in for an application or library (DLL) module.
66/// TModule defines behavior shared by both library and application modules. ObjectWindows
67/// \class TModule
68// ~~~~~ ~~~~~~~
69/// ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule,
70/// which acts as an object-oriented stand-in for the library (DLL) module. TModule
71/// defines behavior shared by both library and application modules. ObjectWindows
72/// applications construct an instance of TApplication, derived from TModule.
73/// TModule's constructors manage loading and freeing of external DLLs, and the
74/// member functions provide support for default error handling.
76 public:
77 // Class scoped types
78 //
79 typedef HINSTANCE THandle; ///< TModule encapsulates an HINSTANCE
80
81 // Constructors & destructor
82 //
83 explicit TModule(const tstring& name, bool shouldLoad = true, bool mustLoad = true, bool addToList=true);
84 explicit TModule(LPCTSTR name, THandle handle, bool addToList = true);
85 explicit TModule(const tstring& name, THandle handle, bool addToList=true);
86 explicit TModule(LPCTSTR name, THandle handle, const tstring& cmdLine, bool addToList = true);
87 explicit TModule(const tstring& name, THandle handle, const tstring& cmdLine, bool addToList=true);
88 virtual ~TModule();
89
90 /// Finish-up initialization of a module
91 //
92 void InitModule(THandle handle, const tstring& cmdLine);
93
94 /// \name Get & set members. Use these instead of directly accessing members
95 /// @{
96 LPCTSTR GetName() const;
97 void SetName(LPCTSTR name);
98 void SetName(const tstring& name);
99
100 THandle GetHandle() const; // Get the module instance handle
101 operator THandle() const;
102 bool operator ==(const TModule& m) const;
103 bool IsLoaded() const;
104 /// @}
105
106 // Module wide error handler. Called when fatal exceptions are caught.
107 //
108 virtual int Error(TXBase& x, uint captionResId, uint promptResId=0);
109
110 /// \name Windows HINSTANCE/HMODULE related API functions encapsulated
111 /// @{
112 int GetModuleFileName(LPTSTR buff, int maxChars) const;
113 tstring GetModuleFileName() const;
114
115 FARPROC GetProcAddress(TNarrowResId) const;
116
117 HRSRC FindResource(TResId id, TResId type) const;
118 HRSRC FindResourceEx(TResId id, TResId type, TLangId langId=LangNeutral) const;
119 HGLOBAL LoadResource(HRSRC hRsrc) const;
120 uint32 SizeofResource(HRSRC hRsrc) const;
121
122 int LoadString(uint id, LPTSTR buf, int maxChars) const;
123 tstring LoadString(uint id) const;
124 HBITMAP LoadBitmap(TResId id) const;
125 HACCEL LoadAccelerators(TResId id) const;
126 HMENU LoadMenu(TResId id) const;
127 HCURSOR LoadCursor(TResId id) const;
128 HICON LoadIcon(TResId name) const;
129 std::string LoadHtml(TResId) const;
130
131 HICON CopyIcon(HICON hIcon) const;
132
133 auto GetClassInfo(TWindowClassName, WNDCLASS* wndclass) const -> bool;
134 auto GetClassInfo(TWindowClassName) const -> WNDCLASS;
135 auto IsRegisteredClass(TWindowClassName) const -> bool;
136 /// @}
137
138 //
139 /// \name Global search for resources
140 /// @{
141 static TModule* FindResModule(TResId id, TResId type);
142 static TModule* NextModule(TModule* module = nullptr);
143 /// @}
144
145 protected:
146 void SetHandle(THandle handle); ///< Set the module instance handle
147
149 tstring Name; ///< Name of the module
150 THandle Handle; ///< Module handle
151
152 private:
153 bool ShouldFree; ///< Should free the module when done?
154
155 // Hidden to prevent accidental copying or assignment
156 //
157 TModule(const TModule&);
158 TModule& operator =(const TModule&);
159
160 friend _OWLCFUNC(std::ostream&) operator <<(std::ostream& os, const TModule& m);
162};
163
165
166#include <owl/posclass.h>
167
168} // OWL namespace
169
170//
171// Bring in the system's version info header if not already included
172//
173namespace owl {
174
175#include <owl/preclass.h>
176
177//
178/// \class TModuleVersionInfo
179// ~~~~~ ~~~~~~~~~~~~~~~~~~
180/// TModuleVersionInfo provides access to a TModule's VERSIONINFO resource.
181//
183 public:
184 /// TFileOS values are returned by GetFileOS()
185 enum TFileOS { OSUnknown = VOS_UNKNOWN,
186 DOS = VOS_DOS,
187 OS216 = VOS_OS216,
188 OS232 = VOS_OS232,
189 NT = VOS_NT,
190 Windows16 = VOS__WINDOWS16,
191 PM16 = VOS__PM16,
192 PM32 = VOS__PM32,
193 Windows32 = VOS__WINDOWS32,
194 DosWindows16 = VOS_DOS_WINDOWS16,
195 DosWindows32 = VOS_DOS_WINDOWS32,
196 OS216PM16 = VOS_OS216_PM16,
197 OS232PM32 = VOS_OS232_PM32,
198 NTWindows32 = VOS_NT_WINDOWS32
199 };
200 /// TFileType is returned by GetFileType()
201 enum TFileType { TypeUnknown = VFT_UNKNOWN,
202 App = VFT_APP,
203 DLL = VFT_DLL,
204 DevDriver = VFT_DRV,
205 Font = VFT_FONT,
206 VirtDevice = VFT_VXD,
207 StaticLib = VFT_STATIC_LIB
208 };
209 /// TFileSubType values are returned by GetFileSubType() if GetFileType
210 // returned DevDriver or Font
211 enum TFileSubType { UnknownDevDriver, ///< VFT2_UNKNOWN
212 PtrDriver, ///< VFT2_DRV_PRINTER
213 KybdDriver, ///< VFT2_DRV_KEYBOARD
214 LangDriver, ///< VFT2_DRV_LANGUAGE
215 DisplayDriver, ///< VFT2_DRV_DISPLAY
216 MouseDriver, ///< VFT2_DRV_MOUSE
217 NtwkDriver, ///< VFT2_DRV_NETWORK
218 SysDriver, ///< VFT2_DRV_SYSTEM
219 InstallableDriver, ///< VFT2_DRV_INSTALLABLE
220 SoundDriver, ///< VFT2_DRV_SOUND
221 UnknownFont, ///< VFT2_UNKNOWN
222 RasterFont, ///< VFT2_FONT_RASTER
223 VectorFont, ///< VFT2_FONT_VECTOR
224 TrueTypeFont ///< VFT2_FONT_TRUETYPE
225 };
229
230 VS_FIXEDFILEINFO & GetFixedInfo();
231
232 uint32 GetSignature() const;
233 uint32 GetStrucVersion() const;
234 uint32 GetFileVersionMS() const;
235 uint32 GetFileVersionLS() const;
236 uint32 GetProductVersionMS() const;
237 uint32 GetProductVersionLS() const;
238 bool IsFileFlagSet(uint32 flag) const;
239 uint32 GetFileFlagsMask() const;
240 uint32 GetFileFlags() const;
241 bool IsDebug() const;
242 bool InfoInferred() const;
243 bool IsPatched() const;
244 bool IsPreRelease() const;
245 bool IsPrivateBuild() const;
246 bool IsSpecialBuild() const;
247 uint32 GetFileOS() const; ///< returns TFileOS values
248 TFileType GetFileType() const;
249 uint32 GetFileSubType() const;
250 FILETIME GetFileDate() const;
251
252 bool GetInfoString(LPCTSTR str, LPCTSTR& value, uint lang=0);
253
254 bool GetFileDescription(LPCTSTR& fileDesc, uint lang=0);
255 bool GetFileVersion(LPCTSTR& fileVersion, uint lang=0);
256 bool GetInternalName(LPCTSTR& internalName, uint lang=0);
257 bool GetLegalCopyright(LPCTSTR& copyright, uint lang=0);
258 bool GetOriginalFilename(LPCTSTR& originalFilename, uint lang=0);
259 bool GetProductName(LPCTSTR& prodName, uint lang=0);
260 bool GetProductVersion(LPCTSTR& prodVersion, uint lang=0);
261 bool GetSpecialBuild(LPCTSTR& debug, uint lang=0);
262
263 // String versions of the query functions. [VH 2005-04-03]
264 // These functions throw TXModuleVersionInfo on error.
265
266 tstring GetInfoString(const tstring& str, uint lang=0);
267
268 tstring GetFileDescription(uint lang=0);
269 tstring GetFileVersion(uint lang=0);
270 tstring GetInternalName(uint lang=0);
271 tstring GetLegalCopyright(uint lang=0);
272 tstring GetOriginalFilename(uint lang=0);
273 tstring GetProductName(uint lang=0);
274 tstring GetProductVersion(uint lang=0);
275 tstring GetSpecialBuild(uint lang=0);
276
277 uint GetLanguage() const;
278 tstring GetLanguageName() const;
279
280 static tstring GetLanguageName(uint language);
281
282 protected:
283 void Init(LPCTSTR modFName);
284
285 uint8 * Buff; ///< new'd File version info buffer
286 uint32 Lang; ///< Default language translation
287 VS_FIXEDFILEINFO * FixedInfo; ///< Fixed file info structure
288
289 private:
290 // Don't allow this object to be copied.
291 //
294};
295
296//
297/// \class TXInvalidModule
298// ~~~~~ ~~~~~~~~~~~~~~~
299/// A nested class, TXInvalidModule describes an exception that results from an
300/// invalid module. A window throws this exception if it can't create a valid
301/// TModule object.
303 public:
305
306 TXInvalidModule* Clone();
307 void Throw();
308
309 static void Raise(const tstring& name = tstring());
310};
311
312//
313/// Exception class for TModuleVersionInfo. [VH 2005-04-03]
314//
316 public:
318
319 TXModuleVersionInfo* Clone();
320 void Throw();
321
322 static void Raise(const tstring& name = tstring());
323};
324
325
326//
327//
328/// \class TSystemMessage
329//~~~~~~~~~~~~~~~~~~~~~
330//
332 public:
333 TSystemMessage(); ///< default errorId, def language
335
336 int MessageBox(TWindow* wnd, const tstring& msg, const tstring& title, uint flags = MB_OK) const;
337 const tstring& SysMessage() const;
338 uint32 SysError() const;
339
340 protected:
341 void Init(TLangId langId);
344};
345
346//
347/// \class TErrorMode
348// ~~~~~ ~~~~~~~~~~
349/// Simple encapsulation of the SetErrorMode call. Manages putting the error
350/// mode back to its previous state on destruction, thus is exception safe.
351//
353 public:
354 TErrorMode(uint mode);
355 ~TErrorMode();
356
357 private:
358 uint PrevMode;
359};
360
361#include <owl/posclass.h>
362
363} // OWL namespace
364
365//----------------------------------------------------------------------------
366// Global variable and functions
367
368//
369// Exported pointers from OWL modules, implemented in GLOBAL.CPP
370// Unmanagled to allow easy loading via LoadLibrary
371//
372namespace owl {class _OWLCLASS TDocTemplate;};
373
374#if defined(BI_COMP_BORLANDC)
375
376extern "C"
377{
380}
381
382#else
383
386
387#endif
388//
389/// Main entry point for an Owl application
390//
391int OwlMain(int argc, _TCHAR* argv[]);
392
393extern "C" {
394
395//
396/// Initialization routine that must be called from User DLL if DLL
397/// provides it's own entry point [i.e. LibMain or DllEntryPoint]
398//
400}
401
402namespace owl {
403
404#include <owl/preclass.h>
405
406//----------------------------------------------------------------------------
407// Definition of TDllLoader template, and TModuleProc class & derived
408// templates.
409// TModuleProcX<>s provide dynamic binding & call access to exported module
410// procs
411//
412
413//
414/// \class TDllLoader<>
415// ~~~~~ ~~~~~~~~~~~~
416/// TDllLoader<> provides an easy way to load one instance of a DLL on demand.
417//
418template <class T> class TDllLoader {
419 public:
420 TDllLoader();
421 ~TDllLoader();
422 static bool IsAvailable();
423 static T* Dll();
424
425#if 0
426 // !BB Static data members in template is a problem when
427 // !BB exporting/importing templates. Basically, the initialization of
428 // !BB the static member [see the statement which initializes Dll to 0
429 // !BB below] must only be seen when exporting the template and causes an
430 // !BB error when one is importing the template: 'Cannot initialize
431 // !BB extern'. The error message makes sense since to the importer, the
432 // !BB data member is an extern variable. However, there's a catch 22:
433 // !BB Only the user of the template header knows whether it's
434 // !BB importing or exporting a particular instance of the template. So
435 // !BB how does the user communicate to the header whether or not to have
436 // !BB the initialization code?? Furthermore, what if a particular user of
437 // !BB the template is importing the template for Type1 and exporting it
438 // !BB for Type2. Now, we have a problem either way.
439 // !BB
440 // !BB Ideally the compiler would simply ignore the initialization of
441 // !BB a static data member when the code including the template is
442 // !BB actually importing the template. For now though, we'll avoid
443 // !BB static data members and use a static variable within a static
444 // !BB method instead. It's less elegant but it solves this problem.
445
446 static T* Dll;
447#endif
448 private:
449 static T*& DllPtrRef();
450};
451
452
453#if 0
454// !BB See comment about static data members and importing/exporting
455// !BB templates above.
456
457//
458/// One static pointer to the dll object, loaded on demand
459//
460template <class T> T* TDllLoader<T>::Dll = 0;
461#endif
462
463//
464/// Creates a dynamic copy of the DLL object (i.e. an instance of T) if we
465/// do not have one already...
466//
467template <class T> TDllLoader<T>::TDllLoader()
468{
469 T*& dll = DllPtrRef();
470 //WARN(dll != 0, _T("Multiple copies of DllLoaders for DLL: ") << *dll);
471 if (dll == nullptr) {
472 try {
473 dll = new T;
474 }
475 catch (...) {
476 }
477 }
478}
479
480//
481/// Deletes the dll object when we go away to release the dll from memory
482//
483template <class T> TDllLoader<T>::~TDllLoader()
484{
485#if 0 // !BB
486 delete Dll;
487 Dll = 0;
488#endif
489 T*& dll = DllPtrRef();
490 delete dll;
491 dll = nullptr;
492}
493
494//
495/// Load the dll on demand, returning true if it was loaded OK
496//
497//#if !defined(WINELIB)//JJH
498template <class T> bool TDllLoader<T>::IsAvailable()
499{
501 return DllPtrRef() != nullptr;
502}
503//#endif
504
505//
506//
507//
508template <class T> T* TDllLoader<T>::Dll()
509{
510 PRECONDITION(DllPtrRef() != 0);
511 return DllPtrRef();
512}
513
514//
515/// Method encapsulating single instance of pointer to DLL objecct
516//
517//#if !defined(WINELIB)//JJH
518template <class T> T*& TDllLoader<T>::DllPtrRef()
519{
520 static T* ThisDll = nullptr;
521 return ThisDll;
522}
523//#endif
524
525//
526/// \class TModuleProc
527/// TModuleProc is a base class that does inital binding of a function name or ordinal to the
528/// corresponding function in the given module (DLL).
529/// It is required and assumed that the bound function is using the WINAPI calling convention.
530/// Derived class templates perform type-safe parameter passing on call using
531/// a different template for each number of parameters, 'V' version for void return, i.e.
532/// TModuleProcV0, TModuleProc0, TModuleProcV1, TModuleProc1, etc.
533/// The constructor throws an exception if it cannot bind.
534//
536 protected:
537 TModuleProc(const TModule& module, TNarrowResId id);
538
539 protected:
540/// Derived template classes perform type-safe parameter passing on call. Different
541/// class for each number of parameters, 'V' version for void return.
543};
544
545//
546/// \cond
547//
548class TModuleProcV0 : public TModuleProc {
549 public:
550 TModuleProcV0(const TModule& module, TNarrowResId id) : TModuleProc(module, id) {}
551
552 typedef void ( WINAPI* TProc)();
553 void operator ()() {
554 (reinterpret_cast<TProc>(Proc))();
555 }
556};
557
558//
559template <class R>
560class TModuleProc0 : public TModuleProc {
561 public:
562 TModuleProc0(const TModule& module, TNarrowResId id) : TModuleProc(module, id) {}
563
564 typedef R ( WINAPI* TProc)();
565 R operator ()() {
566 return (reinterpret_cast<TProc>(Proc))();
567 }
568};
569
570//
571template <class P1>
572class TModuleProcV1 : public TModuleProc {
573 public:
574 TModuleProcV1(const TModule& module, TNarrowResId id) : TModuleProc(module, id) {}
575
576 typedef void ( WINAPI* TProc)(P1 p1);
577 void operator ()(P1 p1) {
578 (reinterpret_cast<TProc>(Proc))(p1);
579 }
580};
581
582//
583template <class R, class P1>
584class TModuleProc1 : public TModuleProc {
585 public:
586 TModuleProc1(const TModule& module, TNarrowResId id) : TModuleProc(module, id) {}
587
588 typedef R ( WINAPI* TProc)(P1 p1);
589 R operator ()(P1 p1) {
590 return (reinterpret_cast<TProc>(Proc))(p1);
591 }
592};
593
594//
595template <class P1, class P2>
596class TModuleProcV2 : public TModuleProc {
597 public:
598 TModuleProcV2(const TModule& module, TNarrowResId id) : TModuleProc(module, id) {}
599
600 typedef void ( WINAPI* TProc)(P1 p1, P2 a2);
601 void operator ()(P1 p1, P2 a2) {
602 (reinterpret_cast<TProc>(Proc))(p1, a2);
603 }
604};
605
606//
607template <class R, class P1, class P2>
608class TModuleProc2 : public TModuleProc {
609 public:
610 TModuleProc2(const TModule& module, TNarrowResId id) : TModuleProc(module, id) {}
611
612 typedef R ( WINAPI* TProc)(P1 p1, P2 p2);
613 R operator ()(P1 p1, P2 p2) {
614 return (reinterpret_cast<TProc>(Proc))(p1, p2);
615 }
616};
617
618//
619template <class P1, class P2, class P3>
620class TModuleProcV3 : public TModuleProc {
621 public:
622 TModuleProcV3(const TModule& module, TNarrowResId id) : TModuleProc(module, id) {}
623
624 typedef void ( WINAPI* TProc)(P1 p1, P2 p2, P3 p3);
625 void operator ()(P1 p1, P2 p2, P3 p3) {
626 (reinterpret_cast<TProc>(Proc))(p1, p2, p3);
627 }
628};
629
630//
631template <class R, class P1, class P2, class P3>
632class TModuleProc3 : public TModuleProc {
633 public:
634 TModuleProc3(const TModule& module, TNarrowResId id) : TModuleProc(module, id) {}
635
636 typedef R ( WINAPI* TProc)(P1 p1, P2 p2, P3 p3);
637 R operator ()(P1 p1, P2 p2, P3 p3) {
638 return (reinterpret_cast<TProc>(Proc))(p1, p2, p3);
639 }
640};
641
642//
643template <class P1, class P2, class P3, class P4>
644class TModuleProcV4 : public TModuleProc {
645 public:
646 TModuleProcV4(const TModule& module, TNarrowResId id) : TModuleProc(module, id) {}
647
648 typedef void ( WINAPI* TProc)(P1 p1, P2 p2, P3 p3, P4 p4);
649 void operator ()(P1 p1, P2 p2, P3 p3, P4 p4) {
650 (reinterpret_cast<TProc>(Proc))(p1, p2, p3, p4);
651 }
652};
653
654//
655template <class R, class P1, class P2, class P3, class P4>
656class TModuleProc4 : public TModuleProc {
657 public:
658 TModuleProc4(const TModule& module, TNarrowResId id) : TModuleProc(module, id) {}
659
660 typedef R ( WINAPI* TProc)(P1 p1, P2 p2, P3 p3, P4 p4);
661 R operator ()(P1 p1, P2 p2, P3 p3, P4 p4) {
662 return (reinterpret_cast<TProc>(Proc))(p1, p2, p3, p4);
663 }
664};
665
666//
667template <class P1, class P2, class P3, class P4, class P5>
668class TModuleProcV5 : public TModuleProc {
669 public:
670 TModuleProcV5(const TModule& module, TNarrowResId id) : TModuleProc(module, id) {}
671
672 typedef void ( WINAPI* TProc)(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5);
673 void operator ()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) {
674 (reinterpret_cast<TProc>(Proc))(p1, p2, p3, p4, p5);
675 }
676};
677
678//
679template <class R, class P1, class P2, class P3, class P4, class P5>
680class TModuleProc5 : public TModuleProc {
681 public:
682 TModuleProc5(const TModule& module, TNarrowResId id) : TModuleProc(module, id) {}
683
684 typedef R ( WINAPI* TProc)(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5);
685 R operator ()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) {
686 return (reinterpret_cast<TProc>(Proc))(p1, p2, p3, p4, p5);
687 }
688};
689
690//
691template <class P1, class P2, class P3, class P4, class P5, class P6>
692class TModuleProcV6 : public TModuleProc {
693 public:
694 TModuleProcV6(const TModule& module, TNarrowResId id) : TModuleProc(module, id) {}
695
696 typedef void ( WINAPI* TProc)(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6);
697 void operator ()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6) {
698 (reinterpret_cast<TProc>(Proc))(p1, p2, p3, p4, p5, p6);
699 }
700};
701
702//
703template <class R, class P1, class P2, class P3, class P4, class P5, class P6>
704class TModuleProc6 : public TModuleProc {
705 public:
706 TModuleProc6(const TModule& module, TNarrowResId id) : TModuleProc(module, id) {}
707
708 typedef R ( WINAPI* TProc)(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6);
709 R operator ()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6) {
710 return (reinterpret_cast<TProc>(Proc))(p1, p2, p3, p4, p5, p6);
711 }
712};
713
714//
715template <class P1, class P2, class P3, class P4, class P5, class P6, class P7>
716class TModuleProcV7 : public TModuleProc {
717 public:
718 TModuleProcV7(const TModule& module, TNarrowResId id) : TModuleProc(module, id) {}
719
720 typedef void ( WINAPI* TProc)(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6,
721 P7 p7);
722 void operator ()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7) {
723 (reinterpret_cast<TProc>(Proc)) (p1, p2, p3, p4, p5, p6, p7);
724 }
725};
726
727//
728template <class R, class P1, class P2, class P3, class P4, class P5, class P6,
729 class P7>
730class TModuleProc7 : public TModuleProc {
731 public:
732 TModuleProc7(const TModule& module, TNarrowResId id) : TModuleProc(module, id) {}
733
734 typedef R ( WINAPI* TProc)(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6,
735 P7 p7);
736 R operator ()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7) {
737 return (reinterpret_cast<TProc>(Proc))(p1, p2, p3, p4, p5, p6, p7);
738 }
739};
740
741//
742template <class P1, class P2, class P3, class P4, class P5, class P6,
743 class P7, class P8>
744class TModuleProcV8 : public TModuleProc {
745 public:
746 TModuleProcV8(const TModule& module, TNarrowResId id) : TModuleProc(module, id) {}
747
748 typedef void ( WINAPI* TProc)(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6,
749 P7 p7, P8 p8);
750 void operator ()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8) {
751 (reinterpret_cast<TProc>(Proc))(p1, p2, p3, p4, p5, p6, p7, p8);
752 }
753};
754
755//
756template <class R, class P1, class P2, class P3, class P4, class P5, class P6,
757 class P7, class P8>
758class TModuleProc8 : public TModuleProc {
759 public:
760 TModuleProc8(const TModule& module, TNarrowResId id) : TModuleProc(module, id) {}
761
762 typedef R ( WINAPI* TProc)(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6,
763 P7 p7, P8 p8);
764 R operator ()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8) {
765 return (reinterpret_cast<TProc>(Proc))(p1, p2, p3, p4, p5, p6, p7, p8);
766 }
767};
768
769//
770template <class P1, class P2, class P3, class P4, class P5, class P6,
771 class P7, class P8, class P9>
772class TModuleProcV9 : public TModuleProc {
773 public:
774 TModuleProcV9(const TModule& module, TNarrowResId id) : TModuleProc(module, id) {}
775
776 typedef void ( WINAPI* TProc)(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6,
777 P7 p7, P8 p8, P9 p9);
778 void operator ()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9) {
779 (reinterpret_cast<TProc>(Proc))(p1, p2, p3, p4, p5, p6, p7, p8, p9);
780 }
781};
782
783//
784template <class R, class P1, class P2, class P3, class P4, class P5, class P6,
785 class P7, class P8, class P9>
786class TModuleProc9 : public TModuleProc {
787 public:
788 TModuleProc9(const TModule& module, TNarrowResId id) : TModuleProc(module, id) {}
789
790 typedef R ( WINAPI* TProc)(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6,
791 P7 p7, P8 p8, P9 p9);
792 R operator ()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9) {
793 return (reinterpret_cast<TProc>(Proc))(p1, p2, p3, p4, p5, p6, p7, p8, p9);
794 }
795};
796
797//
798template <class P1, class P2, class P3, class P4, class P5, class P6,
799 class P7, class P8, class P9, class P10>
800class TModuleProcV10 : public TModuleProc {
801 public:
802 TModuleProcV10(const TModule& module, TNarrowResId id) : TModuleProc(module, id) {}
803
804 typedef void ( WINAPI* TProc)(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6,
805 P7 p7, P8 p8, P9 p9, P10 p10);
806 void operator ()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9,
807 P10 p10) {
808 (reinterpret_cast<TProc>(Proc))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10);
809 }
810};
811
812//
813template <class R, class P1, class P2, class P3, class P4, class P5, class P6,
814 class P7, class P8, class P9, class P10>
815class TModuleProc10 : public TModuleProc {
816 public:
817 TModuleProc10(const TModule& module, TNarrowResId id) : TModuleProc(module, id) {}
818
819 typedef R ( WINAPI* TProc)(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6,
820 P7 p7, P8 p8, P9 p9, P10 p10);
821 R operator ()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9,
822 P10 p10) {
823 return (reinterpret_cast<TProc>(Proc))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10);
824 }
825};
826
827//
828template <class P1, class P2, class P3, class P4, class P5, class P6,
829 class P7, class P8, class P9, class P10, class P11>
830class TModuleProcV11 : public TModuleProc {
831 public:
832 TModuleProcV11(const TModule& module, TNarrowResId id) : TModuleProc(module, id) {}
833
834 typedef void ( WINAPI* TProc)(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6,
835 P7 p7, P8 p8, P9 p9, P10 p10, P11 p11);
836 void operator ()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9,
837 P10 p10, P11 p11) {
838 (reinterpret_cast<TProc>(Proc))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11);
839 }
840};
841
842//
843template <class R, class P1, class P2, class P3, class P4, class P5, class P6,
844 class P7, class P8, class P9, class P10, class P11>
845class TModuleProc11 : public TModuleProc {
846 public:
847 TModuleProc11(const TModule& module, TNarrowResId id) : TModuleProc(module, id) {}
848
849 typedef R ( WINAPI* TProc)(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6,
850 P7 p7, P8 p8, P9 p9, P10 p10, P11 p11);
851 R operator ()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9,
852 P10 p10, P11 p11) {
853 return (reinterpret_cast<TProc>(Proc))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11);
854 }
855};
856
857//
858template <class P1, class P2, class P3, class P4, class P5, class P6,
859 class P7, class P8, class P9, class P10, class P11, class P12>
860class TModuleProcV12 : public TModuleProc {
861 public:
862 TModuleProcV12(const TModule& module, TNarrowResId id) : TModuleProc(module, id) {}
863
864 typedef void ( WINAPI* TProc)(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6,
865 P7 p7, P8 p8, P9 p9, P10 p10, P11 p11, P12 p12);
866 void operator ()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9,
867 P10 p10, P11 p11, P12 p12) {
868 (reinterpret_cast<TProc>(Proc))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12);
869 }
870};
871
872//
873template <class R, class P1, class P2, class P3, class P4, class P5, class P6,
874 class P7, class P8, class P9, class P10, class P11, class P12>
875class TModuleProc12 : public TModuleProc {
876 public:
877 TModuleProc12(const TModule& module, TNarrowResId id) : TModuleProc(module, id) {}
878
879 typedef R ( WINAPI* TProc)(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6,
880 P7 p7, P8 p8, P9 p9, P10 p10, P11 p11, P12 p12);
881 R operator ()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9,
882 P10 p10, P11 p11, P12 p12) {
883 return (reinterpret_cast<TProc>(Proc))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12);
884 }
885};
886
887//
888template <class P1, class P2, class P3, class P4, class P5, class P6,
889 class P7, class P8, class P9, class P10, class P11, class P12, class P13>
890class TModuleProcV13 : public TModuleProc {
891 public:
892 TModuleProcV13(const TModule& module, TNarrowResId id) : TModuleProc(module, id) {}
893
894 typedef void ( WINAPI* TProc)(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6,
895 P7 p7, P8 p8, P9 p9, P10 p10, P11 p11,
896 P12 p12, P13 p13);
897 void operator ()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9,
898 P10 p10, P11 p11, P12 p12, P13 p13) {
899 (reinterpret_cast<TProc>(Proc))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13);
900 }
901};
902
903//
904template <class R, class P1, class P2, class P3, class P4, class P5, class P6,
905 class P7, class P8, class P9, class P10, class P11, class P12, class P13>
906class TModuleProc13 : public TModuleProc {
907 public:
908 TModuleProc13(const TModule& module, TNarrowResId id) : TModuleProc(module, id) {}
909
910 typedef R ( WINAPI* TProc)(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6,
911 P7 p7, P8 p8, P9 p9, P10 p10, P11 p11,
912 P12 p12, P13 p13);
913 R operator ()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9,
914 P10 p10, P11 p11, P12 p12, P13 p13) {
915 return (reinterpret_cast<TProc>(Proc))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13);
916 }
917};
918//
919template <class P1, class P2, class P3, class P4, class P5, class P6,class P7,
920 class P8, class P9, class P10, class P11, class P12, class P13,class P14>
921class TModuleProcV14 : public TModuleProc {
922 public:
923 TModuleProcV14(const TModule& module, TNarrowResId id) : TModuleProc(module, id) {}
924
925 typedef void ( WINAPI* TProc)(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6,
926 P7 p7, P8 p8, P9 p9, P10 p10, P11 p11,P12 p12, P13 p13, P14 p14);
927 void operator ()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9,
928 P10 p10, P11 p11, P12 p12, P13 p13, P14 p14){
929 (reinterpret_cast<TProc>(Proc))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12,p13,p14);
930 }
931};
932//
933template <class R, class P1, class P2, class P3, class P4, class P5, class P6,
934 class P7, class P8, class P9, class P10, class P11, class P12, class P13,
935 class P14>
936class TModuleProc14 : public TModuleProc {
937 public:
938 TModuleProc14(const TModule& module, TNarrowResId id) : TModuleProc(module, id) {}
939
940 typedef R ( WINAPI* TProc)(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6,
941 P7 p7, P8 p8, P9 p9, P10 p10, P11 p11,P12 p12, P13 p13, P14 p14);
942 R operator ()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9,
943 P10 p10, P11 p11, P12 p12, P13 p13, P14 p14){
944 return (reinterpret_cast<TProc>(Proc))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12,p13,p14);
945 }
946};
947//
948template <class P1, class P2, class P3, class P4, class P5, class P6,class P7,
949 class P8, class P9, class P10, class P11, class P12, class P13,class P14,
950 class P15>
951class TModuleProcV15 : public TModuleProc {
952 public:
953 TModuleProcV15(const TModule& module, TNarrowResId id) : TModuleProc(module, id) {}
954
955 typedef void ( WINAPI* TProc)(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6,
957 P15 p15);
958 void operator ()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9,
960 (reinterpret_cast<TProc>(Proc))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13,p14,p15);
961 }
962};
963//
964template <class R, class P1, class P2, class P3, class P4, class P5, class P6,
965 class P7, class P8, class P9, class P10, class P11, class P12, class P13,
966 class P14, class P15>
967class TModuleProc15 : public TModuleProc {
968 public:
969 TModuleProc15(const TModule& module, TNarrowResId id) : TModuleProc(module, id) {}
970
971 typedef R ( WINAPI* TProc)(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6,
973 P15 p15);
974 R operator ()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9,
976 return (reinterpret_cast<TProc>(Proc))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12,
977 p13,p14,p15);
978 }
979};
980//
981template <class P1, class P2, class P3, class P4, class P5, class P6,class P7,
982 class P8, class P9, class P10, class P11, class P12, class P13,
983 class P14, class P15, class P16>
984class TModuleProcV16 : public TModuleProc {
985 public:
986 TModuleProcV16(const TModule& module, TNarrowResId id) : TModuleProc(module, id) {}
987
988 typedef void ( WINAPI* TProc)(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6,
990 P15 p15, P16 p16);
991 void operator ()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9,
993 (reinterpret_cast<TProc>(Proc))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13,p14,
994 p15,p16);
995 }
996};
997//
998template <class R, class P1, class P2, class P3, class P4, class P5, class P6,
999 class P7, class P8, class P9, class P10, class P11, class P12, class P13,
1000 class P14, class P15, class P16>
1001class TModuleProc16 : public TModuleProc {
1002 public:
1003 TModuleProc16(const TModule& module, TNarrowResId id) : TModuleProc(module, id) {}
1004
1005 typedef R ( WINAPI* TProc)(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6,
1006 P7 p7, P8 p8, P9 p9, P10 p10, P11 p11,P12 p12, P13 p13, P14 p14,
1007 P15 p15, P16 p16);
1008 R operator ()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9,
1010 return (reinterpret_cast<TProc>(Proc))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12,
1011 p13,p14,p15,p16);
1012 }
1013};
1014//
1015template <class P1, class P2, class P3, class P4, class P5, class P6,class P7,
1016 class P8, class P9, class P10, class P11, class P12, class P13,
1017 class P14, class P15, class P16, class P17>
1018class TModuleProcV17 : public TModuleProc {
1019 public:
1020 TModuleProcV17(const TModule& module, TNarrowResId id) : TModuleProc(module, id) {}
1021
1022 typedef void ( WINAPI* TProc)(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6,
1023 P7 p7, P8 p8, P9 p9, P10 p10, P11 p11,P12 p12, P13 p13, P14 p14,
1024 P15 p15, P16 p16, P17 p17);
1025 void operator ()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9,
1027 (reinterpret_cast<TProc>(Proc))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13,p14,
1028 p15,p16,p17);
1029 }
1030};
1031//
1032template <class R, class P1, class P2, class P3, class P4, class P5, class P6,
1033 class P7, class P8, class P9, class P10, class P11, class P12, class P13,
1034 class P14, class P15, class P16, class P17>
1035class TModuleProc17 : public TModuleProc {
1036 public:
1037 TModuleProc17(const TModule& module, TNarrowResId id) : TModuleProc(module, id) {}
1038
1039 typedef R ( WINAPI* TProc)(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6,
1040 P7 p7, P8 p8, P9 p9, P10 p10, P11 p11,P12 p12, P13 p13, P14 p14,
1041 P15 p15, P16 p16, P17 p17);
1042 R operator ()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9,
1044 return (reinterpret_cast<TProc>(Proc))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12,
1045 p13,p14,p15,p16,p17);
1046 }
1047};
1048//
1049template <class P1, class P2, class P3, class P4, class P5, class P6,class P7,
1050 class P8, class P9, class P10, class P11, class P12, class P13,
1051 class P14, class P15, class P16, class P17, class P18>
1052class TModuleProcV18 : public TModuleProc {
1053 public:
1054 TModuleProcV18(const TModule& module, TNarrowResId id) : TModuleProc(module, id) {}
1055
1056 typedef void ( WINAPI* TProc)(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6,
1057 P7 p7, P8 p8, P9 p9, P10 p10, P11 p11,P12 p12, P13 p13, P14 p14,
1058 P15 p15, P16 p16, P17 p17, P18 p18);
1059 void operator ()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9,
1061 (reinterpret_cast<TProc>(Proc))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13,p14,
1062 p15,p16,p17,p18);
1063 }
1064};
1065//
1066template <class R, class P1, class P2, class P3, class P4, class P5, class P6,
1067 class P7, class P8, class P9, class P10, class P11, class P12, class P13,
1068 class P14, class P15, class P16, class P17, class P18>
1069class TModuleProc18 : public TModuleProc {
1070 public:
1071 TModuleProc18(const TModule& module, TNarrowResId id) : TModuleProc(module, id) {}
1072
1073 typedef R ( WINAPI* TProc)(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6,
1074 P7 p7, P8 p8, P9 p9, P10 p10, P11 p11,P12 p12, P13 p13, P14 p14,
1075 P15 p15, P16 p16, P17 p17, P18 p18);
1076 R operator ()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9,
1078 return (reinterpret_cast<TProc>(Proc))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12,
1079 p13,p14,p15,p16,p17,p18);
1080 }
1081};
1082//
1083template <class P1, class P2, class P3, class P4, class P5, class P6,class P7,
1084 class P8, class P9, class P10, class P11, class P12, class P13,
1085 class P14, class P15, class P16, class P17, class P18, class P19>
1086class TModuleProcV19 : public TModuleProc {
1087 public:
1088 TModuleProcV19(const TModule& module, TNarrowResId id) : TModuleProc(module, id) {}
1089
1090 typedef void ( WINAPI* TProc)(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6,
1091 P7 p7, P8 p8, P9 p9, P10 p10, P11 p11,P12 p12, P13 p13, P14 p14,
1092 P15 p15, P16 p16, P17 p17, P18 p18, P19 p19);
1093 void operator ()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9,
1095 P18 p18, P19 p19){
1096 (reinterpret_cast<TProc>(Proc))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13,p14,
1097 p15,p16,p17,p18,p19);
1098 }
1099};
1100//
1101template <class R, class P1, class P2, class P3, class P4, class P5, class P6,
1102 class P7, class P8, class P9, class P10, class P11, class P12, class P13,
1103 class P14, class P15, class P16, class P17, class P18, class P19>
1104class TModuleProc19 : public TModuleProc {
1105 public:
1106 TModuleProc19(const TModule& module, TNarrowResId id) : TModuleProc(module, id) {}
1107
1108 typedef R ( WINAPI* TProc)(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6,
1109 P7 p7, P8 p8, P9 p9, P10 p10, P11 p11,P12 p12, P13 p13, P14 p14,
1110 P15 p15, P16 p16, P17 p17, P18 p18, P19 p19);
1111 R operator ()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9,
1113 P18 p18, P19 p19){
1114 return (reinterpret_cast<TProc>(Proc))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12,
1115 p13,p14,p15,p16,p17,p18,p19);
1116 }
1117};
1118//
1119template <class P1, class P2, class P3, class P4, class P5, class P6,class P7,
1120 class P8, class P9, class P10, class P11, class P12, class P13,
1121 class P14, class P15, class P16, class P17, class P18, class P19,
1122 class P20>
1123class TModuleProcV20 : public TModuleProc {
1124 public:
1125 TModuleProcV20(const TModule& module, TNarrowResId id) : TModuleProc(module, id) {}
1126
1127 typedef void ( WINAPI* TProc)(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6,
1128 P7 p7, P8 p8, P9 p9, P10 p10, P11 p11,P12 p12, P13 p13, P14 p14,
1129 P15 p15, P16 p16, P17 p17, P18 p18, P19 p19, P20 p20);
1130 void operator ()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9,
1132 P18 p18, P19 p19, P20 p20){
1133 (reinterpret_cast<TProc>(Proc))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13,p14,
1134 p15,p16,p17,p18,p19,p20);
1135 }
1136};
1137//
1138template <class R, class P1, class P2, class P3, class P4, class P5, class P6,
1139 class P7, class P8, class P9, class P10, class P11, class P12, class P13,
1140 class P14, class P15, class P16, class P17, class P18, class P19,
1141 class P20>
1142class TModuleProc20 : public TModuleProc {
1143 public:
1144 TModuleProc20(const TModule& module, TNarrowResId id) : TModuleProc(module, id) {}
1145
1146 typedef R ( WINAPI* TProc)(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6,
1147 P7 p7, P8 p8, P9 p9, P10 p10, P11 p11,P12 p12, P13 p13, P14 p14,
1148 P15 p15, P16 p16, P17 p17, P18 p18, P19 p19, P20 p20);
1149 R operator ()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9,
1151 P18 p18, P19 p19, P20 p20){
1152 return (reinterpret_cast<TProc>(Proc))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12,
1154 }
1155};
1156
1157/// \endcond
1158
1159//----------------------------------------------------------------------------
1160// System DLL Wrappers
1161//
1162
1163
1164//
1165/// \class TUser
1166// ~~~~~ ~~~~~
1167/// delay loading USER :), just for some memory/resource check programs
1169 public:
1170 static HICON LoadIcon(HINSTANCE, LPCTSTR);
1171 static BOOL DestroyIcon(HICON);
1172 static BOOL GetClassInfo(HINSTANCE, LPCTSTR, LPWNDCLASS);
1173 static int GetMenuString(HMENU, UINT, LPTSTR, int, UINT);
1174 static UINT GetMenuState(HMENU, UINT, UINT);
1175 static TModule& GetModule();
1176};
1177
1178//
1179/// \class TVersion
1180// ~~~~~ ~~~~~~~~
1181/// delay loading VERSION.DLL
1183 public:
1184 static BOOL GetFileVersionInfo(LPTSTR,DWORD,DWORD,LPVOID);
1185 static DWORD GetFileVersionInfoSize(LPTSTR, LPDWORD);
1186 static BOOL VerQueryValue(const LPVOID,LPTSTR,LPVOID,uint *);
1187 static DWORD VerLanguageName(DWORD,LPTSTR,DWORD);
1188 static TModule& GetModule();
1189};
1190
1191//
1192/// \class TOle
1193// ~~~~~ ~~~~~~~~
1194/// delay loading Ole32.DLL/COMPOBJ.DLL
1196 public:
1197 static HRESULT CoCreateInstance(REFCLSID, LPUNKNOWN, DWORD, REFIID, LPVOID*);
1198 static TModule& GetModule();
1199};
1200
1201//
1202/// \class TOleAuto
1203// ~~~~~ ~~~~~~~~
1204/// delay loading OLEAUT32.DLL/OLE2DISP.DLL
1206 public:
1207 static HRESULT SysFreeString(BSTR);
1208 static UINT SysStringLen(BSTR);
1209 static BSTR SysAllocString(const OLECHAR *);
1210 static TModule& GetModule();
1211};
1212
1213/// @}
1214
1215#include <owl/posclass.h>
1216
1217//----------------------------------------------------------------------------
1218// Inline implementation
1219//
1220
1221//
1222/// Returns the name of the module.
1223//
1225{
1226 return Name.c_str();
1227}
1228
1229//
1230/// Return the instance handle of the library module represented by the
1231/// TModule obect.
1232//
1234{
1235 return Handle;
1236}
1237
1238//
1239/// Returns the handle of the application or DLL module represented by this TModule.
1240/// The handle must be supplied as a parameter to Windows when loading resources.
1241//
1242inline TModule::operator TModule::THandle() const
1243{
1244 return GetHandle();
1245}
1246
1247//
1248/// Returns true if this instance is equal to the other instance; otherwise, returns
1249/// false.
1250//
1251inline bool TModule::operator ==(const TModule& m) const
1252{
1253 return GetHandle() == m.GetHandle();
1254}
1255
1256//
1257/// Returns a nonzero value if the instance handle is loaded. Use this function
1258/// primarily to ensure that a given instance is loaded.
1259//
1260inline bool TModule::IsLoaded() const
1261{
1263}
1264
1265//
1266/// Returns the expanded file name (path and file name) of the file from which this
1267/// module was loaded. buff points to a buffer that holds the path and file name.
1268/// maxChars specifies the length of the buffer. The expanded filename is truncated
1269/// if it exceeds this limit. GetModeFileName returns 0 if an error occurs.
1270//
1272{
1274 return ::GetModuleFileName(Handle, buff, maxChars);
1275}
1276
1277//
1278/// Returns the entry-point address of the specified exported function if found,
1279/// otherwise returns NULL.
1280//
1282{
1284 return ::GetProcAddress(Handle, id.GetPointerRepresentation());
1285}
1286
1287
1288//
1289/// Wrapper for the Windows API to find a particular resource.
1290//
1291/// Finds the resource indicated by id and type and, if successful, returns a handle
1292/// to the specified resource. If the resource cannot be found, the return value is
1293/// zero. The id and type parameters either point to zero-terminated strings or
1294/// specify an integer value. type can be one of the standard resource types defined
1295/// below.
1296///
1297/// - \c \b RT_ACCELERATOR Accelerator table
1298/// - \c \b RT_BITMAP Bitmap
1299/// - \c \b RT_CURSOR Cursor
1300/// - \c \b RT_DIALOG Dialog box
1301/// - \c \b RT_FONT Font
1302/// - \c \b RT_FONTDIR Font directory
1303/// - \c \b RT_ICON Icon
1304/// - \c \b RT_MENU Menu
1305/// - \c \b RT_RCDATA User-defined resource
1306/// - \c \b RT_STRING String
1307//
1309{
1311 return ::FindResource(Handle, id, type);
1312}
1313
1314//
1315/// Wrapper for the Windows API to find a particular resource.
1316//
1317/// WIN32: Finds the resource indicated by id and type and, if successful, returns a
1318/// handle to the specified resource. If the resource cannot be found, the return
1319/// value is zero. The id and type parameters either point to zero-terminated
1320/// strings or specify an integer value. type can be one of the standard resource
1321/// types defined below.
1322///
1323/// - \c \b RT_ACCELERATOR Accelerator table
1324/// - \c \b RT_BITMAP Bitmap
1325/// - \c \b RT_CURSOR Cursor
1326/// - \c \b RT_DIALOG Dialog box
1327/// - \c \b RT_FONT Font
1328/// - \c \b RT_FONTDIR Font directory
1329/// - \c \b RT_ICON Icon
1330/// - \c \b RT_MENU Menu
1331/// - \c \b RT_RCDATA User-defined resource
1332/// - \c \b RT_STRING String
1333//
1335{
1337// return ::FindResourceEx(Handle, id, type, langId); // The order of parameters is reversed
1338 return ::FindResourceEx(Handle, type, id, langId);
1339}
1340//
1341/// Wrapper for the Windows API.
1342//
1343/// Loads a resource indicated by hRsrc into memory and returns a handle to the
1344/// memory block that contains the resource. If the resource cannot be found, the
1345/// return value is 0. The hRsrc parameter must be a handle created by FindResource.
1346///
1347/// LoadResource loads the resource into memory only if it has not been previously
1348/// loaded. If the resource has already been loaded, LoadResource increments the
1349/// reference count by one and returns a handle to the existing resource. The
1350/// resource remains loaded until it is discarded.
1351//
1353{
1355 return ::LoadResource(Handle, hRsrc);
1356}
1357
1358//
1359/// Wrapper for the Windows API.
1360//
1361/// Returns the size, in bytes, of the resource indicated by hRscr. The resource
1362/// must be a resource handle created by FindResource. If the resource cannot be
1363/// found, the return value is 0.
1364///
1365/// Because of alignment in the executable file, the returned size might be larger
1366/// than the actual size of the resource. An application cannot rely on
1367/// SizeofResource for the exact size of a resource.
1368//
1370{
1372 return ::SizeofResource(Handle, hRsrc);
1373}
1374
1375
1376//
1377/// Wrapper for the Windows API.
1378///
1379/// Copies the icon specified in hIcon. The return value is a handle to the icon or
1380/// 0 if unsuccessful. When no longer required, the duplicate icon should be
1381/// destroyed.
1382//
1383inline HICON TModule::CopyIcon(HICON hIcon) const
1384{
1385 return ::CopyIcon(hIcon);
1386}
1387
1388//
1389/// Retrieves information about the given window class.
1390/// This is a wrapper for the Windows API function GetClassInfo.
1391/// http://msdn.microsoft.com/en-us/library/windows/desktop/ms633578.aspx
1392/// \sa TClassName
1393//
1395{
1397 return TUser::GetClassInfo(Handle, name.GetPointerRepresentation(), wndclass);
1398}
1399
1400
1401//
1402/// Return the version information about this module.
1403//
1409
1410//
1412{
1414 return FixedInfo->dwSignature;
1415}
1416
1417//
1419{
1421 return FixedInfo->dwStrucVersion;
1422}
1423
1424//
1425/// Get the major file version (first 32-bits).
1426//
1428{
1430 return FixedInfo->dwFileVersionMS;
1431}
1432
1433//
1434/// Get the minor file version (last 32-bits).
1435//
1437{
1439 return FixedInfo->dwFileVersionLS;
1440}
1441
1442//
1443/// Get the major product version number (first 32-bits).
1444//
1446{
1448 return FixedInfo->dwProductVersionMS;
1449}
1450
1451//
1452/// Get the minor product version number (last 32-bits).
1453//
1455{
1457 return FixedInfo->dwProductVersionLS;
1458}
1459
1460//
1461/// Return true if the flag has been set in the version info.
1462//
1464{
1466 return (FixedInfo->dwFileFlagsMask & flag) && (FixedInfo->dwFileFlags & flag);
1467}
1468
1469//
1471{
1473 return FixedInfo->dwFileFlagsMask;
1474}
1475
1476//
1478{
1480 return FixedInfo->dwFileFlags;
1481}
1482
1483//
1485{
1487 return (FixedInfo->dwFileFlags & FixedInfo->dwFileFlagsMask & VS_FF_DEBUG) ?
1488 true : false;
1489}
1490
1491//
1493{
1495 return (FixedInfo->dwFileFlags & FixedInfo->dwFileFlagsMask & VS_FF_INFOINFERRED) ?
1496 true : false;
1497}
1498
1499//
1501{
1503 return (FixedInfo->dwFileFlags & FixedInfo->dwFileFlagsMask & VS_FF_PATCHED) ?
1504 true : false;
1505}
1506
1507//
1509{
1511 return (FixedInfo->dwFileFlags & FixedInfo->dwFileFlagsMask & VS_FF_PRERELEASE) ?
1512 true : false;
1513}
1514
1515//
1517{
1519 return (FixedInfo->dwFileFlags & FixedInfo->dwFileFlagsMask & VS_FF_PRIVATEBUILD) ?
1520 true : false;
1521}
1522
1523//
1525{
1527 return (FixedInfo->dwFileFlags & FixedInfo->dwFileFlagsMask & VS_FF_SPECIALBUILD) ?
1528 true : false;
1529}
1530
1531/// returns TFileOS values
1533{
1535 return FixedInfo->dwFileOS;
1536}
1537
1538//
1540{
1542 return static_cast<TFileType>(FixedInfo->dwFileType);
1543}
1544
1545//
1546/// Return the language id of this module.
1547//
1549{
1550 return uint(Lang);
1551}
1552
1553//
1554/// Return the language name of this module.
1555//
1561 return Message;
1562}
1564 return Error;
1565}
1566
1567//
1568/// Constructs a TErrorMode object which invokes the 'SetErrorMode' API
1569/// function to control how/whether Windows handles interrupt 24h errors.
1570//
1572{
1573 PrevMode = ::SetErrorMode(mode);
1574}
1575
1576//
1577/// Destructor of TErrorMode object - restores the state of the error mode
1578/// saved during construction of the object.
1579//
1581{
1582 ::SetErrorMode(PrevMode);
1583}
1584
1585} // OWL namespace
1586
1587#endif // OWL_MODULE_H
#define PRECONDITION(condition)
Definition checks.h:227
TDllLoader<> provides an easy way to load one instance of a DLL on demand.
Definition module.h:418
TDocTemplate is an abstract base class that contains document template functionality.
Definition doctpl.h:54
Simple encapsulation of the SetErrorMode call.
Definition module.h:352
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
Definition module.h:75
TModuleProc is a base class that does inital binding of a function name or ordinal to the correspondi...
Definition module.h:535
FARPROC Proc
Derived template classes perform type-safe parameter passing on call.
Definition module.h:542
TModuleVersionInfo provides access to a TModule's VERSIONINFO resource.
Definition module.h:182
delay loading OLEAUT32.DLL/OLE2DISP.DLL
Definition module.h:1205
delay loading Ole32.DLL/COMPOBJ.DLL
Definition module.h:1195
TResId encapsulates a Windows resource identifier.
Definition wsyscls.h:49
Classes that inherit from TStreamableBase are known as streamable classes (their objects can be writt...
Definition objstrm.h:108
delay loading USER :), just for some memory/resource check programs
Definition module.h:1168
static BOOL GetClassInfo(HINSTANCE, LPCTSTR, LPWNDCLASS)
Definition module.cpp:1088
delay loading VERSION.DLL
Definition module.h:1182
Type-safe encapsulation of a Windows class name, a union between ATOM and LPCTSTR.
Definition module.h:47
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
Definition window.h:414
Derived from xmsg, TXBase is the base class for ObjectWindows and ObjectComponents exception-handling...
Definition exbase.h:41
A nested class, TXInvalidModule describes an exception that results from an invalid module.
Definition module.h:302
Exception class for TModuleVersionInfo. [VH 2005-04-03].
Definition module.h:315
TXOwl is root class of the ObjectWindows exception hierarchy.
Definition except.h:38
STDAPI_(TDocTemplate **) GetDocTemplateHead(uint32 version)
Definition global.cpp:109
#define DECLARE_STREAMABLE_OWL(cls, ver)
Definition objstrm.h:1529
#define DECLARE_STREAMABLE_INLINES(cls)
Definition objstrm.h:1538
TWindowClassName(LPCTSTR s)
Definition module.h:51
bool IsPreRelease() const
Definition module.h:1508
VS_FIXEDFILEINFO * FixedInfo
Fixed file info structure.
Definition module.h:287
THandle GetHandle() const
Return the instance handle of the library module represented by the TModule obect.
Definition module.h:1233
auto GetClassInfo(TWindowClassName, WNDCLASS *wndclass) const -> bool
Retrieves information about the given window class.
Definition module.h:1394
bool IsDebug() const
Definition module.h:1484
uint32 SysError() const
Definition module.h:1563
TWindowClassName(ATOM a)
Definition module.h:50
TFileSubType
TFileSubType values are returned by GetFileSubType() if GetFileType.
Definition module.h:211
HGLOBAL LoadResource(HRSRC hRsrc) const
Wrapper for the Windows API.
Definition module.h:1352
tstring GetModuleFileName() const
String-aware overload.
Definition module.cpp:555
HRSRC FindResource(TResId id, TResId type) const
Wrapper for the Windows API to find a particular resource.
Definition module.h:1308
uint32 GetStrucVersion() const
Definition module.h:1418
bool IsPatched() const
Definition module.h:1500
auto IsString() const -> bool
Definition module.h:54
uint32 GetFileOS() const
returns TFileOS values
Definition module.h:1532
VS_FIXEDFILEINFO & GetFixedInfo()
Return the version information about this module.
Definition module.h:1404
tstring GetLanguageName() const
Return the language name of this module.
Definition module.h:1556
uint32 GetFileFlags() const
Definition module.h:1477
HINSTANCE THandle
TModule encapsulates an HINSTANCE.
Definition module.h:79
uint32 GetFileFlagsMask() const
Definition module.h:1470
TDllLoader()
Creates a dynamic copy of the DLL object (i.e.
Definition module.h:467
uint GetLanguage() const
Return the language id of this module.
Definition module.h:1548
TFileType
TFileType is returned by GetFileType()
Definition module.h:201
auto IsAtom() const -> bool
Definition module.h:55
static bool IsAvailable()
Load the dll on demand, returning true if it was loaded OK.
Definition module.h:498
bool InfoInferred() const
Definition module.h:1492
uint32 GetFileVersionMS() const
Get the major file version (first 32-bits).
Definition module.h:1427
auto GetPointerRepresentation() const -> LPCTSTR
Definition module.h:53
uint32 GetFileVersionLS() const
Get the minor file version (last 32-bits).
Definition module.h:1436
uint32 SizeofResource(HRSRC hRsrc) const
Wrapper for the Windows API.
Definition module.h:1369
uint8 * Buff
new'd File version info buffer
Definition module.h:285
TFileType GetFileType() const
Definition module.h:1539
HRSRC FindResourceEx(TResId id, TResId type, TLangId langId=LangNeutral) const
Wrapper for the Windows API to find a particular resource.
Definition module.h:1334
static T * Dll()
Definition module.h:508
TFileOS
TFileOS values are returned by GetFileOS()
Definition module.h:185
uint32 GetSignature() const
Definition module.h:1411
bool IsFileFlagSet(uint32 flag) const
Return true if the flag has been set in the version info.
Definition module.h:1463
~TErrorMode()
Destructor of TErrorMode object - restores the state of the error mode saved during construction of t...
Definition module.h:1580
LPCTSTR GetName() const
Returns the name of the module.
Definition module.h:1224
bool IsPrivateBuild() const
Definition module.h:1516
uint32 GetProductVersionMS() const
Get the major product version number (first 32-bits).
Definition module.h:1445
FARPROC GetProcAddress(TNarrowResId) const
Returns the entry-point address of the specified exported function if found, otherwise returns NULL.
Definition module.h:1281
uint32 GetProductVersionLS() const
Get the minor product version number (last 32-bits).
Definition module.h:1454
uint32 Lang
Default language translation.
Definition module.h:286
const tstring & SysMessage() const
Definition module.h:1560
bool IsSpecialBuild() const
Definition module.h:1524
bool operator==(const TModule &m) const
Returns true if this instance is equal to the other instance; otherwise, returns false.
Definition module.h:1251
HICON CopyIcon(HICON hIcon) const
Wrapper for the Windows API.
Definition module.h:1383
TErrorMode(uint mode)
Constructs a TErrorMode object which invokes the 'SetErrorMode' API function to control how/whether W...
Definition module.h:1571
bool IsLoaded() const
Returns a nonzero value if the instance handle is loaded.
Definition module.h:1260
~TDllLoader()
Deletes the dll object when we go away to release the dll from memory.
Definition module.h:483
@ KybdDriver
VFT2_DRV_KEYBOARD.
Definition module.h:213
@ SysDriver
VFT2_DRV_SYSTEM.
Definition module.h:218
@ VectorFont
VFT2_FONT_VECTOR.
Definition module.h:223
@ InstallableDriver
VFT2_DRV_INSTALLABLE.
Definition module.h:219
@ DisplayDriver
VFT2_DRV_DISPLAY.
Definition module.h:215
@ RasterFont
VFT2_FONT_RASTER.
Definition module.h:222
@ UnknownFont
VFT2_UNKNOWN.
Definition module.h:221
@ LangDriver
VFT2_DRV_LANGUAGE.
Definition module.h:214
@ MouseDriver
VFT2_DRV_MOUSE.
Definition module.h:216
@ PtrDriver
VFT2_DRV_PRINTER.
Definition module.h:212
@ SoundDriver
VFT2_DRV_SOUND.
Definition module.h:220
@ NtwkDriver
VFT2_DRV_NETWORK.
Definition module.h:217
TLocaleString - localized name support.
bool OWLInitUserDLL(HINSTANCE hInstance, LPCTSTR cmdLine)
Initialization routine that must be called from User DLL if DLL provides it's own entry point [i....
Definition initdll.cpp:31
STDAPI_(owl::TDocTemplate **) GetDocTemplateHead(owl STDAPI_(owl::TModule **) GetModulePtr(owl in OwlMain)(int argc, TCHAR *argv[])
Main entry point for an Owl application.
Definition module.h:391
Object Windows Library (OWLNext Core)
Definition animctrl.h:22
unsigned char uint8
Definition number.h:32
unsigned long uint32
Definition number.h:34
owl::uint16 TLangId
Holds a language ID, a predefined number that represents a base language and dialect.
Definition lclstrng.h:26
const TLangId LangNeutral
Definition lclstrng.h:32
BSTR SysAllocString(const char *str)
Definition string.h:130
std::string tstring
Definition defs.h:79
unsigned int uint
Definition number.h:25
STDAPI __declspec(dllexport) DllRegisterCommand(LPCTSTR cmdLine)
Entry point for complete registration management via command line Don't let any exceptions blow back ...
Definition ocreg.cpp:495
General definitions used by all ObjectWindows programs.
#define protected_data
Definition defs.h:208
ObjectWindows exception class & function definitions.
#define _OWLCFUNC(p)
Definition defs.h:342
#define _OWLCLASS
Definition defs.h:338
Various types of smart pointer templatized classes.
Classes for window system structure and type encapsulation.