Click here to Skip to main content
13,043,898 members (55,303 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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 20:13pm
Rage 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
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 25 Feb 2014
Copyright © CodeProject, 1999-2017
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