ProCOM Infrastructure
Introduction
ProCOM application is using PROMainDLL.dll as the interfaces factory library. PROMainDLL.dll is providing IProMain interface accessible by calling GetProMainInterface export function. IProMain interface is the interface providing GetInterface method that is the key method for creating instances of other interfaces. GetIProMain inline function defined in inthelpr.h is the common function used for accessing IProMain interface. GetPROInterface inline function is the common function used for creating interfaces instances. Next example shows how to create some instance of some interface:
_com_ptr(ISomeInterface); if (FAILED(GetPROInterface(IID_ ISomeInterface, (void**)(& ISomeInterface)), 0, 0, pParameters)) return E_FAIL;
In the example above GetPROInterface inline function will call GetIProMain function to get IProMain interface and then call GetInterface method of this interface to create an instance of the required interface.
It is important to pass 5th argument to GetPROInterface function. This is the PRO parameters – the set of properties stored in the IProperties interface that are including DSN of the connected database and the user ID for this database as well as some other important parameters. When you pass pro parameters to GetPROInterface function – the created interface instance is capable to access correct database with correct user rights and settings taken from pro parameters. Where to get the pro parameters? Pro parameters are passed to any point of the application by the GUI part. If there are no pro parameters – this is the bug and should be fixed.
In many places of the code you can find (and this is the good practice) classes where there is inline member function like in the example below: