Click here to Skip to main content
15,884,629 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Change Dir inside CFileDialog Pin
Member 40147611-Feb-20 23:30
Member 40147611-Feb-20 23:30 
GeneralRe: Change Dir inside CFileDialog Pin
CPallini12-Feb-20 2:07
mveCPallini12-Feb-20 2:07 
AnswerRe: Change Dir inside CFileDialog Pin
Richard MacCutchan11-Feb-20 5:18
mveRichard MacCutchan11-Feb-20 5:18 
GeneralRe: Change Dir inside CFileDialog Pin
Member 40147611-Feb-20 5:32
Member 40147611-Feb-20 5:32 
GeneralRe: Change Dir inside CFileDialog Pin
Richard MacCutchan11-Feb-20 5:53
mveRichard MacCutchan11-Feb-20 5:53 
GeneralRe: Change Dir inside CFileDialog Pin
Member 40147611-Feb-20 6:02
Member 40147611-Feb-20 6:02 
GeneralRe: Change Dir inside CFileDialog Pin
Richard MacCutchan11-Feb-20 8:20
mveRichard MacCutchan11-Feb-20 8:20 
AnswerRe: Change Dir inside CFileDialog Pin
leon de boer11-Feb-20 6:40
leon de boer11-Feb-20 6:40 
I don't use MFC but as it shims the Win32 I will explain how you do it in raw Win32.

The FILEOPEN dialog in common controls take a structure called OPENFILENAME one of it's fields is lpfnHook which allows you to install your own handler.
OPENFILENAMEA (commdlg.h) - Win32 apps | Microsoft Docs[^]

In your handler in the WM_NOTIFY message you handle the CDN_TYPECHANGE message
CDN_TYPECHANGE notification code (Commdlg.h) - Win32 apps | Microsoft Docs[^]

So a minimal handler looks like this
UINT_PTR CALLBACK OpenHookProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam) 
{
	switch (Msg) 
	{
		case WM_NOTIFY:
		{
			LPOFNOTIFY pnh = (LPOFNOTIFY)lParam;
			if (pnh && (pnh->hdr.code == CDN_TYPECHANGE))
			{
				switch (pnh->lpOFN->nFilterIndex)
				{
					case 0:
						// First extension type selected
						break;
					case 1:
						// Second selection type selected
						break;
				}
			}
			break;
		}
	}
	return (0);
}

In vino veritas

GeneralRe: Change Dir inside CFileDialog Pin
Member 40147611-Feb-20 23:26
Member 40147611-Feb-20 23:26 
GeneralRe: Change Dir inside CFileDialog Pin
leon de boer12-Feb-20 3:16
leon de boer12-Feb-20 3:16 
GeneralRe: Change Dir inside CFileDialog Pin
Member 40147614-Feb-20 2:40
Member 40147614-Feb-20 2:40 
GeneralRe: Change Dir inside CFileDialog Pin
Victor Nijegorodov14-Feb-20 9:24
Victor Nijegorodov14-Feb-20 9:24 
GeneralRe: Change Dir inside CFileDialog Pin
Member 40147616-Feb-20 22:36
Member 40147616-Feb-20 22:36 
GeneralRe: Change Dir inside CFileDialog Pin
Victor Nijegorodov16-Feb-20 23:40
Victor Nijegorodov16-Feb-20 23:40 
GeneralRe: Change Dir inside CFileDialog Pin
Member 40147617-Feb-20 0:14
Member 40147617-Feb-20 0:14 
GeneralRe: Change Dir inside CFileDialog Pin
Victor Nijegorodov17-Feb-20 2:03
Victor Nijegorodov17-Feb-20 2:03 
GeneralRe: Change Dir inside CFileDialog Pin
Member 40147617-Feb-20 3:21
Member 40147617-Feb-20 3:21 
GeneralRe: Change Dir inside CFileDialog Pin
Victor Nijegorodov17-Feb-20 4:41
Victor Nijegorodov17-Feb-20 4:41 
GeneralRe: Change Dir inside CFileDialog Pin
Member 40147617-Feb-20 5:01
Member 40147617-Feb-20 5:01 
AnswerRe: Change Dir inside CFileDialog Pin
Victor Nijegorodov11-Feb-20 11:18
Victor Nijegorodov11-Feb-20 11:18 
GeneralRe: Change Dir inside CFileDialog Pin
Member 40147611-Feb-20 23:32
Member 40147611-Feb-20 23:32 
QuestionKeeping UDS_ALIGNRIGHT positioning for an updown control after moving the buddy window Pin
Alexander Kindel10-Feb-20 0:47
Alexander Kindel10-Feb-20 0:47 
AnswerRe: Keeping UDS_ALIGNRIGHT positioning for an updown control after moving the buddy window Pin
Richard MacCutchan10-Feb-20 0:58
mveRichard MacCutchan10-Feb-20 0:58 
GeneralRe: Keeping UDS_ALIGNRIGHT positioning for an updown control after moving the buddy window Pin
Alexander Kindel10-Feb-20 13:50
Alexander Kindel10-Feb-20 13:50 
GeneralRe: Keeping UDS_ALIGNRIGHT positioning for an updown control after moving the buddy window Pin
Richard MacCutchan10-Feb-20 21:59
mveRichard MacCutchan10-Feb-20 21:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.