本文整理汇总了C++中CHeaderCtrl::GetSafeHwnd方法的典型用法代码示例。如果您正苦于以下问题:C++ CHeaderCtrl::GetSafeHwnd方法的具体用法?C++ CHeaderCtrl::GetSafeHwnd怎么用?C++ CHeaderCtrl::GetSafeHwnd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CHeaderCtrl
的用法示例。
在下文中一共展示了CHeaderCtrl::GetSafeHwnd方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Init
BOOL CComboListCtrl::Init()
{
if (m_blInited)
return TRUE;
CHeaderCtrl* pHeadCtrl = this->GetHeaderCtrl();
ASSERT(pHeadCtrl->GetSafeHwnd());
VERIFY( m_checkHeadCtrl.SubclassWindow(pHeadCtrl->GetSafeHwnd()) );
VERIFY( m_checkImgList.Create(IDB_LIST_CHECKBOXES, 16, 3, RGB(255,0,255)) );
int i = m_checkImgList.GetImageCount();
m_checkHeadCtrl.SetImageList(&m_checkImgList);
HDITEM hdItem;
hdItem.mask = HDI_IMAGE | HDI_FORMAT;
VERIFY( m_checkHeadCtrl.GetItem(0, &hdItem) );
hdItem.iImage = 1;
hdItem.fmt |= HDF_IMAGE;
VERIFY( m_checkHeadCtrl.SetItem(0, &hdItem) );
m_blInited = TRUE;
return TRUE;
}
示例2: PreSubclassWindow
void CListCtrlCl::PreSubclassWindow()
{
// TODO: 在此添加专用代码和/或调用基类
ModifyStyle(0,LVS_OWNERDRAWFIXED);
CListCtrl::PreSubclassWindow();
CHeaderCtrl *pHeader = GetHeaderCtrl();
m_Header.SubclassWindow(pHeader->GetSafeHwnd());
}
示例3: PreSubclassWindow
void CMyListCtrl::PreSubclassWindow()
{
// TODO: Add your specialized code here and/or call the base class
// TODO: 在此添加专用代码和/或调用基类
ModifyStyle(0,LVS_OWNERDRAWFIXED);
CListCtrl::PreSubclassWindow();
this->SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES);
CHeaderCtrl *pHeader = GetHeaderCtrl();
m_Head.SubclassWindow(pHeader->GetSafeHwnd());
CListCtrl::PreSubclassWindow();
}
示例4: initHeadListCtr
BOOL CSortListCtrl::initHeadListCtr(BOOL showHeadCheckBox)
{
m_ctlHeader.SetHeadCheckBox(showHeadCheckBox);
if(!showHeadCheckBox) return TRUE;
CHeaderCtrl* pHeadCtrl = GetHeaderCtrl();
ASSERT(pHeadCtrl->GetSafeHwnd());
// VERIFY( m_ctlHeader.SubclassWindow( GetHeaderCtrl()->GetSafeHwnd() ) );
VERIFY( m_checkImgList.Create(IDB_CHECKBOXES, 16, 3, RGB(255,0,255)) );
int i = m_checkImgList.GetImageCount();
m_ctlHeader.SetImageList(&m_checkImgList);
HDITEM hdItem;
hdItem.mask = HDI_IMAGE | HDI_FORMAT;
VERIFY( m_ctlHeader.GetItem(0, &hdItem) );
hdItem.iImage = 1;
hdItem.fmt |= HDF_IMAGE;
VERIFY( m_ctlHeader.SetItem(0, &hdItem) );
return TRUE;
}
示例5: OnInitDialog
//.........这里部分代码省略.........
m_FilterLC.InsertColumn(MFLC_EXPORT, cs_text);
// Make some columns centered
m_FilterLC.SetColumn(MFLC_FILTER_SOURCE, &lvc);
m_FilterLC.SetColumn(MFLC_INUSE, &lvc);
m_FilterLC.SetColumn(MFLC_COPYTODATABASE, &lvc);
m_FilterLC.SetColumn(MFLC_EXPORT, &lvc);
// Populate CListCtrl
UpdateFilterList();
// if no filters - add a dummy before adjusting item height
bool bAddDummy(false);
if (m_FilterLC.GetItemCount() == 0) {
bAddDummy = true;
int iItem = m_FilterLC.InsertItem(0 /* MFLC_FILTER_NAME */, L"");
CString cs_source = GetFilterPoolName(FPOOL_SESSION);
m_FilterLC.SetItemText(iItem, MFLC_FILTER_SOURCE, cs_source);
m_FilterLC.SetItemText(iItem, MFLC_INUSE, L".");
m_FilterLC.SetItemText(iItem, MFLC_COPYTODATABASE, L".");
m_FilterLC.SetItemText(iItem, MFLC_EXPORT, L".");
st_FilterItemData *pflt_idata = new st_FilterItemData;
pflt_idata->flt_key.cs_filtername = L".";
pflt_idata->flt_key.fpool = FPOOL_SESSION;
pflt_idata->flt_flags = MFLT_REQUEST_COPY_TO_DB | MFLT_REQUEST_EXPORT | MFLT_INUSE;
m_FilterLC.SetItemData(iItem, (DWORD_PTR)pflt_idata);
}
// Set row height to take image by adding a dummy ImageList
CRect rect;
m_FilterLC.GetItemRect(0, &rect, LVIR_BOUNDS);
IMAGEINFO imageinfo;
m_pCheckImageList->GetImageInfo(0, &imageinfo);
int irowheight = std::max(rect.Height(),
(int)abs(imageinfo.rcImage.top - imageinfo.rcImage.bottom));
m_pImageList = new CImageList;
m_pImageList->Create(1, irowheight, ILC_COLOR4, 1, 1);
m_FilterLC.SetImageList(m_pImageList, LVSIL_SMALL);
// If we added a dummy row - delete it
if (bAddDummy) {
st_FilterItemData *pflt_idata = (st_FilterItemData *)m_FilterLC.GetItemData(0);
delete pflt_idata;
m_FilterLC.DeleteItem(0);
}
dwExStyle = m_FilterProperties.GetExtendedStyle();
dwExStyle |= LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES;
m_FilterProperties.SetExtendedStyle(dwExStyle);
cs_text = L" # ";
m_FilterProperties.InsertColumn(MFPRP_FILTER_NUMBER, cs_text);
cs_text.LoadString(IDS_FILTERACTIVE);
cs_text += L"?";
m_FilterProperties.InsertColumn(MFPRP_FILTER_ACTIVE, cs_text);
cs_text.LoadString(IDS_AND_OR);
m_FilterProperties.InsertColumn(MFPRP_AND_OR, cs_text);
cs_text.LoadString(IDS_FILTERFIELD);
m_FilterProperties.InsertColumn(MFPRP_FIELD, cs_text);
cs_text.LoadString(IDS_CRITERIA_DESC);
m_FilterProperties.InsertColumn(MFPRP_CRITERIA_TEXT, cs_text);
// Make first 3 columns centered
m_FilterProperties.SetColumn(MFPRP_FILTER_NUMBER, &lvc);
m_FilterProperties.SetColumn(MFPRP_FILTER_ACTIVE, &lvc);
m_FilterProperties.SetColumn(MFPRP_AND_OR, &lvc);
CHeaderCtrl* pHCtrl;
pHCtrl = m_FilterLC.GetHeaderCtrl();
ASSERT(pHCtrl != NULL);
pHCtrl->SetDlgCtrlID(IDC_FILTERLC_HEADER);
m_FLCHeader.SubclassWindow(pHCtrl->GetSafeHwnd());
pHCtrl = m_FilterProperties.GetHeaderCtrl();
ASSERT(pHCtrl != NULL);
pHCtrl->SetDlgCtrlID(IDC_FILTERPROP_HEADER);
m_FPROPHeader.SubclassWindow(pHCtrl->GetSafeHwnd());
for (int i = 0; i < MFPRP_NUM_COLUMNS; i++) {
m_FilterProperties.SetColumnWidth(i, LVSCW_AUTOSIZE_USEHEADER);
}
m_FLCHeader.SetStopChangeFlag(true);
m_FPROPHeader.SetStopChangeFlag(true);
// Nothing is selected yet
GetDlgItem(IDC_FILTEREDIT)->EnableWindow(FALSE);
GetDlgItem(IDC_FILTERDELETE)->EnableWindow(FALSE);
// Don't import if we can't validate
#ifndef USE_XML_LIBRARY
GetDlgItem(IDC_FILTERIMPORT)->EnableWindow(FALSE);
#endif
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
}
示例6: OnInitDialog
BOOL CPWFiltersDlg::OnInitDialog()
{
std::vector<UINT> vibottombtns;
UINT main_bns[] = {IDC_APPLY, IDOK, IDCANCEL, ID_HELP};
UINT other_bns[] = {IDOK, IDCANCEL, ID_HELP};
if (m_iType == DFTYPE_MAIN && m_bAllowSet)
vibottombtns.assign(main_bns, main_bns + _countof(main_bns));
else
vibottombtns.assign(other_bns, other_bns + _countof(other_bns));
AddMainCtrlID(IDC_FILTERLC);
AddBtnsCtrlIDs(vibottombtns);
UINT statustext[1] = {IDS_BLANK};
SetStatusBar(&statustext[0], 1);
CPWResizeDialog::OnInitDialog();
SetWindowText(m_cstitle);
m_hAccel = ::LoadAccelerators(AfxGetResourceHandle(),
MAKEINTRESOURCE(IDR_FILTERACCELERATOR));
DWORD dwExStyle = m_FilterLC.GetExtendedStyle();
dwExStyle |= LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_SUBITEMIMAGES;
m_FilterLC.SetExtendedStyle(dwExStyle);
m_FilterLC.Init(this, m_pfilters, m_iType, m_bCanHaveAttachments, m_psMediaTypes);
if (m_filtername.IsEmpty() || m_pfilters->fname.empty())
m_filtername.LoadString(IDS_FILTER_NAME);
else
m_filtername = m_pfilters->fname.c_str();
CHeaderCtrl* pHCtrl;
pHCtrl = m_FilterLC.GetHeaderCtrl();
ASSERT(pHCtrl != NULL);
pHCtrl->SetDlgCtrlID(IDC_FILTERLC_HEADER);
m_FLCHeader.SubclassWindow(pHCtrl->GetSafeHwnd());
m_FLCHeader.SetStopChangeFlag(true);
CRect rect;
// Move over History & Policy dialogs so as not to obscure main filter dialog
if (m_iType != DFTYPE_MAIN) {
GetParent()->GetWindowRect(&rect);
SetWindowPos(NULL, rect.left + rect.Width() / 3, rect.top + rect.Width() / 3,
0, 0, SWP_NOSIZE | SWP_NOZORDER);
}
// Main window has Apply (if not called via Manage), OK, Cancel buttons
// History/Policy/Attachment have OK, Cancel, Help buttons
// but only one dialog definition in resource file for both in
// order to ensure that the dialogs look exactly the same and also
// easier to maintain
if (m_iType != DFTYPE_MAIN) {
GetDlgItem(IDC_FILTERNAME)->EnableWindow(FALSE);
}
if (!m_bAllowSet) {
// Change buttons if called via ManageFilters or
// is a History/Policy dialog
GetDlgItem(IDC_APPLY)->EnableWindow(FALSE);
GetDlgItem(IDC_APPLY)->ShowWindow(SW_HIDE);
}
int itotalwidth = 0;
for (int i = 0; i < FLC_NUM_COLUMNS; i++) {
itotalwidth += m_FilterLC.GetColumnWidth(i);
}
int iMaxWidth = itotalwidth + 16;
int iMaxHeight = 1024;
SetMaxHeightWidth(iMaxHeight, iMaxWidth);
// Update dialog window text
UpdateStatusText();
UpdateData(FALSE);
if (m_iType == DFTYPE_MAIN)
GetDlgItem(IDC_APPLY)->EnableWindow(m_pfilters->num_Mactive == 0 ? FALSE : TRUE);
return TRUE; // return TRUE unless you set the focus to a control
}