win32 api & lib issue

Imperatorn johan_forsberg_86 at hotmail.com
Thu Nov 2 09:05:26 UTC 2023


On Thursday, 2 November 2023 at 09:01:06 UTC, Imperatorn wrote:
> On Thursday, 2 November 2023 at 08:31:41 UTC, Peter Hu wrote:
>> [...]
>
> Works for me.

This is all you need

```d
import core.sys.windows.commdlg;
import core.sys.windows.winuser;

void main()
{
	wchar[256] fileName;
	OPENFILENAMEW ofn;

	ofn.lStructSize = OPENFILENAMEW.sizeof;
	ofn.lpstrFilter = "Text Files\0*.txt\0 D 
files\0*.d;*.di\0\0"w.ptr;
	ofn.lpstrFile = fileName.ptr;
	ofn.nMaxFile = fileName.length;

	if (GetOpenFileNameW(&ofn))
	{
		MessageBoxW(null, ofn.lpstrFile, "File Selected:"w.ptr, 0);
	}
}
```


More information about the Digitalmars-d-learn mailing list