Click here to Skip to main content
11,412,345 members (67,113 online)
Rate this: bad
good
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,
c3d1
Posted 23-Feb-14 21:13pm
C3D12K
Comments
Rage at 25-Feb-14 7:32am
   
Are your handlers (hwnd...) valid ? What does the SetSelectionMark return ?

1 solution

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

Solution 2

You should probably be using CFileDialog:
http://msdn.microsoft.com/en-us/library/dk77e5e7.aspx[^]

You can do what you're trying to do by passing the appropriate arguments to the constructor:
http://msdn.microsoft.com/en-us/library/wh5hz49d.aspx[^]
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 332
1 Sascha Lefévre 200
2 Sergey Alexandrovich Kryukov 140
3 Maciej Los 135
4 ProgramFOX 130
0 Sergey Alexandrovich Kryukov 9,025
1 OriginalGriff 7,247
2 Maciej Los 3,525
3 Abhinav S 3,248
4 Peter Leow 3,059


Advertise | Privacy | Mobile
Web01 | 2.8.150414.5 | 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