I have used the CDTPicker (an OLE
VB control) in a few applications for some years now without the slightest problem. However, I am trying to add it to an app that I wrote some time ago under VS 6.0. We have upgraded to VS 8.0 and converted the project seemingly without any problems.
I have added the CDTPicker to the old app and it appears on the dialog after the DoModal() sequence, the control works just fine with it's dropdown and so on, but when I go to programmatically change the date in the control (or read the date as well) I get an assert condition in the following MFC code:
ASSERT(m_pCtrlSite != NULL); // not an OLE control (not yet, at least)
which is inside:
void AFX_CDECL CWnd::InvokeHelper(DISPID dwDispID, WORD wFlags, VARTYPE vtRet,
void* pvRet, const BYTE* pbParamInfo, ...)
{
ASSERT(m_pCtrlSite != NULL); // not an OLE control (not yet, at least)
if (m_pCtrlSite == NULL)
return;
}
This is because m_pCtrlSite is still NULL!
I can run (in debug) one of the applications that I have already used CDTPicker on in the past and it works perfectly and m_pCtrlSite is inited properly. I am working on the very same machine with two instances of VS running with different results for the same control.
In my debug I have:
1. copied the control from one resource editor to the other,
2. ensured that the same GUID is used to create the control in the xxx.rc file,
3. ensured that all of the values in the objects are valid through the Watch window (except m_pCtrlSite that is failing, of course)
4. compared project settings to find anything different to blame this on!
Most postings that I have read here and elsewhere state simply that the OnInitDialog() has not been completed for the dialog and the control hasn't been init'd, but I am completely through with that and the dialog page exists, with the CDTPicker controls all functioning visually before I execute the code that tries to read or write values to/from the control.
The ASSERT always fires, and the value of m_pCtrlSite is zero always, no matter where in the code I might be.
Any suggestions???
Thanks in advance!
Regards,
David