🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.ms-windows.programmer.ole
Article #11

Re: Problems VC++4.0 & StringFromCLSID function

#11
From: Jeroen Nikkels
Date: Thu, 18 Jan 1996 07:45
37 lines
1868 bytes
In article <4djn2d$mps@earth.superlink.net>, ananda@mars.superlink.net (Ananda Subramaniam) writes:
|> Hi,
|> 
|> I have an OLE sample that I wrote and compiled in VC++ 2.0 without any problems.
|> However, when I tried to compile in VC++ 4.0, I had trouble with the
|> StringFromCLSID function. 
|> 
|> I get a message "cannot convert 2nd parameter char ** to unsigned short**"
|> 
|> The Prototype for StringFromCLSID is:
|> StringFromCLSID(REFCLSID, LPOLESTR *);
|> 
|> I am passing as my second parameter a LPSTR *, which shouldn't be a problem
|> because grepping through the several include files provided by MS there is a
|> typedef as follows
|> 
|> typedef LPSTR LPOLESTR;

In the file wtypes.h there are also typedefs for
   typedef WCHAR OLECHAR
   typedef const OLECHAR *LPOLESTR;

All OLE functions use unicoded string arguments. Probably your VC++ 2.0
settings included the define OLE2ANSI to use ansi strings.

You should use the function MultiByteToWideChar(...) to convert an ansi
string to a unicode string.

This should help you out !

greetings,
-- 
# Jeroen Nikkels                          Baan Development B.V.     #
# Technology Development                  Baron van Nagellstraat 89 #
# Phone: +31 (0)342 428808                P.O. Box 143              #
# Fax  : +31 (0)342 428787                3770 AC Barneveld         #
# Email: jeroenn@baan.nl                  The Netherlands           #
Technical Details
Message-ID: <DLD9K4.HnM@baan.nl>
Path: arc1-ca.pugleaf.net!green.baan.nl!jeroenn
References: <4djn2d$mps@earth.superlink.net>

Show Full Headers
Complete Article Headers
Newsgroups: comp.os.ms-windows.programmer.ole,comp.lang.c++
Path: arc1-ca.pugleaf.net!green.baan.nl!jeroenn
From: jeroenn@green.baan.nl (Jeroen Nikkels)
Subject: Re: Problems VC++4.0 & StringFromCLSID function
Sender: news@baan.nl
Message-ID: <DLD9K4.HnM@baan.nl>
Date: Thu, 18 Jan 1996 07:45:40 GMT
X-Nntp-Posting-Host: green.baan.nl
References:  <4djn2d$mps@earth.superlink.net>
Organization: Baan International b.v.