473,387 Members | 1,374 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,387 software developers and data experts.

how to display a BSTR string returned by c++ component in HTML

hi,

i have an asp page which creates a object using server.createobject and
uses its method.

example:

set obj1= server.createobject("test.test") ' test is a dll
tmp = obj1.method() ' it returns a BSTR string.

i want to display tmp in HTML. when i tried to print tmp like
<font><%=tmp%></font>

i get some garbage value.
any idea.
thanks

Mar 29 '06 #1
3 2398

"babu17" <ar****************@gmail.com> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
hi,

i have an asp page which creates a object using server.createobject and
uses its method.

example:

set obj1= server.createobject("test.test") ' test is a dll
tmp = obj1.method() ' it returns a BSTR string.

i want to display tmp in HTML. when i tried to print tmp like
<font><%=tmp%></font>

i get some garbage value.
any idea.
thanks


A BSTR is the native string data type used by ASP scripts.

<%=tmp%>

Is a reasonable way to send the string to the client. However the string
will be converted to the current Response or Session CodePage. This
defaults to the servers system codepage.

If tmp is holding say some Cryllic characters and you attempt to write to
the client whilst the current response codepage is Western Latin then you
can expect to see garbage.

Anthony.
Mar 29 '06 #2

"babu17" <ar****************@gmail.com> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
hi,

i have an asp page which creates a object using server.createobject and
uses its method.

example:
it would be a good idea to show us the C++ component code.
Most times this goes wrong, the programmer assumes that a BSTR is a LPWSTR
or faulty encodes
obj1.method()

set obj1= server.createobject("test.test") ' test is a dll
tmp = obj1.method() ' it returns a BSTR string.

i want to display tmp in HTML. when i tried to print tmp like
<font><%=tmp%></font>

i get some garbage value.
any idea.
thanks


Mar 29 '06 #3
In C++ method you can use BSTR CopyTo call this allocates the new fresh
string and u can see it in asp page

"Egbert Nierop (MVP for IIS)" <eg***********@nospam.invalid> wrote in
message news:eO*************@TK2MSFTNGP12.phx.gbl...

"babu17" <ar****************@gmail.com> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
hi,

i have an asp page which creates a object using server.createobject and
uses its method.

example:


it would be a good idea to show us the C++ component code.
Most times this goes wrong, the programmer assumes that a BSTR is a LPWSTR
or faulty encodes
obj1.method()

set obj1= server.createobject("test.test") ' test is a dll
tmp = obj1.method() ' it returns a BSTR string.

i want to display tmp in HTML. when i tried to print tmp like
<font><%=tmp%></font>

i get some garbage value.
any idea.
thanks

Apr 12 '06 #4

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

Similar topics

1
by: Chris | last post by:
I am not sure if this is the right newsgroup. But does anyone know what is the difference between a BSTR and a LPOLESTR? The only thing I could find out is that the advantage of taking BSTR...
2
by: banski | last post by:
Hi, Im trying to find out how to convert a SYSTEMTIME to BSTR. Cant find out how to do that. Hopefully some of you could help me out. Best regards Thomas
7
by: Gilad Walden | last post by:
I use C# in .NET framework. I have an ActiveX implemented in C++ that has a COM interface method that gets as it’s out parameter a BSTR* . The interop translates this BSTR* into C# string. From...
8
by: Michael Tissington | last post by:
I have a C++ function in a DLL of the form BSTR WINAPI DoSomeWork(LPCSTR szConnection, LPCSTR szGUID) I use SysAllocStringByteLen to return a BSTR. For the most part this works accept when...
0
by: Edwin Knoppert | last post by:
I'm currently using a wrapper which converts an ANSI BSTR from a dll. (Yes, singlebyte but BSTR ! ) This works fine and i'm aware BSTR's returned must be destroyed by the caller, which i do. ...
5
by: Matt Helm | last post by:
I am using win32com to access a third party COM interface but am having trouble using the string that is returned. The vendor's docs show the following method: HRESULT CookString(BSTR param_a,...
5
by: bluter | last post by:
We have server components which were created by a third party and compiled in VC++5 (sp3). They run fine on NT4 and 2000, however during testing of our migration to Server 2003, these components...
37
by: Egbert Nierop \(MVP for IIS\) | last post by:
In win32 mode, a BSTR was UINT length prefixed and terminated exactly by a zero char. So if you allocated "Hello World" that would allocate 28 bytes. In x64 and (IA64 as well) it would become...
4
by: Abubakar | last post by:
Hi, Lets say I write this line: BSTR b = m_pdoc->Getxml (); where m_pdoc is MSXML2::IXMLDOMDocumentPtr. Now "b" contains the xml text. When I exit the function in which this line is written,...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

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.