ActiveX Event Not Firing (event called from an external DLL)

ActiveX Event Not Firing (event called from an external DLL)

Post by simpsonn » Fri, 03 Dec 2004 11:18:49


yes. The following is part of the html:
<SCRIPT LANGUAGE="javascript">
function press_key(key)
{
test.press_key(key);
}
function setfuncpointer(type_s,param)
{
alert(type_s);
}
</SCRIPT>

<script Language="vbScript">
sub test_setfuncpointer(type_s,param)
msgbox(type_s&" "¶m)
end sub
</script>

<body>
<p style="margin-bottom: 5">
<object ID="test" classid="clsid:5346DF1B-FDD7-4A33-81AD-0559D5E0488B"
codebase="testlib.cab#Version=1,0,0,0" VIEWASTEXT>
</object>
</p>
</body>

The event can be catched by the javascript when the event is fired by the
activex control class.

SHORT Ctestlib_activexCtrl::logout(void)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
// TODO: Add your dispatch handler code here

setfuncpointer("logout","logout");

return 0;
}

But it fails when it is fired by a function (which does not belong to
activex obj). The following is the function called by the external DLL:

void update_caller_number(char * param, DWORD app){
Ctestlib_activexCtrl * pThis=(Ctestlib_activexCtrl *)app;
AFX_MANAGE_STATE(AfxGetStaticModuleState());
char temp_string[32]="";
if (param!=NULL){
memcpy(temp_string,param,strlen(param));
}
CString param1=temp_string;
CString param2=temp_string;
pThis->setfuncpointer(param1,param2);
}

(P.S. Ctestlib_activexCtrl is the control class of the activex obj)

Thank you so much!