Using POCO in MFC Applications

Tips and tricks for POCO C++ Libraries users.
guenter
Posts: 1194
Joined: 11 Jul 2006, 16:27
Location: Austria

Using POCO in MFC Applications

Postby guenter » 28 Feb 2011, 19:14

Just because this turns up occasionally: if you're using POCO in a MFC application, make sure to always include the MFC headers before POCO headers. Otherwise you may get the following error message:

Code: Select all

fatal error C1189: #error: WINDOWS.H already included.  MFC apps must not #include <windows.h>

And another tip: if your application uses Unicode, remember that POCO uses UTF-8 encoding (unless specifically disabled when building POCO) for filenames and other strings obtained from or passed to the OS. To convert such an UTF-8 encoded std::string into a UTF-16 encoded std::wstring, which can then be used in GUI code, use Poco::UnicodeConverter.

guenter
Posts: 1194
Joined: 11 Jul 2006, 16:27
Location: Austria

Re: Using POCO in MFC Applications

Postby guenter » 04 Mar 2011, 16:51

I have prepared some sample code. Get it here.


Return to “Tips & Tricks”

Who is online

Users browsing this forum: No registered users and 1 guest