12#define OLE_TYPELIB_FILE L"stdole32.tlb"
25struct TOleCreateInfo {
30 ITypeInfo* OurTypeInfo;
31 ITypeInfo* OleTypeInfo;
33 TOleCreateInfo() : OurTypeInfo(0), OleTypeInfo(0), CreateInfo(0) {}
37TOleCreateInfo::~TOleCreateInfo()
40 OurTypeInfo->Release();
42 OleTypeInfo->Release();
44 CreateInfo->Release();
47struct TOleCreateList {
58 ITypeInfo* AttrTypeInfo;
65 ~TOleCreateList() {Clear();}
72 OleLib(0), OleComp(0), OleInfo(0),
73 CreateLib(0), TypeAttr(0), LibAttr(0), List(0), FuncNames(0)
81 OLECALL(OleLib->GetTypeComp(&OleComp),
_T(
"GetTypeComp"));
91 OLECALL(TypeLib->GetLibAttr(&LibAttr),
_T(
"GetLibAttr"));
93 _T(
"GetDocumentation for library"));
95 OLECALL(CreateLib->SetGuid(LibAttr->guid),
_T(
"Set TypeLib GUID"));
96 OLECALL(CreateLib->SetLcid(LibAttr->lcid),
_T(
"Set TypeLib language"));
97 OLECALL(CreateLib->SetLibFlags(LibAttr->wLibFlags),
_T(
"Set TypeLib flags"));
105 OLECALL(CreateLib->SetHelpContext(helpId),
_T(
"HelpContext"));
107 OLECALL(CreateLib->SetVersion(LibAttr->wMajorVerNum,
108 LibAttr->wMinorVerNum),
_T(
"Set TypeLib version"));
110 Count = TypeLib->GetTypeInfoCount();
111 List =
new TOleCreateInfo[Count];
115 OLECALL(TypeLib->GetTypeInfo(
nInfo, &AttrTypeInfo),
_T(
"GetTypeInfo"));
116 info.OurTypeInfo = AttrTypeInfo;
117 OLECALL(
info.OurTypeInfo->GetTypeAttr(&TypeAttr),
_T(
"GetTypeAttr"));
119 _T(
"GetDocumentation for TypeInfo"));
121 _T(
"Create CreateTypeInfo"));
124 (
void **)&
info.OleTypeInfo),
_T(
"QueryInterface for ITypeInfo"));
129 TypeAttr->wMinorVerNum),
_T(
"Set TypeInfo version"));
137 info.TypeKind = TypeAttr->typekind;
138 info.FuncCount = TypeAttr->cFuncs;
139 info.VarCount = TypeAttr->cVars;
140 info.ImplCount = TypeAttr->cImplTypes;
141 info.OurTypeInfo->ReleaseTypeAttr(TypeAttr), TypeAttr = 0;
147 OLECALL(CreateLib->SaveAllChanges(),
_T(
"Write and close TypeLib file"));
148 CreateLib->Release();
153 _T(
"Register type library"));
156void TOleCreateList::Clear()
161 TypeLib->ReleaseTLibAttr(LibAttr);
163 AttrTypeInfo->ReleaseTypeAttr(TypeAttr);
171 CreateLib->Release();
209 for (index = 0; index <
curInfo.FuncCount; index++) {
216 &helpId, 0),
_T(
"Get method name and doc"));
219 &helpId, 0),
_T(
"Get method name and doc"));
231 nNames),
_T(
"Set method parameter names"));
239 for (index = 0; index <
curInfo.VarCount; index++) {
246 &helpId, 0),
_T(
"Get propery name and doc"));
249 &helpId, 0),
_T(
"Get propery name and doc"));
259 for (index = 0; index <
curInfo.ImplCount; index++) {
293 iGuid ^= DebugGuidOffset;
306 CoClassImplCount = 0;
307 TAutoClass::TAutoClassRef*
ref = AppDesc.ClassList;
308 for (
int index = 0; index < AppDesc.ClassCount; index++,
ref++) {
321 if (AppDesc.TypeLib ==
this)
330 ITypeInfo*
ifc =
new TCoClassInfo(AppDesc, CoClassFlags, CoClassImplCount);
349TTypeLibrary::AddRef()
355TTypeLibrary::Release()
364TTypeLibrary::GetTypeInfoCount()
370TTypeLibrary::GetTypeInfo(
unsigned index, ITypeInfo* *
retInfo)
395TTypeLibrary::GetTypeInfoOfGuid(
const GUID &
guid, ITypeInfo* *
retInfo)
435TTypeLibrary::GetDocumentation(
int index,
BSTR *
retName,
468 TAutoClass::TAutoClassRef*
ref = AppDesc.ClassList;
469 for (
int index = 0; index < AppDesc.ClassCount; index++,
ref++) {
470 TAutoClass*
cls =
ref->Class;
488 unsigned short found = 0;
489 TAutoClass::TAutoClassRef*
ref = AppDesc.ClassList;
492 TAutoClass*
cls =
ref->Class;
514 TAutoClass::TAutoClassRef*
ref = AppDesc.ClassList;
535 ImplList[
iclass++] = index;
540 if (DefaultEvent == -1)
563TCoClassInfo::AddRef()
569TCoClassInfo::Release()
585 ta->cImplTypes = (
unsigned short)ImplCount;
588 ta->wTypeFlags = TypeFlags;
621TCoClassInfo::CreateInstance(IUnknown* ,
const IID & ,
628TCoClassInfo::GetContainingTypeLib(ITypeLib* *
retLib,
648TCoClassInfo::GetImplTypeFlags(
unsigned int index,
int *
retflags)
650 TAutoClass*
cls = index < (
uint)ImplCount ?
656 if (index == (
uint)DefaultEvent)
660 if (index == (
uint)Default)
668TCoClassInfo::GetRefTypeOfImplType(
unsigned int index,
671 TAutoClass*
cls = index < (
uint)ImplCount ?
680TCoClassInfo::GetFuncDesc(
unsigned int,
FUNCDESC * *)
686TCoClassInfo::ReleaseFuncDesc(
FUNCDESC *)
691TCoClassInfo::GetVarDesc(
unsigned int,
VARDESC * *)
697TCoClassInfo::ReleaseVarDesc(
VARDESC *)
702TCoClassInfo::GetNames(
MEMBERID,
BSTR *,
unsigned int,
unsigned int *)
TAppDescriptor - OLE application descriptor definitions.
bool GetClassId(TAutoClass *cls, GUID &retId)
Retrieves the GUID of the specified TAutoClass instance.
TAutoClass * GetAutoClass(unsigned index)
Returns the TAutoClass instance as the specified index.
friend class _ICLASS TTypeLibrary
void WriteTypeLibrary(owl::TLangId lang, LPCTSTR file)
LPCTSTR GetAppDoc(owl::TLangId lang)
ITypeLib * GetTypeLibrary()
Returns the 'ITypeLib' interface pointer describing the objects exposed by this instance of 'TAppDesc...
LPCTSTR GetAppName(owl::TLangId lang)
owl::uint16 GetVersionField(owl::uint field)
Returns version as a whole number.
owl::TLangId GetAppLang()
LPCTSTR GetHelpFile(owl::TLangId lang)
ITypeInfo * CreateITypeInfo(TAutoClass &cls)
int GetClassIndex(TAutoClass *cls)
Returns the index of a 'TAutoClass' instance.
int GetOffset(const GUID &guid)
TCoClassInfo(TAppDescriptor &appDesc, owl::uint16 typeFlags, int implCount)
OLE object exposed for automated access of internal object.
TTypeLibrary(TAppDescriptor &appDesc, owl::TLangId lang)
ITypeInfo * CreateCoClassInfo()
The TFileName class constructs filenames.
@ Device
Logical device or sharename.
@ Path
Directory path to the file.
const tchar * GetParts(uint p) const
Reassembles any logical subset of filename parts.
static BSTR SysAllocString(const OLECHAR *)
static auto GetClassesRoot() -> TRegKey &
Special predefined root key used by shell and OLE applications (HKEY_CLASSES_ROOT).
LPCTSTR Lookup(LPCSTR key, TLangId lang=TLocaleString::UserDefaultLangId)
Performs the lookup of the TRegItems using a key (an item name such as progid) and returns the value ...
System string (BSTR) encapsulation.
int GetModuleFileName(TCHAR *buff, int maxChars) const
Returns the expanded file name (path and file name) of the file from which this module was loaded.
Include for OC, gets common headers when precompiled headers are enabled.
Object Component Framework (COM encapsulation)
@ asOleType
method or property exposed for OLE
owl::TSysStr TBSTR
BASIC global string encapsulation.
class _ICLASS TCoClassInfo
Object Windows Library (OWLNext Core)
owl::uint16 TLangId
Holds a language ID, a predefined number that represents a base language and dialect.
Definition of TOcControl class - Proxy object representing a control in.
#define HR_TYPE_WRONGTYPEKIND
#define HR_TYPE_ELEMENTNOTFOUND
#define HR_TYPE_LIBNOTREGISTERED
#define HR_TYPE_UNSUPFORMAT
#define OLECALL(func, msg)