Re: Calling a Activex control from a DLL
On Jan 6, 12:19 am, Joseph M. Newcomer <newco...@flounder.com> wrote:
See below...
On Mon, 5 Jan 2009 05:45:45 -0800 (PST), Matrixinline <anup.kata...@gmail=
..com> wrote:
Hi All,
I have a Activex control and I wish to call it from a DLL. The Activex
Interface implements CWnd class.
CActivex g_oActivex; // Making it Glo=
bal
BOOL CRangerDllApp::InitInstance()
{
CWinApp::InitInstance();
printf("InitInstance is Called Now....\n");
****
It is not safe to assume that a DLL is executed in a context in which pri=
ntf has meaning.
Stick with TRACE.
****> return TRUE;
}
BOOL Method1()
{
g_oActivex.SendCommand(); // I get debug Error
here.Assertion failed.
****
The g_ suggests that there is a global variable, probably a Bad Idea (not=
always, but
usually). where is this initialized? What is the error? What is =
the stack backtrace?
I have no idea what a "debug error" is.
You have said nothing about the nature of the ActiveX control. But wha=
t I see here is an
uninitialized variable.
****>}
Can You Please let me know How to create & initialize a Activex
Control inside a DLL.
*****
Inside a DLL has nothing to do with it. You have an uninitialized Acti=
veX control. Also,
you probably need to make sure that CoInitialize is called, but you can't=
do that in the
DLL's InitInstance handler (it is illegal).
Can you demonstrate the proper use of this control OUTSIDE a DLL? Othe=
rwise, you have no
reason to claim it fails only in a DLL.
*****
Thanks
Anup
Joseph M. Newcomer [MVP]
email: newco...@flounder.com
Web:http://www.flounder.com
MVP Tips:http://www.flounder.com/mvp_tips.htm
Hi Joseph,
Thanks for your suggestion about TRACE. I will surely implement it.
Yes I want my activex control to be global so I made it g_.
My Activex control is a CWnd child. I can create a dialog based
application where I use DDX_Control to initialize it. Now my point is
how to initilize it in a DLL. Do I need to Create a Dialog and add
Activex control there in Dialog inside DLL or It is not necessary to
create dialog to use Activex. I am sorry for such silly questions but
I am very new to Activex concept.
Thanks
Anup