Windows API GetOpenFilename
-
Hello, I'm having trouble getting a "file open" common dialog box. I keep getting a CDERR_STRUCTSIZE error, and I can't figure out why. Here's two methods I've tried: -------- OPENFILENAME ofn; memset(&ofn, 0, sizeof(OPENFILENAME)); ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = hwnd0; GetOpenFileName(&ofn); -------- OPENFILENAME ofn; ZeroMemory(&ofn, sizeof(ofn)); ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = hwnd0; GetOpenFileName(&ofn); -------- I've tried adding other members, but no success. "ofn.lStructSize" always shows to be 88 (is this normal?). "hwnd0" is a global HWND for the main window (I've also tried NULL for ofn.hwndOwner). The main window is NOT dialog based. I've tried the routine in several different locations, including winmain(), callback, and a procedure by itself. I'm using C++Builder command line compiler, Win95B, and it compiles fine. I'm using CommDlgExtendedError() in a switch/case function to find the error. My other API functions seem to work fine. Any ideas? Thanks, Mac
-
Hello, I'm having trouble getting a "file open" common dialog box. I keep getting a CDERR_STRUCTSIZE error, and I can't figure out why. Here's two methods I've tried: -------- OPENFILENAME ofn; memset(&ofn, 0, sizeof(OPENFILENAME)); ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = hwnd0; GetOpenFileName(&ofn); -------- OPENFILENAME ofn; ZeroMemory(&ofn, sizeof(ofn)); ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = hwnd0; GetOpenFileName(&ofn); -------- I've tried adding other members, but no success. "ofn.lStructSize" always shows to be 88 (is this normal?). "hwnd0" is a global HWND for the main window (I've also tried NULL for ofn.hwndOwner). The main window is NOT dialog based. I've tried the routine in several different locations, including winmain(), callback, and a procedure by itself. I'm using C++Builder command line compiler, Win95B, and it compiles fine. I'm using CommDlgExtendedError() in a switch/case function to find the error. My other API functions seem to work fine. Any ideas? Thanks, Mac