You'll probably find there's an assertion in winocc.cpp on line 345. Have a look at that source file to see what it's checking for (what you shouldn't be doing), and then stop doing it :-)
If you don't have the source code, then you'll have to either:
- contact whoever wrote it and find out what the assertion is; or
- read the API docs to see if you're doing something wrong.
An assertion is a runtime check that coder use to ensure rules are being followed or unexpected situations are caught before any real damage is done. Things like a doubly linked list becoming corrupt (e.g., something like assert (x->next->prev != x), which will assert a problem if node A's previous node doesn't have node A as a next node).
Something like:
Assert (p1 == NULL);
(in my mythical language in case I have the C syntax wrong) at the start of a function will raise an assertion if p1 is equal to NULL.
A web search turns up the following at line 345 (see here):
ASSERT(m_pCtrlSite != NULL); // not an OLE control (not yet, at least).
and it looks to be a problem with the fact that you're trying to dynamically create a licensed ActiveX control. That link also contains a KB number Q151804 which says that it's by design (which means MS probably won't have fixed it) - you need to create the control with a valid license string.
One other comment that I found states:
It is not sufficient to just create an instance of ActiveX control. An ActiveX control has to be properly hosted before it can be used. Yours isn't. You need to, say, put it on a dialog and create an instance of that dialog.
Without seeing the rest of your code, it's hard to tell if this is your specific problem, but if your line 345 is the one I think it is, that makes sense - it's complaining that the control site is NULL (i.e., the control is not hosted).
One final thing to watch out for:
If your ActiveX control is in a dialog, are you trying to do something to the control before you call the dialog's DoModal()
?
The control will only be initialized after you call DoModal()
so you cannot play with the control until after that's happened. You should do this in the dialogs OnInitDialog()
- at that point, the control should be fully initialized and you can do what you want with it.
If you're trying to use parameters from the dialogs constructor to manipulate the control, you need to store them somewhere in the dialog and transfer them to the control in OnInitDialog()
.
This information was gathered mostly from here.