Click here to Skip to main content
15,789,698 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Change Dir inside CFileDialog Pin
Member 40147612-Feb-20 0:30
Member 40147612-Feb-20 0:30 
GeneralRe: Change Dir inside CFileDialog Pin
CPallini12-Feb-20 3:07
mveCPallini12-Feb-20 3:07 
AnswerRe: Change Dir inside CFileDialog Pin
Richard MacCutchan11-Feb-20 6:18
mveRichard MacCutchan11-Feb-20 6:18 
GeneralRe: Change Dir inside CFileDialog Pin
Member 40147611-Feb-20 6:32
Member 40147611-Feb-20 6:32 
GeneralRe: Change Dir inside CFileDialog Pin
Richard MacCutchan11-Feb-20 6:53
mveRichard MacCutchan11-Feb-20 6:53 
GeneralRe: Change Dir inside CFileDialog Pin
Member 40147611-Feb-20 7:02
Member 40147611-Feb-20 7:02 
GeneralRe: Change Dir inside CFileDialog Pin
Richard MacCutchan11-Feb-20 9:20
mveRichard MacCutchan11-Feb-20 9:20 
AnswerRe: Change Dir inside CFileDialog Pin
leon de boer11-Feb-20 7:40
leon de boer11-Feb-20 7: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 40147612-Feb-20 0:26
Member 40147612-Feb-20 0:26 
GeneralRe: Change Dir inside CFileDialog Pin
leon de boer12-Feb-20 4:16
leon de boer12-Feb-20 4:16 
GeneralRe: Change Dir inside CFileDialog Pin
Member 40147614-Feb-20 3:40
Member 40147614-Feb-20 3:40 
GeneralRe: Change Dir inside CFileDialog Pin
Victor Nijegorodov14-Feb-20 10:24
Victor Nijegorodov14-Feb-20 10:24 
GeneralRe: Change Dir inside CFileDialog Pin
Member 40147616-Feb-20 23:36
Member 40147616-Feb-20 23:36 
GeneralRe: Change Dir inside CFileDialog Pin
Victor Nijegorodov17-Feb-20 0:40
Victor Nijegorodov17-Feb-20 0:40 
GeneralRe: Change Dir inside CFileDialog Pin
Member 40147617-Feb-20 1:14
Member 40147617-Feb-20 1:14 
GeneralRe: Change Dir inside CFileDialog Pin
Victor Nijegorodov17-Feb-20 3:03
Victor Nijegorodov17-Feb-20 3:03 
GeneralRe: Change Dir inside CFileDialog Pin
Member 40147617-Feb-20 4:21
Member 40147617-Feb-20 4:21 
GeneralRe: Change Dir inside CFileDialog Pin
Victor Nijegorodov17-Feb-20 5:41
Victor Nijegorodov17-Feb-20 5:41 
GeneralRe: Change Dir inside CFileDialog Pin
Member 40147617-Feb-20 6:01
Member 40147617-Feb-20 6:01 
AnswerRe: Change Dir inside CFileDialog Pin
Victor Nijegorodov11-Feb-20 12:18
Victor Nijegorodov11-Feb-20 12:18 
GeneralRe: Change Dir inside CFileDialog Pin
Member 40147612-Feb-20 0:32
Member 40147612-Feb-20 0:32 
QuestionKeeping UDS_ALIGNRIGHT positioning for an updown control after moving the buddy window Pin
Alexander Kindel10-Feb-20 1:47
Alexander Kindel10-Feb-20 1:47 
AnswerRe: Keeping UDS_ALIGNRIGHT positioning for an updown control after moving the buddy window Pin
Richard MacCutchan10-Feb-20 1:58
mveRichard MacCutchan10-Feb-20 1:58 
GeneralRe: Keeping UDS_ALIGNRIGHT positioning for an updown control after moving the buddy window Pin
Alexander Kindel10-Feb-20 14:50
Alexander Kindel10-Feb-20 14:50 
GeneralRe: Keeping UDS_ALIGNRIGHT positioning for an updown control after moving the buddy window Pin
Richard MacCutchan10-Feb-20 22:59
mveRichard MacCutchan10-Feb-20 22: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.