Hey out there,
i'm using a CCommonDlg based FileOpen Dlg.
I wan't to do some stuff with the CListCtrl (for example selecting an item) after the Dialog has been created.
So i add my additional functionality into my OnInitDone() function which i called this way from the OnNotify:
BOOL CMyFileDialog::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
OFNOTIFY* pNotify = (OFNOTIFY*)lParam;
switch(pNotify->hdr.code)
{
case CDN_INITDONE:
OnInitDone();
return TRUE;
case CDN_SELCHANGE:
OnFileNameChange();
return TRUE;
case CDN_FOLDERCHANGE:
OnFolderChange();
return TRUE;
}
}
But into the OnInitDone function it seems like the Control doesen't exsist.
When i call FindWindowEx in the following way it always returns 0x0:
HWND hwndParentDlg = ::GetParent(this->m_hWnd);
HWND hwndShellDllDefView = ::FindWindowEx(hwndParentDlg, NULL, "SHELLDLL_DefView", NULL);
HWND hwndSysListView = ::FindWindowEx(hwndShellDllDefView, NULL, "SysListView32", NULL);
I played a little bit around and checked if i can get the HWNDs in OnFolderChange(). At the first look it seems everything is ok here, i get a valid HWND from the SysListView32.
But at the secound look it seems like the Control exists but have no items.
So i put my code into the OnFileNameChange() for checking if i put my code at the "wrong place" or if my code is faulty.
Here inside the OnFileNameChange() everything is cool. The HWND is valid and i can access to the items in the SysListView32.
The problem is, i want to do my little adjustments after the Dialog has been created and not if the user select a new file.
So please help me and please forgive me my bad english.
Thank you so much guys for helping me!!!!