[AD] problem with windows dialogs/ Win XP |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
I'm new to this list, so hello. There's a problem with calling Windows
dialogs from an allegro app with Windows XP (it is running fine with Win
98). If you compile:
#include <allegro.h>
#include <winalleg.h>
int main(int argc, char **argv) {
allegro_init();
HWND h=win_get_window();
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);
OPENFILENAME ofn;
ofn.hwndOwner=h;
memset(&ofn,0,sizeof(ofn));
ofn.lStructSize=sizeof(OPENFILENAME);
char szFile[260]="";
ofn.nMaxFile=sizeof(szFile);
ofn.lpstrFile=szFile;
ofn.lpstrFilter="Bitmaps\0*.bmp\0All Files\0*.*\0\0";
if(GetOpenFileName(&ofn)!=0)
MessageBox(NULL,ofn.lpstrFile,"",MB_OK);
else
MessageBox(NULL,"canceled","",MB_OK);
}
END_OF_MAIN()
... there are two problems: the Dialog appears behind the allegro main
window and if you change the filetype the dialog shows no files until
you change the directory.
For the first problem I didn't look for a solution yet.
For the second I commented out the call of _win_thread_init() in
wsystem.c/sys_directx_init(), and it is working, thanks to Elias for
helping me here.
_win_thread_init() can be found in wthread.c and loads the ole32.dll. I
compiled one of my projects and it seems working nice with that change.
So what is ole32 doing here? Is it effecting the stability of the system
not using it? Since WinApi programming is new to me (I'm learning it
since about 3 weeks) any comment might be useful.
Dan