Click here to Skip to main content
15,870,297 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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:
C++
HWND hwndParentDlg = ::GetParent( this->m_hWnd );											
HWND hwndShellDllDefView = ::FindWindowEx( hwndParentDlg, NULL, "SHELLDLL_DefView", NULL );		
HWND hwndSysListView = ::FindWindowEx( hwndShellDllDefView, NULL, "SysListView32", NULL );

And then calling
C++
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
Comments
Rage 25-Feb-14 7:32am    
Are your handlers (hwnd...) valid ? What does the SetSelectionMark return ?

1 solution

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[^]
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900