Solved

Can the CArray class be used with the function Polyline?

Posted on 2002-07-28
4
279 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 100 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.

707 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now