473,406 Members | 2,217 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Pointers in ASP

Hi to all,

I've integrate a custom ActiveX (builded in C++) in my ASP pages, but now I
have a question/problem.
I have a function which uses the pointers as parameters.
When I call this function in my ASP page I have this error (Data type
missmatch..)
e.g.
dim param1
dim param2
param1 = ""
param2 = ""
retval = myActiveX.myFunction (param1, param2)

myFunction is declared as follow:
long CmyActiveXCtrl::myFunction(BSTR FAR* param1, BSTR FAR* param2)

It is possible to call this function without making changes to the ActiveX
source code?

Please help
Thanks
Jul 19 '05 #1
3 3486
I don't think so.

I haven't done may C++ com objects that return strings but I am pretty sure
that you have to return the value by using pointers to VARIANT. That's what
the methods I created used do and they work.

Here are the key parts of a working function that returns a single string
( I've removed some code that doesn't affect returning the string):

STDMETHODIMP CHTTPDloader::ASyncGet(BSTR strTargetURL, BSTR strDestDir, long
nOptions, VARIANT* strDownloadID)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())

USES_CONVERSION;

ASSERT( strDownloadID != NULL );
if( strDownloadID == NULL )
{
return( E_POINTER );
}

try
{

CString strURL;
CString strDestination;
COleVariant vtOut;

strURL = OLE2T( strTargetURL );
strDestination = OLE2T( strDestDir );

//clear any existing value
vtOut.Attach( *strDownloadID );
vtOut.Clear();

vtOut.Detach();
strDownloadID->vt = VT_BSTR;
strDownloadID->bstrVal = (DoAsyncGet( strURL, strDestination,
nOptions )).AllocSysString();

}
catch(...)
{
return E_FAIL;
}

return S_OK;
}

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"MeAndI" <se******@libero.it> wrote in message
news:P1**********************@twister2.libero.it.. .
Hi to all,

I've integrate a custom ActiveX (builded in C++) in my ASP pages, but now I have a question/problem.
I have a function which uses the pointers as parameters.
When I call this function in my ASP page I have this error (Data type
missmatch..)
e.g.
dim param1
dim param2
param1 = ""
param2 = ""
retval = myActiveX.myFunction (param1, param2)

myFunction is declared as follow:
long CmyActiveXCtrl::myFunction(BSTR FAR* param1, BSTR FAR* param2)

It is possible to call this function without making changes to the ActiveX
source code?

Please help
Thanks

Jul 19 '05 #2
OK Mark.
Now I understand, thanks

The problem happens because the pointer type is BSTR instead of VARIANT.
But now I have another question for you:

My ASP code is:

<%
objectTest = Server.CreateObject("myobject.progID")
dim retval
retval = objectTest.eFunction()
%>

The object creation is done correctly, but when I call one function that
doesn't need params I have the following error:
0x8000FFFF (Catastrophic failure)

Do you have thoughts?
"Mark Schupp" <ms*****@ielearning.com> ha scritto nel messaggio
news:eo*************@tk2msftngp13.phx.gbl...
I don't think so.

I haven't done may C++ com objects that return strings but I am pretty sure that you have to return the value by using pointers to VARIANT. That's what the methods I created used do and they work.

Here are the key parts of a working function that returns a single string
( I've removed some code that doesn't affect returning the string):

STDMETHODIMP CHTTPDloader::ASyncGet(BSTR strTargetURL, BSTR strDestDir, long nOptions, VARIANT* strDownloadID)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())

USES_CONVERSION;

ASSERT( strDownloadID != NULL );
if( strDownloadID == NULL )
{
return( E_POINTER );
}

try
{

CString strURL;
CString strDestination;
COleVariant vtOut;

strURL = OLE2T( strTargetURL );
strDestination = OLE2T( strDestDir );

//clear any existing value
vtOut.Attach( *strDownloadID );
vtOut.Clear();

vtOut.Detach();
strDownloadID->vt = VT_BSTR;
strDownloadID->bstrVal = (DoAsyncGet( strURL, strDestination,
nOptions )).AllocSysString();

}
catch(...)
{
return E_FAIL;
}

return S_OK;
}

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"MeAndI" <se******@libero.it> wrote in message
news:P1**********************@twister2.libero.it.. .
Hi to all,

I've integrate a custom ActiveX (builded in C++) in my ASP pages, but now
I
have a question/problem.
I have a function which uses the pointers as parameters.
When I call this function in my ASP page I have this error (Data type
missmatch..)
e.g.
dim param1
dim param2
param1 = ""
param2 = ""
retval = myActiveX.myFunction (param1, param2)

myFunction is declared as follow:
long CmyActiveXCtrl::myFunction(BSTR FAR* param1, BSTR FAR* param2)

It is possible to call this function without making changes to the

