1 更新pane中的控件类型
If you have ever tried to change the style of a "TaskLink32" based item you might find it hard. I've tried to ask a question about it earlier. But I did not get an answer.
The author uses a PTLSTRUCT pointer that contains the data about the controls style etc, it is created combined with the GWL_STYLE var from the SetWindowLong()-function, but it does not update in a fly. So to handle that, we delete the control and create a new one with the new style, like this:
void UpdateCtrl(DWORD nDialog, DWORD Style, DWORD nDlgItem)
{
//Assume that your explorerbar is named m_wndExpBar
HWND hWndDlg = m_wndExpBar.GetPaneDialogWindow(nDialog);
HWND hWnd2 = ::GetDlgItem(hWndDlg, nDlgItem);
if(hWnd2==NULL)
return;
//Get the size of the rect
RECT Rect;
RECT Win;
::GetWindowRect(hWndDlg, &Win);
::GetWindowRect(hWnd2, &Rect);
//Set the quit signal to the control we're gonna mezz with!
m_wndExpBar.ThreadSendDlgItemMessage(hWndDlg,IDC_ADVANCE,WM_CLOSE, NULL, NULL);
HWND hWnd=CreateWindow(TASKLINKCLASSNAME, "Some text you can extract this is just an example", Style,Rect.left-Win.left,Rect.top-Win.top,Rect.right-Rect.left,Rect.bottom-Rect.top,hWndDlg, NULL, NULL, NULL);
//Set the window dlg ID
::SetWindowLong(hWnd, GWL_ID, nDlgItem);
}
2 设置文本控件的内容
It's actually quite simple. You just get the HWND of the pane by sending the CBM_GETPANEDIALOG message (refer to the documentation) and then just SetDlgItemText(). After setting the text you have to update the pane like this:
::InvalidateRect(m_hWndPane, NULL, FALSE);
::UpdateWindow(m_hWndPane);
3 更新ExplorerBar
InvalidateRect(hwndExpBar,NULL,FALSE);
UpdateWindow(hwndExpBar);
4 afxNil 解决办法
if (!CMiniFrameWnd::CreateEx(dwExStyle,
NULL, &afxChNil, dwStyle, rectDefault, pParent))
As a quick fix to get the sample to compile, I defined my own variable:
TCHAR chNil = _T('\0');
if (!CMiniFrameWnd::CreateEx(dwExStyle,
NULL, &chNil, dwStyle, rectDefault, pParent))