473,792 Members | 3,251 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

type VARIANT and array - conversion to CString

Hi
I have a problem, I want to convert program in Visual Basic 6 to VC++6.
Program in VB works OK., but in VC++ I don't know how to convert 'VARIANT'
to 'Cstring'.
How to convert 'VARIANT ww' to 'CString pp'

In C++ debug info I have:
ww={???}
ww.vt=8204
pvarVal={VT_NUL L}
hr=0
Visual C++
-------------------------------------------------------------
BSTR _name;
_name = SysAllocString( L"Name");
VARIANT ww;
//sdoc->GetItemValue(B STR pName, VARIANT *pValues)
HRESULT hr = sdoc->GetItemValue(_ name, &ww);
CString pp;
pp = ww; // HOW TO MAKE IT WORK ???
-------------------------------------------------------------
Visual Basic:
-------------------------------------------------------------
Dim ww As String
ww = sdoc.GetItemVal ue("Name")(0)
-------------------------------------------------------------
GREAT THANKS FOR ANY HELP

r.


Nov 14 '05 #1
2 3685
romi wrote:

I have a problem, I want to convert program in Visual Basic 6 to
VC++6. Program in VB works OK., but in VC++ I don't know how to
convert 'VARIANT' to 'Cstring'.
How to convert 'VARIANT ww' to 'CString pp'


Read the name of the newsgroup carefully. Note the lack of '++'
in the name. Also bear in mind that VB and VC are exclusively
Microsoft entities, and inherently non-portable. This might guide
you to searching for groups with 'Microsfot' in their names.

I.E. this is off-topic here.

--
A: Because it fouls the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Nov 14 '05 #2
CBFalconer <cb********@yah oo.com> scribbled the following:
romi wrote:
I have a problem, I want to convert program in Visual Basic 6 to
VC++6. Program in VB works OK., but in VC++ I don't know how to
convert 'VARIANT' to 'Cstring'.
How to convert 'VARIANT ww' to 'CString pp'
Read the name of the newsgroup carefully. Note the lack of '++'
in the name. Also bear in mind that VB and VC are exclusively
Microsoft entities, and inherently non-portable. This might guide
you to searching for groups with 'Microsfot' in their names.


You won't find many groups with "Microsfot" in their names. I know, I
know, I should STFW^HU...

--
/-- Joona Palaste (pa*****@cc.hel sinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"'I' is the most beautiful word in the world."
- John Nordberg
Nov 14 '05 #3

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

Similar topics

6
3357
by: TrustyTif | last post by:
After surfing the google & MSDN for a few days I found an MSDN site that explained how to "new" a multidimensional array in C++...but, I don't know how to use it, for alas, my brain still doesn't understand pointer very well. Here's the site: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclang98/html/_pluslang_new_operator.asp And here's what I've come up with thus far to have a 2 dimensional array of CStrings.
21
2519
by: Nitin Bhardwaj | last post by:
Hi all, It is said that C++ is a strongly typed language and thus a type-safe language (unlike C). So how does one explain the following behaviour : int main(void) { char *p = NULL; p = "A String Literal";//the compiler isuues no error/warning here // but ideally it should...as p is a non-const
9
12232
by: Fausto Lopez | last post by:
I'm getting the following error: 'strlen' : cannot convert parameter 1 from 'class CString' to 'const char *' when I try to compile the following code: HRESULT AnsiToUnicode(CString pszA, LPOLESTR* ppszW) { ULONG cCharacters; DWORD dwError;
1
649
by: romi | last post by:
Hi I have a problem, I want to convert program in Visual Basic 6 to VC++6. Program in VB works OK., but in VC++ I don't know how to convert 'VARIANT' to 'Cstring'. How to convert 'VARIANT ww' to 'CString pp' In C++ debug info I have: ww={???} ww.vt=8204 pvarVal={VT_NULL}
5
14078
by: Tim Wong | last post by:
All: I am trying to convert a CString value to an unsigned char array. I found some code online that will allow me to compile, but when I try to print out...i get a whole mess. /*Begin Code*/ CString day("01"); unsigned char testDay;
8
1612
by: Fred Hebert | last post by:
I have a function that requires a LPCTSTR parameter. I have the value I want to pass to it in a TextBox->Text field. Is there any way to do it in a single assignment. e.g. DWORD Xyz::TheFunc(LPCTSTR lpVal) .... TheFunc(Junk->Text->Something());
3
3237
by: SteveK | last post by:
We have just started converting a large project from VisualStudio 6.0 to VisualStudio 2003. Of course, we're encountering some problems. The first of which involves some CString() constructors not taking arguments that were valid in the 6.0 builds. As a test, a created a simple 2003 project and inserted the following six lines of code in the stdafx.cpp file: #include "stdafx.h" TCHAR x = 't';
0
2260
by: npotnis | last post by:
Hi All, I am trying to compile an existing C++ unamanaged application with the /clr switch in VS.Net 2003, as I need to use managed extensions in the code. In a cpp file I have the following code : CString strRet; COleVariant var = m_pRSTFormList->GetFieldValue("FormName"); if(var.vt == VT_BSTR) strRet = var.pbVal;
1
5825
by: michael mazanek | last post by:
Hi all, i have a VARIANT variable which contains a "friendly name" of a video-codec (direct show). Does anyone know how to retrieve the friendly name as a string to display it on the console? Thanks for any advice! mm
8
3152
by: Smithers | last post by:
Are there any important differences between the following two ways to convert to a type?... where 'important differences' means something more profound than a simple syntax preference of the developer. x = someObject as MySpecificType; x = (MySpecificType) someObject; Thanks.
0
9670
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10430
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10159
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10000
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9033
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7538
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5560
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2917
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.