473,325 Members | 2,308 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,325 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 4287
> 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...
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: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.