#include <acknex.h>
#include <windows.h>
#define PRAGMA_PATH "images"
char* fileOpenDialog ( char* _chrLocation, char* _chrFilter )
{
char szFile[MAX_PATH];
ZeroMemory ( szFile, MAX_PATH );
OPENFILENAME ofn;
ZeroMemory ( &ofn, sizeof(OPENFILENAME) );
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.Flags = OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_NOREADONLYRETURN;
if ( _chrFilter )
{
char szFilter[256];
ZeroMemory ( szFilter, 256 );
int size = str_len ( _chrFilter );
strcpy ( szFilter, _chr(_chrFilter) );
strcpy ( szFilter+size+1, _chr(_chrFilter) );
ofn.lpstrFilter = szFilter;
}
else
{
ofn.lpstrFilter = "All Files(*.*)\0*.*\0\0";
}
ofn.lpstrTitle = NULL;
ofn.lpstrFile = szFile;
ofn.nMaxFile = MAX_PATH;
ofn.lpstrInitialDir = _chr(_chrLocation);
ofn.hwndOwner = hWnd;
if ( GetOpenFileName(&ofn) )
return szFile;
else
return NULL;
}
void evnSpace ()
{
while ( key_space )
wait(1);
char *_chr = fileOpenDialog ( NULL, NULL );
}
void main ()
{
wait(1);
level_load ( "" );
on_space = evnSpace;
while ( !key_esc )
{
draw_text ( work_dir, 10, 10, COLOR_WHITE ); // Never changes
if ( file_exists ( "negro.png" ) )
draw_text ( "the file is accesable", 10, 40, COLOR_GREEN );
else
draw_text ( "the file is not accesable", 10, 40, COLOR_RED );
wait(1);
}
sys_exit ( NULL );
}