Thread overview | ||||||
---|---|---|---|---|---|---|
|
February 27, 2008 GetOpenFileName problem | ||||
---|---|---|---|---|
| ||||
I want to use the GetOpenFileName function in D (with DFL btw), the problem is, the linker doesn't find it cause it searches for _GetOpenFileName but comdlg32.dll seems to export it as GetOpenFileName. pragma(lib,"comdlg32.lib"); export extern(C) BOOL GetOpenFileName(OPENFILENAME* lpofn); |
February 27, 2008 Re: GetOpenFileName problem | ||||
---|---|---|---|---|
| ||||
Posted in reply to Trass3r | Never mind, was a really dumb mistake, I forgot that I have to use GetOpenFileNameA resp. GetOpenFileNameW. |
February 28, 2008 GetOpenFileName problem | ||||
---|---|---|---|---|
| ||||
Posted in reply to Trass3r | 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. |
March 13, 2008 Re: GetOpenFileName problem | ||||
---|---|---|---|---|
| ||||
Posted in reply to Trass3r | On Thu, 28 Feb 2008 16:06:42 -0500, Trass3r <mrmocool@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. |
Copyright © 1999-2021 by the D Language Foundation