Possible to pass strings back to ASP from ActriveX?



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;
}
##########################################################################


.



Relevant Pages

  • Re: Possible to pass strings back to ASP from ActriveX?
    ... afx_msg int AboutBox; ... helpstring("AxTemplateTest1 ActiveX Control module"), ... // Primary dispatch interface for CAxTemplateTest1Ctrl ... helpstring("Dispatch interface for AxTemplateTest1 Control")] ...
    (microsoft.public.windowsce.embedded)
  • Re: Possible to pass strings back to ASP from ActriveX?
    ... afx_msg int AboutBox; ... helpstring("AxTemplateTest1 ActiveX Control module"), ... // Primary dispatch interface for CAxTemplateTest1Ctrl ... helpstring("Dispatch interface for AxTemplateTest1 Control")] ...
    (microsoft.public.windowsce.embedded)
  • Re: difference between a .dll and .ocx????
    ... You used "ActiveX is just a specific type of COM interface" which for me ... "ActiveX controls, formerly known as OLE controls or OCX controls,.. ... What is the difference between an OLE control and an ActiveX control? ...
    (microsoft.public.dotnet.framework)
  • Re: Possible to pass strings back to ASP from ActriveX?
    ... I'm not an MFC guy so I don't have any words of wisdom for walking ... afx_msg int AboutBox; ... helpstring("AxTemplateTest1 ActiveX Control module"), ... helpstring("Dispatch interface for AxTemplateTest1 Control")] ...
    (microsoft.public.windowsce.embedded)
  • Re: Internationalization
    ... ActiveX is not one the programmer necessarily has control over. ... I delivered used a graphics support package, which only had an ActiveX ... OleDB database interface is clearly an OLE interface. ...
    (microsoft.public.vc.mfc)