Re: [AD] problem with windows dialogs/ Win XP |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
I made some more research and have a question:
- GetOpenFilename works correct when I changed the call of
_CoInitializeEx(NULL, _COINIT_MULTITHREADED); to
_CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); or to
CoInitialize(NULL); in wthread.c (or when it isn't called,
see below)
Anybody knows what's exactly the difference between
_COINIT_MULTITHREADED and COINIT_APARTMENTTHREADED?
- GetOpenFilename dialog and MessageBox apear behind the main window
when called, with the the changes above too.
I made a mistake with this (I should be more careful). It's working alright:
#include <allegro.h>
#include <winalleg.h>
int main(int argc, char **argv) {
allegro_init();
install_keyboard();
set_color_depth(16);
set_gfx_mode(GFX_AUTODETECT_WINDOWED,640,480,0,0);
//set_gfx_mode(GFX_GDI,640,480,0,0);
set_gfx_mode(GFX_AUTODETECT_WINDOWED,640,480,0,0);
OPENFILENAME ofn;
//ofn.hwndOwner=win_get_window(); BAD
memset(&ofn,0,sizeof(ofn));
ofn.lStructSize=sizeof(OPENFILENAME);
ofn.hwndOwner=win_get_window(); //GOOD
char szFile[260]="";
ofn.nMaxFile=sizeof(szFile);
ofn.lpstrFile=szFile;
ofn.lpstrFilter="Bitmaps\0*.bmp\0All Files\0*.*\0\0";
GetOpenFileName(&ofn);
}
END_OF_MAIN()
-Since I don't find a solution except changing the threading model when
calling _CoInitializeEx, I'll write a small text for the FAQ.