?
Solved

Can the CArray class be used with the function Polyline?

Posted on 2002-07-28
4
Medium Priority
?
332 Views
Last Modified: 2013-11-20
It seems that the function Polyline doesn't accept as its first argument a CArray collection of CPoints. I wrote a program in which Polyline is used with a common array and it works fine, but if a CArray class is used instead, the program doesn't compile and gives the following message: cannot convert from 'class CArray<class CPoint,class CPoint &> *' to 'class CPoint *'.
Is there a way to make Polyline use the CArray class?
0
Comment
Question by:Alberto071397
  • 3
4 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 7183924
You can - if you use a CArray of POINT. E.g.

CArray<POINT, POINT> point_array;

// fill array

Polyline ( point_array.GetData(),point_array.GetSize());

"GetData()" will return a POINT* or LPPOINT respectively.
0
 
LVL 86

Accepted Solution

by:
jkr earned 400 total points
ID: 7183928
PS: The above is "CDC::Polyline()" - if you want to use the Win32 version, you would use

Polyline ( hdc, point_array.GetData(),point_array.GetSize());
0
 

Author Comment

by:Alberto071397
ID: 7184170
It wasn't necessary to use POINT; CArray<CPoint, CPoint&> worked as well. The trick is to use the member function GetData() to get a common array.
Thanks very much.
0
 
LVL 86

Expert Comment

by:jkr
ID: 7184187
>>CArray<CPoint, CPoint&> worked as well

Both are in fact the same - CPoint is a very "thin" wrapper

Thank you!
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question