explorebar使用专题

27 篇文章 0 订阅

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))

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值