ActiveX source code?

Please help
Thanks


Jul 19 '05 #3
I would remove all code from the function except that needed to return the
value. Make sure that there is no error with the empty function. Then
gradually add code back in until the error returns. That will tell what is
causing it.

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"MeAndI" <se******@libero.it> wrote in message
news:W4**********************@twister2.libero.it.. .
OK Mark.
Now I understand, thanks

The problem happens because the pointer type is BSTR instead of VARIANT.
But now I have another question for you:

My ASP code is:

<%
objectTest = Server.CreateObject("myobject.progID")
dim retval
retval = objectTest.eFunction()
%>

The object creation is done correctly, but when I call one function that
doesn't need params I have the following error:
0x8000FFFF (Catastrophic failure)

Do you have thoughts?
"Mark Schupp" <ms*****@ielearning.com> ha scritto nel messaggio
news:eo*************@tk2msftngp13.phx.gbl...
I don't think so.

I haven't done may C++ com objects that return strings but I am pretty

sure
that you have to return the value by using pointers to VARIANT. That's

what
the methods I created used do and they work.

Here are the key parts of a working function that returns a single string
( I've removed some code that doesn't affect returning the string):

STDMETHODIMP CHTTPDloader::ASyncGet(BSTR strTargetURL, BSTR strDestDir,

long
nOptions, VARIANT* strDownloadID)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())

USES_CONVERSION;

ASSERT( strDownloadID != NULL );
if( strDownloadID == NULL )
{
return( E_POINTER );
}

try
{

CString strURL;
CString strDestination;
COleVariant vtOut;

strURL = OLE2T( strTargetURL );
strDestination = OLE2T( strDestDir );

//clear any existing value
vtOut.Attach( *strDownloadID );
vtOut.Clear();

vtOut.Detach();
strDownloadID->vt = VT_BSTR;
strDownloadID->bstrVal = (DoAsyncGet( strURL, strDestination,
nOptions )).AllocSysString();

}
catch(...)
{
return E_FAIL;
}

return S_OK;
}

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"MeAndI" <se******@libero.it> wrote in message
news:P1**********************@twister2.libero.it.. .
Hi to all,

I've integrate a custom ActiveX (builded in C++) in my ASP pages, but

now
I
have a question/problem.
I have a function which uses the pointers as parameters.
When I call this function in my ASP page I have this error (Data type
missmatch..)
e.g.
dim param1
dim param2
param1 = ""
param2 = ""
retval = myActiveX.myFunction (param1, param2)

myFunction is declared as follow:
long CmyActiveXCtrl::myFunction(BSTR FAR* param1, BSTR FAR* param2)

It is possible to call this function without making changes to the

ActiveX source code?

Please help
Thanks



Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

27
by: Susan Baker | last post by:
Hi, I'm just reading about smart pointers.. I have some existing C code that I would like to provide wrapper classes for. Specifically, I would like to provide wrappers for two stucts defined...
3
by: ozbear | last post by:
This is probably an obvious question. I know that pointer comparisons are only defined if the two pointers point somewhere "into" the storage allocated to the same object, or if they are NULL,...
9
by: Mikhail Teterin | last post by:
Hello! I'd like to have a variable of a pointer-to-function type. The two possible values are of type (*)(FILE *) and (*)(void *). For example: getter = straight ? fgetc : gzgetc; nextchar...
12
by: Lance | last post by:
VB.NET (v2003) does not support pointers, right? Assuming that this is true, are there any plans to support pointers in the future? Forgive my ignorance, but if C# supports pointers and C# and...
14
by: Alf P. Steinbach | last post by:
Not yet perfect, but: http://home.no.net/dubjai/win32cpptut/special/pointers/ch_01.pdf http://home.no.net/dubjai/win32cpptut/special/pointers/ch_01_examples.zip To access the table of...
92
by: Jim Langston | last post by:
Someone made the statement in a newsgroup that most C++ programmers use smart pointers. His actual phrase was "most of us" but I really don't think that most C++ programmers use smart pointers,...
4
by: Josefo | last post by:
Hello, is someone so kind to tell me why I am getting the following errors ? vector_static_function.c:20: error: expected constructor, destructor, or type conversion before '.' token...
25
by: J Caesar | last post by:
In C you can compare two pointers, p<q, as long as they come from the same array or the same malloc()ated block. Otherwise you can't. What I'd like to do is write a function int comparable(void...
54
by: Boris | last post by:
I had a 3 hours meeting today with some fellow programmers that are partly not convinced about using smart pointers in C++. Their main concern is a possible performance impact. I've been explaining...
2
by: StevenChiasson | last post by:
For the record, not a student, just someone attempting to learn C++. Anyway, the problem I'm having right now is the member function detAddress, of object controller. This is more or less, your...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.