Click here to Skip to main content
11,490,973 members (60,651 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C++ Windows MFC MFC/C++
Hey Guys,

here is an other question about the CCOmmonDlg.
I have a CCommonDlg and use it as FileOpen or FileSave Dialog.
In DoModal i pass a OPENFILENAME-Structure to the ::GetOpenFileName()/::GetSaveFileName() Function.

Now i have an hook , so i'm able to play a little bit with the controlls inside the window.
I want to select the file wich is passed by the OPENFILENAME Structure as the initial file name.
My idea was to get the Controll-Handley by FindWindowEx like this:
HWND hwndParentDlg = ::GetParent( this->m_hWnd );											
HWND hwndShellDllDefView = ::FindWindowEx( hwndParentDlg, NULL, "SHELLDLL_DefView", NULL );		
HWND hwndSysListView = ::FindWindowEx( hwndShellDllDefView, NULL, "SysListView32", NULL );
And then calling
ListView_SetSelectionMark( hwndSysListView, nIdx );
to select the Item at nIdx-Pos.

actually i do this in the CDN_FOLDERCHANGE Message inside WM_NOTIFY.
But it seems like the SysListView32 is not present here.
Where i could place my code?
Thanks a lot for your answers!

Best regards,
Posted 23-Feb-14 21:13pm
Rage at 25-Feb-14 7:32am
Are your handlers (hwnd...) valid ? What does the SetSelectionMark return ?

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 2

You should probably be using CFileDialog:[^]

You can do what you're trying to do by passing the appropriate arguments to the constructor:[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 521
1 Andy Lanng 288
2 Sascha Lefèvre 240
3 Maciej Los 195
4 OriginalGriff 163
0 Sergey Alexandrovich Kryukov 9,829
1 OriginalGriff 8,520
2 Sascha Lefèvre 3,574
3 Maciej Los 3,151
4 Richard Deeming 2,370

Advertise | Privacy | Mobile
Web03 | 2.8.150520.1 | Last Updated 25 Feb 2014
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100