Notepad++ new save dialog box

This has been bugging me for literally years; it’s the save dialog box for notepad++.

The default one is not very nice…

21-07-2015 19-39-44-558


Now this is so much better!

21-07-2015 19-43-52-476

How To:

TCHAR * FileDialog::doSaveDlg() 
	::GetCurrentDirectory(MAX_PATH, dir); 
	//_ofn.lpstrInitialDir = dir;

	NppParameters * params = NppParameters::getInstance();
	_ofn.lpstrInitialDir = params->getWorkingDir();


	//_ofn.Flags |= OFN_ENABLEHOOK; // Comment this line out.
	_ofn.lpfnHook = OFNHookProc;

	TCHAR *fn = NULL;
	try {
		fn = ::GetSaveFileName(&_ofn)?_fileName:NULL;
		if (params->getNppGUI()._openSaveDir == dir_last)
			::GetCurrentDirectory(MAX_PATH, dir);
	} catch(std::exception e) {
		::MessageBoxA(NULL, e.what(), "Exception", MB_OK);
	} catch(...) {
		::MessageBox(NULL, TEXT("GetSaveFileName crashes!!!"), TEXT(""), MB_OK);


	return (fn);

Recompile and that’s it!

I found this solution once on the source forge np++ forums years ago, with no other comments and very little views. Then the issue/solution came up again after the whole merge to GitHub due to the bad practices of SF. Hopefully it will finally be recoded and put into the release build soon. For now I’m keeping this so it’s easier to find/reference.