
Using the CommonDialog ActiveX Control from within an ATL COM dll
The OCX uses the file dialog internally - it is all about the flags you
initialize it with... Shortly, don't bother about the OCX in VC...
--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================
Hi,
I previously wrote a component using ATL technology in C++ that had a browse
interface on it allowing users to browse for a specific file to load. When
writing a variation of the component in VB (as a means of demonstrating the
different methods a third party can write their own versions whilst still
keeping to the interface construct) I realised that the browse dialogs were
different between both versions. The C++ one uses the CFileDialog class
whilst the VB one uses the ActiveX CommonDialog control. In order that I
keep the consistency between the versions I decided to try and use the
ActiveX Control from within my ATL Component. I tried to instantiate the
CommonDialog object through its smart pointer interface. This caused no
problem and I could go on to set various properties prior to displaying the
dialog. However, when I issue the ShowSave method on the interface I get the
following error shown in the debug output pane -
HEAP[ImporterTestHarness.exe]: Heap block at 001490B8 modified at 001490C0
past requested size of 0HEAP[ImporterTestHarness.exe]: Invalid Address
specified to RtlFreeHeap(130000, 1490c0 )
First-chance exception in ImporterTestHarness.exe (KERNEL32.DLL):
0xE06D7363: Microsoft C++ Exception.
The Dialog is not displayed and several User breakpoints are encountered. I
was wondering if anyone might have any idea what is going on?
JP