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