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.
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click