I am working on an OLEDB Provider that for now leverages the "default" connection dialog provided by IDBPromptInitialize::PromptDataSource()
which looks like this. The same UI appears when I use my provider with certain client tools like MS Excel or a .udl-file. I am now planning to create my own UI.
When choosing different OLEDB Providers in the Provider tab, I noticed that for some of them the Connection tab looks quite different, e.g. SQL Server Native Client 11.0.
So customizing it seems to be technically possible. My question is: how?
NOTE: I am aware that I can put together my own UI and that I can pop it up whenever I want. But that won't be magically integrated into that Connection tab of the Data Link Properties dialog, will it?
Thanks!
Apparently, I was to fast with accepting the answer. I performed all steps as described. When I use my provider in my own test application that creates a property sheet, everything works [beautifully][3]. My test app calls ISpecifyPropertyPages::GetPages
on my provider and passes the result to OleCreatePropertyFrame
as described in the answer.
However, when I use it with the Data Link dialog, as soon as I select my provider and klick the Next button or one of the tabs, the tabs just disappear. Only the Provider tab stays.
Debugging it I can see that GetPages
is successfully called, but then only my ConnectionTab's constructor is called (without any error) and right after that the tabs disappear (no crash!). No IPropertyPage
method nor anything else was invoked.
Any Idea what could be the issue?
Ok, I've got it. In my AdvancedTab class I was missing the COM_INTERFACE_ENTRY(IPersistPropertyBag)
in the COM Map. I was focussing too much on the Connection tab as I wanted to have that working first.
If anyone is interested:
Putting #define _ATL_DEBUG_QI
before #include <atlcom.h>
made me discover that the QueryInterface
call failed for IPersistPropertyBag
.
This is described here: Interfaces Implemented by the Provider
The OLEDB provider's object that implements IIDBInitialize
/IDBProperties
must also implement IServiceProvider
.
The system will call this IServiceProvider
implementation with OLEDB_SVC_DSLPropertyPages
(from MSDAGUID.H) as the service guid and ISpecifyPropertyPages as the interface ID.
ISpecifyPropertyPages::GetPages Fills a counted array of GUID values, where each GUID specifies the CLSID of each property page that can be displayed in the property sheet for this object. GetPages is called by the Data Link core component to get an array of exactly two CLSIDs that represent the extensible property pages: the first to replace the Connection tab, and the second to replace the Advanced tab. These pages must be registered properly so that they can be cocreated by the Data Link core component in-process.
These property pages are standard Windows property pages.