Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Can the CArray class be used with the function Polyline?

Posted on 2002-07-28
4
Medium Priority
?
324 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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 …
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

636 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