Possible to pass strings back to ASP from ActriveX?
- From: lagu2653 <lagu2653@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 25 May 2006 13:53:02 -0700
I posted earlier and Chris tld me it was possible to pass strings from ASP to
an ActiveX object. Is it also possible to pass it back from ActiveX, written
in C++, to ASP. I tried to create a new "MFC Smart Device ActiveX control" in
VS2005. My methods were visible to ASP and the IObjectSafety was implemented
by default but I couldn't return any strings. I couldn't even call a method
which didn't return anything and didn't have any in-parameters without
getting a:
##########################################################################
HTTP 500.100 - Internal server error - ASP-error
Error type:
(0x8000FFFF)
irrevocable error
/tabletestcpp.asp, line 3
Page:
GET /tabletestcpp.asp
##########################################################################
In AxTestTemplateCtrl1.h I changed:
afx_msg int AboutBox(); // Actually AboutBox returned void previously
to
afx_msg int AboutBox();
int Question();
##########################################################################
In Resource.h I changed:
#define IDD_ABOUTBOX_AXTEMPLATETEST1 1
to
#define IDD_ABOUTBOX_AXTEMPLATETEST1 1
#define IDD_QUESTION_AXTEMPLATETEST1 1
##########################################################################
In AXTemplate.idl I changed:
[id(DISPID_ABOUTBOX)] int AboutBox();
to
[id(DISPID_ABOUTBOX)] int AboutBox();
[id(DISPID_ QUESTION)] int Question();
A major part of the file:
#define DISPID_QUESTION (-804)
[ uuid(DF4F7FC6-E01D-4FFE-8EC5-5916BEE8E034), version(1.0),
helpfile("AxTemplateTest1.hlp"),
helpstring("AxTemplateTest1 ActiveX Control module"),
control ]
library AxTemplateTest1Lib
{
importlib(STDOLE_TLB);
// Primary dispatch interface for CAxTemplateTest1Ctrl
[ uuid(F009FE68-00BB-40AF-822B-09498C1D7961),
helpstring("Dispatch interface for AxTemplateTest1 Control")]
dispinterface _DAxTemplateTest1
{
properties:
methods:
[id(DISPID_ABOUTBOX)] int AboutBox();
[id(DISPID_QUESTION)] int Question();
};
// Event dispatch interface for CAxTemplateTest1Ctrl
[ uuid(FF7AEE09-2089-4978-B6DB-C94EB843A932),
helpstring("Event interface for AxTemplateTest1 Control") ]
dispinterface _DAxTemplateTest1Events
{
properties:
// Event interface has no properties
methods:
};
// Class information for CAxTemplateTest1Ctrl
[ uuid(789AC977-B160-41BE-902A-1D032D722E89),
helpstring("AxTemplateTest1 Control"), control ]
coclass AxTemplateTest1
{
[default] dispinterface _DAxTemplateTest1;
[default, source] dispinterface _DAxTemplateTest1Events;
};
};
##########################################################################
In AxTestTemplateCtrl1.h I changed:
// Dispatch map
#define DISPID_QUESTION (-804)
BEGIN_DISPATCH_MAP(CAxTemplateTest1Ctrl, COleControl)
DISP_FUNCTION_ID(CAxTemplateTest1Ctrl, "AboutBox",
DISPID_ABOUTBOX, AboutBox, VT_I4, VTS_NONE)
//DISP_FUNCTION_ID( theClass, pszName, dispid, pfnMember, vtRetVal,
vtsParams )
END_DISPATCH_MAP()
to
// Dispatch map
#define DISPID_QUESTION (-804)
BEGIN_DISPATCH_MAP(CAxTemplateTest1Ctrl, COleControl)
DISP_FUNCTION_ID(CAxTemplateTest1Ctrl, "AboutBox",
DISPID_ABOUTBOX, AboutBox, VT_I4, VTS_NONE)
DISP_FUNCTION_ID(CAxTemplateTest1Ctrl, "Question", DISPID_QUESTION,
Question, VT_I4, VTS_NONE)
//DISP_FUNCTION_ID( theClass, pszName, dispid, pfnMember, vtRetVal,
vtsParams )
END_DISPATCH_MAP()
##########################################################################
In AxTestTemplateCtrl1.h I changed:
// CAxTemplateTest1Ctrl::AboutBox - Display an "About" box to the user
int CAxTemplateTest1Ctrl::AboutBox()
{
CDialog dlgAbout(IDD_ABOUTBOX_AXTEMPLATETEST1);
dlgAbout.DoModal();
}
to
// CAxTemplateTest1Ctrl::AboutBox - Display an "About" box to the user
int CAxTemplateTest1Ctrl::AboutBox()
{
return 321;
CDialog dlgAbout(IDD_ABOUTBOX_AXTEMPLATETEST1);
dlgAbout.DoModal();
}
int CAxTemplateTest1Ctrl::Question()
{
return 321;
}
##########################################################################
.
- Follow-Ups:
- Re: Possible to pass strings back to ASP from ActriveX?
- From: John Spaith [MS]
- Re: Possible to pass strings back to ASP from ActriveX?
- Prev by Date: Re: SMSC LAN9118 driver with PXA270
- Next by Date: Re: Message between threads
- Previous by thread: Re: SMSC LAN9118 driver with PXA270
- Next by thread: Re: Possible to pass strings back to ASP from ActriveX?
- Index(es):
Relevant Pages
|