Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

XCmyk - CMYK to RGB Calculator with source code

, 5 Jul 2003 CPOL
XCmyk implements an RGB to CMYK calculator
#ifndef GDIPINITIALIZER_H
#define GDIPINITIALIZER_H

/*! \brief A class wrapper for GDI+ initialization

 Author: Ryan Johnston, see http://www.codeproject.com/vcpp/gdiplus/GDIPlusControl.asp
 \ingroup GDIpGroup
*/
class CGDIpInitializer 
{
public:
	//! Constructor offers the ability to initialize on construction, or delay until needed.
	CGDIpInitializer(bool bInitCtorDtor = false);

	//! If GDI+ has not explicitly been Deinitialized, do it in the destructor
	virtual ~CGDIpInitializer();

	/*! \brief Initialize function, makes sure only one GDI+ is called for each process.
	
	  This function creates a file mapping based on the current process id.
	If the mapping already exists, it knows that another instance of this class
	elsewhere in the process has already taken care of starting GDI+.
	*/
	void Initialize();

	/*! \brief Deinitialize or decrease initialize count.
	
	  No tricks to this function.  If this was the class that originally started GDI+,
	 and its initialization count has reached zero, it shuts down GDI+.
	 */
	void Deinitialize();

private:
	HANDLE							m_hMap;
	bool							m_bInited, m_bInitCtorDtor;
	ULONG_PTR						m_gdiplusToken;
	Gdiplus::GdiplusStartupInput	m_gdiplusStartupInput;
	static long							m_initcount;
};

#endif //GDIPINITIALIZER_H

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Hans Dietrich
Software Developer (Senior) Hans Dietrich Software
United States United States
I attended St. Michael's College of the University of Toronto, with the intention of becoming a priest. A friend in the University's Computer Science Department got me interested in programming, and I have been hooked ever since.
 
Recently, I have moved to Los Angeles where I am doing consulting and development work.
 
For consulting and custom software development, please see www.hdsoft.org.






| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150129.1 | Last Updated 6 Jul 2003
Article Copyright 2003 by Hans Dietrich
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid