Re: Possible to pass strings back to ASP from ActriveX?



I can't find \public\ or \Windows\public\ in the Windows CE emulator. I only
have the Trial version of Windows CE which includes Platform Builder. If you
can't access that example from the Trial Version could you post the entire
code, or send it to lagu2653@xxxxxxxx?

/Lars

"John Spaith [MS]" wrote:

First, I'm not an MFC guy so I don't have any words of wisdom for walking
through the wizards & making this work via MFC wizard. But from straight
IDL/ASP, it's possible to return strings back. If you have Platform Builder
I'd recommend you check out the Web Server configuration ASP sample in
%_WINCEROOT%\public\servers\sdk\samples\http\asp.

If you don't have this code, relevant snippets would be from .idl file
there's this line:
[propget] HRESULT LogFile([in] BSTR bstrLogName, [out, retval] BSTR
*pLogData);

C++ implementation is
STDMETHODIMP CHttpAdmin::get_LogFileDirectory(BSTR *pVal)
{
const WCHAR *wszLogDir;

// It's possible they didn't have a value set.
if (NULL == (wszLogDir = m_Reg.ValueSZ(RV_LOGDIR)))
{
*pVal = NULL;
return S_OK;
}

if ( NULL == ( *pVal = SysAllocString(wszLogDir)))
return DISP_E_EXCEPTION;

return S_OK;
}

ASP script caller is
<TD><INPUT NAME = "LogFileDirectory" VALUE = "<%=
HttpdAdmin.LogFileDirectory%>"></TD>
--

If this isn't helpful or you want to patch up MFC without hacking up
generated code (ideally you let MFC generate everything for you if you go
that route), if there's no good CE docs on how to do this check out the
desktop docs. This is more a COM question than an ASP, and CE's COM is a
port of desktop with only some features added and a ton of random stuff
removed (but not automation support).

--
John Spaith
Development Lead, Windows CE
Microsoft Corporation

Check out the CE Networking Team Blog at http://blogs.msdn.com/cenet/.

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. © 2006 Microsoft Corporation. All rights
reserved.

"lagu2653" <lagu2653@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:C1BF5D58-FC6E-4F02-B3FF-41B07CE361C8@xxxxxxxxxxxxxxxx
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)
  • Possible to pass strings back to ASP from ActriveX?
    ... Is it also possible to pass it back from ActiveX, ... afx_msg int AboutBox; ... helpstring("AxTemplateTest1 ActiveX Control module"), ... helpstring("Dispatch interface for AxTemplateTest1 Control")] ...
    (microsoft.public.windowsce.embedded)
  • 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: warning - comparing a signed value to an unsinged value
    ... but the interface requires an int. ... > beyond my control. ... in your defect report be sure to include a note stating that Dennis ...
    (comp.lang.c)
  • RFC: if_clone overhaul
    ... Please test/review the following patch to the network interface cloneing ... static void ... -if_clone_lookup(const char *name, int *unitp) ... static int gifmodevent; ...
    (freebsd-net)