10#if defined(__BORLANDC__)
25#if defined(BI_MULTI_THREAD_RTL)
32#if defined(BI_COMP_MSC)
45#if defined(__BORLANDC__)
50# pragma warning(disable: 4996)
93 Error = ::GetLastError();
118 win =
appl->GetMainWindow();
121 return ::MessageBox(
nullptr,
message.c_str(),
title.c_str(), flags);
153 static bool Find(
TModule* module);
154 static void Add(
TModule* module);
155 static void Remove(
TModule* module);
160#if defined(BI_MULTI_THREAD_RTL)
168#if defined(BI_MULTI_THREAD_RTL)
169TMRSWSection* __TModuleList::Lock =
nullptr;
172#if defined(BI_MULTI_THREAD_RTL)
173#define LOCKLIST(s) TMRSWSection::TLock __lock(*__TModuleList::Lock, s)
178TModule* __TModuleList::Next(TModule* module)
189 return (
i+1 <
ModuleArray->Size()) ? (*ModuleArray)[
i+1] :
nullptr;
195void __TModuleList::Add(TModule* module)
202#if defined(BI_MULTI_THREAD_RTL)
203 Lock =
new TMRSWSection;
215 if (module->GetHandle() == (*
ModuleArray)[
i]->GetHandle())
217 (*ModuleArray)[
i] =
module;
227void __TModuleList::Remove(TModule* module)
242#if defined(BI_MULTI_THREAD_RTL)
250bool __TModuleList::Find(TModule* module)
263TModule* __TModuleList::FindResModule(TResId
id, TResId
type)
274 if((*Iter1)->FindResourceEx(
id,
type,
langId))
281 if((*Iter)->FindResource(
id,
type))
292 return __TModuleList::Next(module);
329 __TModuleList::Add(
this);
350 __TModuleList::Add(
this);
368 __TModuleList::Add(
this);
388 __TModuleList::Add(
this);
407 __TModuleList::Add(
this);
422 __TModuleList::Remove(
this);
431 return __TModuleList::FindResModule(
id,
type);
465#if !defined(BI_COMP_GNUC)
474#if defined(BI_COMP_GNUC)
499#if !defined(BI_COMP_GNUC)
539struct TGetModuleFileName
542 TGetModuleFileName(
const TModule&
m) : module(
m) {}
546 int n =
module.GetModuleFileName(buf, buf_size);
547 WARN(
n ==
buf_size,
_T(
"TModule::GetModuleFileName truncated the result."));
630 TModule*
module = TModule::FindResModule(id/16+1, RT_STRING);
632 return module->LoadString(id, buf, bufSize);
651 char str[1024] =
"<empty>";
653 if( !
res ) str[0] = 0;
737 for (
int i = 0;
i <
len;
i++)
759 TModule*
module = TModule::FindResModule(id/16+1, RT_STRING);
761 return module->LoadString(id);
797 TModule*
module = TModule::FindResModule(id, RT_BITMAP);
799 return module->LoadBitmap(id);
836 TModule*
module = TModule::FindResModule(id, RT_ACCELERATOR);
838 return module->LoadAccelerators(id);
875 TModule*
module = TModule::FindResModule(id, RT_MENU);
877 return module->LoadMenu(id);
880 CHECKX(
hMenu,
_T(
"Menu resource not found even in module list."));
913 TModule*
module = TModule::FindResModule(id, RT_CURSOR);
915 return module->LoadCursor(id);
954 TModule*
module = TModule::FindResModule(name, RT_ICON);
956 return module->LoadIcon(name);
959 CHECKX(hIcon,
_T(
"Icon resource not found even in module list"));
980 TModule*
module = FindResModule(id, RT_HTML);
981 CHECKX(module,
_T(
"HTML resource not found even in the module list."));
982 return module ? module->LoadHtml(id) : string();
999 const auto r = GetClassInfo(
name, &
w);
1000 if (!
r)
throw TXOwl{
_T(
"TModule::GetClassInfo failed")};
1011 return GetClassInfo(
name, &
w) ==
true;
1023 Proc =
module.GetProcAddress(id);
1029 msg +=
module.GetName();
1039 static const tchar userStr[] =
_T(
"USER32");
1040# if defined(UNICODE)
1041 static const char LoadIconStr[] =
"LoadIconW";
1042 static const char GetClassInfoStr[] =
"GetClassInfoW";
1043 static const char GetMenuStringStr[]=
"GetMenuStringW";
1045 static const char LoadIconStr[] =
"LoadIconA";
1046 static const char GetClassInfoStr[] =
"GetClassInfoA";
1047 static const char GetMenuStringStr[]=
"GetMenuStringA";
1050static const char GetMenuStateStr[] =
"GetMenuState";
1051static const char DestroyIconStr[] =
"DestroyIcon";
1119 static const tchar verStr[] =
_T(
"VERSION.DLL");
1120# if defined(UNICODE)
1121 static const char GetFileVersionInfoStr[] =
"GetFileVersionInfoW";
1122 static const char GetFileVersionInfoSizeStr[] =
"GetFileVersionInfoSizeW";
1123 static const char VerQueryValueStr[]=
"VerQueryValueW";
1124 static const char VerLanguageNameStr[] =
"VerLanguageNameW";
1126 static const char GetFileVersionInfoStr[] =
"GetFileVersionInfoA";
1127 static const char GetFileVersionInfoSizeStr[] =
"GetFileVersionInfoSizeA";
1128 static const char VerQueryValueStr[]=
"VerQueryValueA";
1129 static const char VerLanguageNameStr[] =
"VerLanguageNameA";
1190static const tchar oleStr[] =
_T(
"OLE32.DLL");
1191static const tchar oleAutStr[] =
_T(
"OLEAUT32.DLL");
1193static const char CoCreateInstanceStr[] =
"CoCreateInstance";
1194static const char SysFreeStringStr[] =
"SysFreeString";
1195static const char SysStringLenStr[] =
"SysStringLen";
1196static const char SysAllocStringStr[] =
"SysAllocString";
1316#if OWL_PERSISTENT_STREAMS
1326 is >>
o->ShouldFree;
1337TModule::Streamer::Write(opstream&
os)
const
1339 TModule*
o = GetObject();
1341 os <<
o->ShouldFree;
1354#if defined(_BUILDOWLDLL)
1396# if OWL_PERSISTENT_STREAMS
1402TObjectWindowsLibrary::Streamer::Read(ipstream&,
uint32)
const
1411TObjectWindowsLibrary::Streamer::Write(opstream&)
const
1422# if !defined(WINELIB)
1423extern TModule*
Module = 0;
1428# if !defined(BI_COMP_BORLANDC) && !defined(BI_COMP_GNUC)
1441# if defined(BI_COMP_BORLANDC)
1463 if (::GetVersion() & 0x80000000){
1466 "This application or DLL can not be loaded "
1467 "on Windows 95 or on Windows 3.1. It takes advantage "
1468 "of Unicode features only available on Windows NT.",
1491#if !defined(BI_COMP_BORLANDC)
1504#if !defined(BI_COMP_BORLANDC) && !defined(BI_COMP_GNUC)
1528#if defined(BI_COMP_MSC)
1551#if defined(BI_COMP_BORLANDC)
1563#pragma startup __initOWL 31
1570#pragma exit __termOWL 31
1573#elif defined(BI_COMP_MSC)
1587#pragma warning(disable: 4073)
1588#pragma init_seg(lib)
1597#if defined(BI_DBCS_SUPPORT)
1611#elif defined(BI_COMP_GNUC)
1637#error Unknown compiler
ULONG DeInitAllocCheck(void)
int InitAllocCheck(eAllocCheckOutput eOutput, BOOL bSetUnhandledExeptionFilter, ULONG ulShowStackAtAlloc)
Definition of class TAppDictionary.
Definition of class TApplication.
#define WARNX(group, condition, level, message)
#define WARN(condition, message)
#define PRECONDITION(condition)
#define CHECKX(condition, message)
#define DIAG_DECLARE_GROUP(group)
#define TRACEX(group, level, message)
TApplication * GetApplication(uint pid=0)
Looks up and returns the application associated with a given process ID.
Derived from TModule and TMsgThread and virtually derived from TEventHandler, TApplication acts as an...
static tstring & GetCmdLine()
Return the command line of the application.
Class wrapper for management of color values.
Simple encapsulation of the SetErrorMode call.
TFileTime is a class derived from the structure FILETIME.
Multiple Read, Single Write section.
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
TModuleProc(const TModule &module, TNarrowResId id)
Constructs a Module entry object given a narrow Windows resource identifier.
FARPROC Proc
Derived template classes perform type-safe parameter passing on call.
static UINT SysStringLen(BSTR)
static TModule & GetModule()
static HRESULT SysFreeString(BSTR)
static BSTR SysAllocString(const OLECHAR *)
static HRESULT CoCreateInstance(REFCLSID, LPUNKNOWN, DWORD, REFIID, LPVOID *)
static TModule & GetModule()
TPointF is similar to TPoint, but uses floating variables rather than integers.
TPoint is a support class, derived from tagPOINT.
TPointL is similar to TPoint, but uses long rather than int variables.
TRect is a mathematical class derived from tagRect.
TResId encapsulates a Windows resource identifier.
The tagSIZE struct is defined as.
TSystemTime is a class derived from the structure SYSTEMTIME.
TPtrArrayIterator< T, TTypedArray< T, T, TStandardAllocator > > Iterator
static BOOL DestroyIcon(HICON)
static UINT GetMenuState(HMENU, UINT, UINT)
static HICON LoadIcon(HINSTANCE, LPCTSTR)
static BOOL GetClassInfo(HINSTANCE, LPCTSTR, LPWNDCLASS)
static int GetMenuString(HMENU, UINT, TCHAR *, int, UINT)
static TModule & GetModule()
static DWORD VerLanguageName(DWORD, TCHAR *, DWORD)
static BOOL VerQueryValue(const LPVOID, TCHAR *, LPVOID, uint *)
static BOOL GetFileVersionInfo(TCHAR *, DWORD, DWORD, LPVOID)
static DWORD GetFileVersionInfoSize(TCHAR *, LPDWORD)
static TModule & GetModule()
Type-safe encapsulation of a Windows class name, a union between ATOM and LPCTSTR.
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
int MessageBox(LPCTSTR text, LPCTSTR caption=0, uint flags=MB_OK) const
Creates and displays a message box that contains a message (text), a title (caption),...
Derived from xmsg, TXBase is the base class for ObjectWindows and ObjectComponents exception-handling...
A nested class, TXInvalidModule describes an exception that results from an invalid module.
TXOwl is root class of the ObjectWindows exception hierarchy.
ipstream, a specialized input stream derivative of pstream, is the base class for reading (extracting...
Definition of class TFrameWindow.
#define IMPLEMENT_STREAMABLE1(cls, base1)
#define IMPLEMENT_STREAMABLE(cls)
#define DECLARE_STREAMABLE(exp, cls, ver)
static void Raise(const tstring &msg, uint resId=0)
static tstring MakeMessage(uint resId, const tstring &infoStr, TModule *module=&GetGlobalModule())
auto GetString() const -> tstring
Returns the class name in string form.
void Throw()
Throws the exception.
TXInvalidModule(const tstring &name=tstring())
Creates the Invalid Module exception.
HACCEL LoadAccelerators(TResId id) const
Wrapper for the Windows API.
auto GetClassInfo(TWindowClassName, WNDCLASS *wndclass) const -> bool
Retrieves information about the given window class.
HCURSOR LoadCursor(TResId id) const
Wrapper for the Windows API.
HICON LoadIcon(TResId name) const
Wrapper for the Windows API.
int LoadString(uint id, TCHAR *buf, int maxChars) const
Loads a string resource identified by id into the buffer pointed to by buff.
HGLOBAL LoadResource(HRSRC hRsrc) const
Wrapper for the Windows API.
tstring GetModuleFileName() const
String-aware overload.
HRSRC FindResource(TResId id, TResId type) const
Wrapper for the Windows API to find a particular resource.
TModule(const tstring &name, bool shouldLoad=true, bool mustLoad=true, bool addToList=true)
Constructs a TModule object that is used as an alias for a DLL.
virtual ~TModule()
Destructs a TModule, freeing the instance if appropriate, and deleting new'd strings.
void InitModule(THandle handle, const tstring &cmdLine)
Finish-up initialization of a module.
auto IsString() const -> bool
auto GetAtom() const -> ATOM
HINSTANCE THandle
TModule encapsulates an HINSTANCE.
static TModule * FindResModule(TResId id, TResId type)
Global search for resources.
auto GetPointerRepresentation() const -> LPCTSTR
HMENU LoadMenu(TResId id) const
Wrapper for the Windows API.
auto IsRegisteredClass(TWindowClassName) const -> bool
Returns true if the given window class has been registered.
uint32 SizeofResource(HRSRC hRsrc) const
Wrapper for the Windows API.
void SetHandle(THandle handle)
Set the module instance handle.
static void Raise(const tstring &name=tstring())
Throws the exception.
HRSRC FindResourceEx(TResId id, TResId type, TLangId langId=LangNeutral) const
Wrapper for the Windows API to find a particular resource.
static TModule * NextModule(TModule *module=nullptr)
void SetName(LPCTSTR name)
Accessor function that sets the name of the module.
std::string LoadHtml(TResId) const
Loads the given HTML resource and returns it as a narrow string.
TSystemMessage()
default errorId, def language
HBITMAP LoadBitmap(TResId id) const
Wrapper for the Windows API.
virtual int Error(TXBase &x, uint captionResId, uint promptResId=0)
Replaceable exception handler; may be redefined to process OWL exceptions if canResume is false,...
int MessageBox(TWindow *wnd, const tstring &msg, const tstring &title, uint flags=MB_OK) const
TXInvalidModule * Clone()
Creates a copy of the exception.
void Init(TLangId langId)
int WINAPI DllEntryPoint(HINSTANCE hInstance, uint32 reason, LPVOID)
Definition of class TModule.
Object Windows Library (OWLNext Core)
owl::opstream & operator<<(owl::opstream &os, const TColor &c)
Insert the color value into a persistent output stream.
owl::uint16 TLangId
Holds a language ID, a predefined number that represents a base language and dialect.
tstring CopyText(int size, TGetText get_text)
Copies text from a C-string (null-terminated character array) into a string object,...
const TLangId LangNeutral
TAppDictionary & OWLGetAppDictionary()
Global exported TAppDictionary in Owl.
int HandleGlobalException(owl::TXBase &x, LPCTSTR caption, LPCTSTR canResume=nullptr)
void InitGlobalModule(HINSTANCE hInstance)
TModule & GetGlobalModule()
General definitions used by all ObjectWindows programs.
#define COUNTOF(s)
Array element count Important: Only use this with an argument of array type.
Various types of smart pointer templatized classes.
Definition of container classes used and made available by OWL.
Base window class TWindow definition, including HWND encapsulation.