[GD-Windows] Mind numbing GetOpenFileName Problem
Brought to you by:
vexxed72
From: Paul C. <pa...@pa...> - 2002-02-18 16:32:52
|
All I want is an open file dialog box, but no, windows has to cause me problems. Ok, its probably a silly mistake but here goes. I'm compiling with both these flags set: #define _WIN32_WINNT 0x500 #define WINVER 0x500 to try and get various things (mousewheel, ...) to co-operate. The problem comes when I try and open a file dialog. The code is below. The sticking point appears to be the ofn.lStructSize line. When set using the VERSION_400 flag is fails gracefully with CDERR_STRUCTSIZE. If I use sizeof( OPENFILENAME ) it just crashes in the kernel on GetOpenFileName. This should be really simple to get up and running, but I don't know how get out of this hole I seem to have dug. With no error message, useful or otherwise, I'm a bit stuck. (I apologise for the crap formatting but outlook express has decided to put double carriage returns everywhere - go figure). cheers Paul char inputfile[256], outputfile[256], filename[256]; char initdir[] = "d:\\Projects\\Clearday\\Data/0"; char title[] = "Select file to process/0"; OPENFILENAME ofn; ofn.lStructSize = sizeof( OPENFILENAME_SIZE_VERSION_400 ); // = izeof( OPENFILENAME ); ofn.hwndOwner = hWnd; char *filter = "Max ASE files/0*.ASE/0/0"; ofn.lpstrFilter = NULL; ofn.lpstrCustomFilter = NULL; ofn.lpstrFile = inputfile; ofn.nMaxFile = 256; ofn.lpstrFileTitle = filename; ofn.nMaxFileTitle = 256; ofn.lpstrInitialDir = NULL; ofn.lpstrTitle = NULL; ofn.Flags = ( OFN_ENABLESIZING | OFN_FILEMUSTEXIST ); if( GetOpenFileName( &ofn )!=0 ) { _world.PreProcess( type, inputfile, outputfile ); } else { DWORD err = CommDlgExtendedError(); if( err == CDERR_STRUCTSIZE ) { int a = 1; } } |