GetOpenFileName problem
Chris Miller
chris at dprogramming.com
Thu Mar 13 11:16:43 PDT 2008
On Thu, 28 Feb 2008 16:06:42 -0500, Trass3r <mrmocool at web.de> wrote:
> Got another problem now. GetOpenFileName fails with error code 2
> (Initialization error)
> Can't figure out why it fails:
>
> string filter="DK2 string files(*.str)\0*.str\0\0";
> string filename;
> filename.length=400;
> OPENFILENAME ofn;
> memset(&ofn,0,ofn.sizeof);
> ofn.lStructSize=OPENFILENAME.sizeof;
> ofn.hwndOwner=null;
> ofn.lpstrFilter=filter.ptr;
> ofn.lpstrCustomFilter=null;
> ofn.lpstrFile=filename.ptr;
> ofn.nMaxFile=filename.length;
>
> if (!GetOpenFileNameA(&ofn))
> {
> debug msgBox("CommDlgError:
> "~std.string.toString(CommDlgExtendedError()));
> return;
> }
>
> Maybe because of hwndOwner? But I don't know how to get the hwnd in DFL.
Controls and Forms have a handle property to get the HWND, but why not
just use DFL's OpenFileDialog:
http://wiki.dprogramming.com/DflDoc/Filedialog - it wraps all this messy
winapi into a nice class.
More information about the Digitalmars-d-learn
mailing list