Solved

Initializing GDI++ in MFC/ATL application

Posted on 2011-03-03
4
501 Views
Last Modified: 2012-05-11
sort of project: win32
using MS VS 2008 on MS XP.
I have attached sample data.

Lets use the closing price and date for the price chart.
and for the histogram: upvolume should be above the line and the down volume should be below the line.

Thanks again.
OCENY.txt
0
Comment
Question by:pgmerLA
[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
  • 2
  • 2
4 Comments
 
LVL 8

Expert Comment

by:SunnyDark
ID: 35034913
OK So first we'll start with creating a new Win32 Application project :
Visual c++ => Win32 => Win32 Project

Lets call the project GDIGraph so that we are on the same page here...

Now we need to add the required headers and libraries for the GDI plus :
Find you main file GDIGraph.cpp  and add the following at the top of the file right after the #include lines:
#pragma comment(lib,"gdiplus.lib")
#include <gdiplus.h>
using namespace Gdiplus;

Open in new window


Now if you will try to compile the project at this point (try it) you will get a bunch of errors... To get rid of them, open the file stdafx.h , find the line that says:
 #define WIN32_LEAN_AND_MEAN

Open in new window

and comment it. Now you should be able to compile the project.

Now lets add the GDI initialization staff.

Back to the GDIGraph.cpp file, find the line that says
// Global Variables:

Open in new window

This is where we will define our global variables as well...
Add the following two line to define GDI plus token and input:
GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR			gdiplusToken;

Open in new window

Now find the InitInstance function and add BEFORE ShowWindow the following:
Now find the _tWinMain function and add at the end of the function BEFORE return (int) msg.wParam; the following:
GdiplusShutdown(gdiplusToken);

Open in new window

Now compile everything and if there are no errors then we are done with this step and we have working application with GDIplus support.
Attached is the final image of this step.
 Step 1 final
0
 
LVL 8

Accepted Solution

by:
SunnyDark earned 500 total points
ID: 35034918
If everything goes well please accept the solution and create the next question for the next step: Drawing with GDIplus and double buffering
0
 

Author Comment

by:pgmerLA
ID: 35038590
Is there a way to contact directly trough the site withoutposting through the comment box?
Also, I gave you the highest rating I could, but it rated at 9.2
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

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