🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #12552

Re: converting wstring into string

#12552
From: Remy Lebeau (TeamB)
Date: Tue, 02 Dec 2003 18:11
19 lines
1610 bytes
"Fernando" <frr@easyjob.net> wrote in message
news:nh0psvoru5i6r7rvm7l96sjeqm7skhuflg@4ax.com...

> The problem is that BSTRs are unicode and AFAIK MAPI
> doesn't expect addresses to be in Unicode.  How can I
> convert it into single byte encoding?

Use the WideCharToMultiByte() function

Alternatively, it is possible for VB to pass ANSI strings.  If your declare
the function to take char* instead of BSTR, and then in the VB declaration
if you declare the function parameter to use "ByVal As String", that usually
does a conversion for you.  It has to be able to do that, because a lot of
Win32 API functions are not Unicode either, so it has to convert when
calling those as well.


Gambit
Technical Details
Message-ID: <3fccd4c6$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <nh0psvoru5i6r7rvm7l96sjeqm7skhuflg@4ax.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,6822c151126682fa
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-12-02 10:10:04 PST
From: "Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <nh0psvoru5i6r7rvm7l96sjeqm7skhuflg@4ax.com>
Subject: Re: converting wstring into string
Date: Tue, 2 Dec 2003 10:11:19 -0800
Lines: 21
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 67.23.78.224
Message-ID: <3fccd4c6$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1070388422 67.23.78.224 (2 Dec 2003 10:07:02 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail