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

How to use [out] parameters in C++ .NET

I'm trying to use the Graphics::MeasureString method,
which gives two out parameters. Apparently these out
parameters are an invention of C#, but the docs still
show a syntax for C++ (below). However, when I try to
compile, I get "error C2059: syntax error: '['".

Can someone enlighten me on using the out parameter in
C++ .net 2003 (such as an example)? I couldn't find any
more info on this. The MIDL also says the same syntax.

My code:

gfx->MeasureString(labHx, printFont, rectText.Size, new
StringFormat(), [out] int * charsPerLine, [out] int *
linesFilled);

Documentation:

public: SizeF MeasureString(
String* text,
Font* font,
SizeF layoutArea,
StringFormat* stringFormat,
[
Out
] int* charactersFitted,
[
Out
] int* linesFilled
);
Nov 16 '05 #1
2 4285
> Can someone enlighten me on using the out parameter in
C++ .net 2003 (such as an example)? I couldn't find any
more info on this. The MIDL also says the same syntax.

My code:

gfx->MeasureString(labHx, printFont, rectText.Size, new
StringFormat(), [out] int * charsPerLine, [out] int *
linesFilled);


Get rid of the '[out]' fragments - they are only for informational purposes
in documentation (they are relevant in MIDL, but illegal in C++).
So it should look like this:
gfx->MeasureString(labHx, printFont, rectText.Size, new
StringFormat(), &charsPerLine, &linesFilled);

--
pozdrawia
qb****@zdnet.pl
Anything was possible last night. That was the trouble
with last nights. They were always followed by this mornings.
- Terry Pratchett, "Small Gods"

Nov 16 '05 #2
Great. That worked. Thanks very much for your quick
reply.
-----Original Message-----
Can someone enlighten me on using the out parameter in
C++ .net 2003 (such as an example)? I couldn't find any more info on this. The MIDL also says the same syntax.

My code:

gfx->MeasureString(labHx, printFont, rectText.Size, new
StringFormat(), [out] int * charsPerLine, [out] int *
linesFilled);
Get rid of the '[out]' fragments - they are only for

informational purposesin documentation (they are relevant in MIDL, but illegal in C++).So it should look like this:
gfx->MeasureString(labHx, printFont, rectText.Size, new
StringFormat(), &charsPerLine, &linesFilled);

--
pozdrawia
qb****@zdnet.pl
Anything was possible last night. That was the trouble
with last nights. They were always followed by this mornings. - Terry Pratchett, "Small Gods"
.

Nov 16 '05 #3

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

Similar topics

8
by: Birgit Rahm | last post by:
Hallo Newsgroup, I have the following problem: I work with Python 2.2 and invoke functions via CORBA ( I use onmiORB/omniORBpy) on a server. The server provides me a function, where the 3...
2
by: flycast | last post by:
I am trying to retrieve the Parameters first or second (0, 1 ,2) node from the following XML file: <?xml version="1.0" encoding="utf-8" ?> <Robot xmlns="http://tempuri.org/RobotDefaults.xsd">...
3
by: Jerry Houston | last post by:
In a winform application, I use worker threads to perform asynchronous tasks (e.g., mail merge with Word). The thread procs need to gather some user options from controls in the UI, and I know...
8
by: Dave Veeneman | last post by:
Can I pass a method pass one of its out parameters to another method? C# is telling me I can't. Let's say I have two methods, FooManager and FooWorker. FooManager is part of a class that acts as...
33
by: C# Learner | last post by:
Note ---- Please use a fixed-width font to view this, such as Courier New. Problem
9
by: Michi Henning | last post by:
Hi, I'm generating both VB and C# code from language-independent interface definitions, which is why I'm raising this issue. (The problem apppears to be somewhat esoteric, but it is real in my...
14
by: stic | last post by:
Hi, I'm in a middle of writing something like 'exception handler wraper' for a set of different methodes. The case is that I have ca. 40 methods form web servicem, with different return values...
4
by: Todd Perkins | last post by:
Hello all, surprisingly enough, this is my first newsgroup post, I usually rely on google. So I hope I have enough info contained. Thank you in advance for any help! Problem: I am getting...
2
by: Extremest | last post by:
Here is the code I have so far. It connects to a db and grabs headers. It then sorts them into groups and then puts all the complete ones into another table. Problem I am having is that for some...
2
by: =?Utf-8?B?ZGF2aWQ=?= | last post by:
I have the following function for a web services method (6 parameters where 5 of them need to pass out values): public void GetPatientPara(out string patientID, out string LastName, out string...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

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.