Now: Tutorial for Web and Software Design > Programming > c > Programming Content
> General GDI Plus issues: [Bookmark it]
General GDI Plus issues:

GDI Plus Description:

   GDIPlus is a Microsoft object-oriented C++ library, which provides better access to the graphic devise interface of windows. 2D drawing and using pictures is improved a lot compared to the standard windows GDI. With GDIPlus you can draw custom objects, open various pictures and save them in different formats, use various fonts and text drawing routines and various palette functions.

GDI Plus Compatibility:

   GDIPlus is developed originally for MS Visual Studio 7 but because the release of this product was postponed, versions of the library was released by Microsoft for Visual Studio 6. If you use Visual Studio 6, you should download the MFC GDI Plus library from here.

a) To use the library with Visual Studio 7 or later just include <gdiplus.h> in you project

b) To use the library with earlier versions of MSVS after downloading the library you must put it in a folder. Then add the directory your_path\GDIPlus\includes to you includes path in the development environment. Then you must include <gdiplus.h> in your project but before that you must define ULONG_PTR ? a definition used in GDPlus, but not defined in older versions of Visual Studio. So, suppose you want to include the library file in the file StdAfx.h from your project. You must add these lines:

#define ULONG_PTR ULONG
#include <gdiplus.h>

   Then include the file your_path\GDiPlus\lib\GdiPlus.lib to your project (simply use ?Add file to project?) so it would be linked with the application.

   After compiling the project copy the file your_path\GDIPlus\GdiPlus.dll to the folder where your executable is (?\Debug? or ?\Release? maybe).

Using the GDI Plus library:

   To use any GDIPlus routines you must initialize the library first. The initialization is a function call with two parameters, which must be variables that exist throughout the GDPlus session. After you finish using GDIPlus you must call a function that closes the session.

   A nice way of doing this, if you use MFC, is to add the variables in your CWinApp derived class (CYourProjectApp) like this:

private:
GdiplusStartupInput m_gdiplusStartupInput;
ULONG_PTR m_pGdiToken;

   Then in the beginning of the InitInstance function of the app add the following line:

GdiplusStartup(&m_pGdiToken,&m_gdiplusStartupInput,NULL); //gdi+ init

Then override the ExitInstance function (if you haven?t) and add the following line:

GdiplusShutdown(m_pGdiToken); //gdi+ end session

   After this operations you should be able to use the library?s functionality throughout your application.

[Bookmark][Print] [Close][To Top]
  • Prev Article-Programming:

  • Next Article-Programming:
  • Related Materias
    Using the For匛ach Stateme
    Executing a VB Program wit
    Visual Basic Explorer - OO
    VB Tutorials - SQL for Beg
    VB Tutorials - SQL for Beg
    Visual Basic Explorer - AS
    ASP - Active Server Pages 
    ATL Tutorial - Events meth
    Active Directory Programmi
    Named Pipe client
    Topics
    Photoshop Tutorial
     

    Special Effect

      3D Effect
      Photoshop Articles
    Programming Tutorial
     

    C/C++ Tutorial

      Visual Basic
      C# Tutorial
    Database Tutorial
     

    MySQL Tutorial

      MS SQL Tutorial
      Oracle Tutorial
    Graphic Design Tutorial
     

    Coreldraw Tutorial

      Illustrator Tutorial
      3D Graphics Articles
    Webmaster Articles
     

    Domain Service

      Web Hosting
      Site Promotion
    Java Tutorial&Articles
     

    Java Servlets

      JavaEE Tutorial
     

    JavaBeans Tutorial

    XML Tutorial&Articles
     

    XML Style Tutorial

      AJAX Tutorial
      XML Mobile
    Flash Tutorial&Articles
     

    Flash Video

      Action Script
      Flash Articles
    OS Tutorial&Articles
     

    Linux Tutorial

      Symbian Tutorial
      MacOS Tutorial