Ask a Question related to ASP Components, Design and Development.
-
Marja Ribbers-de Vroed #1
Passing parameters by reference to a VC COM Object
I need to change a C++ COM Object so that it will correctly accept parameters by reference from an ASP/VBscript webapplication.
I'm working from the article found here: [url]http://support.microsoft.com/kb/197957/EN-US/[/url], as this article descibes my problem with the COM Object exactly.
The article gives the following original example method:
STDMETHODIMP CByRefObj::ByRefMethod( BSTR* bstrVal )
{
CComBSTR bstrRtnVal = L"This variable is passed by Reference";
*bstrVal = bstrRtnVal.Detach();
return S_OK;
}
And then at the bottom of the article, they say that the method needs to change so that it will accept a variant instead of a string as the output parameter. And as an example they suggest the following change:
// Where m_bstr is a BSTR member of SomeComObject.
vVal->vt = VT_BSTR;
vVal->bstrVal = m_bstr.Copy();
But since I don't know much C++ (I didn't write the COM object, but I do have its project sources) I don't understand where to put this in the example method.
Would anybody here be so kind to rewrite the method above to reflect the suggested change from the article?
Thanks in advance.
Regards, Marja
Marja Ribbers-de Vroed Guest
-
Dynamically loading user control into Placeholder gives Object reference not set to an instance of an object
I've created user controls that contain listboxes that are dynamically populated from the database. In the html view of the user control... -
Custom Control Problem :: Object reference not set to an instance of an object
Hi All! I have the following Custom Control file... '########### WebUserControl1.ascx ############# <%@ Control Language="vb"... -
[WebMethod] System.NullReferenceException: Object reference not set to an instance of an object.
Um, this isn't going to work, generally. Web services, as any web app (especially on Windows server 2003) are heavily sandboxed. The method you... -
Returning a reference to an existing C++ object as a reference
Hi All, Given: package x; sub new { return bless {}, $_; } #-- callback() is call by the C++ class (reader_as_cpp_object) #-- whenever... -
HELP! Error Loading ASPX : Object Reference not set to an instance object
Hello, When i run my aspx i get this weird error: System.NullReferenceException: Object reference not set to an instance of an object. at... -
Marja Ribbers-de Vroed #2
Re: Passing parameters by reference to a VC COM Object
I found help in another group, and the example function needed tobe modified to look like this:
STDMETHODIMP CByRefObj::ByRefMethod( VARIANT* vVal)
{
CComBSTR bstrRtnVal = L"This variable is passed by Reference";
vVal->vt = VT_BSTR;
vVal->bstrVal = bstrRtnVal.Detach();
return S_OK;
}
Regards, Marja
Marja Ribbers-de Vroed Guest



Reply With Quote

