Re: [AD] Allegro 4.0.3rc1+ MFC, bug? |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
> Ok, this is how MFC works: you create a new class derived from CWinApp.
> This class represents an application. The method InitInstance() is
> automatically called by MFC, and there you do all the initialization. You
> declare a global object of the class you have just created, and just some
> magic macros to let MFC know about this object. In fact I don't see any
> limitation on how many application objects you can have.
>
> However, in one of my apps, all the functions that need allegro are
> declared in a sepparate c++ file. I only include MFC headers for
> interaction with the rest of the program (for example, I need a HWND for
> win_set_window() ), and made some calls to AfxMessageBox(), exactly the
> same as the WinAPI's MessageBox().
>
> I'm not an expert in MFC, so I don't know how all this is implemented
> (thought MFC source code is available).
Ok, thanks for the explanation.
> What I think the problem is is that allegro shouldn't declare WinMain if
> ALLEGRO_AND_MFC is defined, because MFC has it's own WinMain.
Definitely. Could you try the attached patch? Thanks in advance.
--
Eric Botcazou
--- /home/eric/cvs/allegro/include/winalleg.h Fri Sep 13 10:18:56 2002
+++ allegro/include/winalleg.h Tue Mar 4 18:27:25 2003
@@ -38,6 +38,9 @@
#if (!defined SCAN_EXPORT) && (!defined SCAN_DEPEND)
#ifdef ALLEGRO_AND_MFC
+ /* don't mess with the MFC internal WinMain() */
+ #define ALLEGRO_NO_MAGIC_MAIN
+
#ifdef DEBUGMODE
#define AL_ASSERT(condition) { if (!(condition)) al_assert(__FILE__, __LINE__); }
#define AL_TRACE al_trace