GetOpenFileName problem

Trass3r mrmocool at web.de
Thu Feb 28 13:06:42 PST 2008


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.


More information about the Digitalmars-d-learn mailing list