newntui/activex/queriescombo/src/queriescomboctl.cpp
//-----------------------------------------------------------------------------------------
// Callback runs every time the container wants to create component window. Creates the
// reflector window and the ListView window.
//-----------------------------------------------------------------------------------------
Callback runs every time the container wants to create component window. Creates the
reflector window and the ListView window.
Callback runs every time the container wants to create component window . Creates the reflector window and the ListView window .
int CQueriesComboCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct) {
	if (COleControl::OnCreate(lpCreateStruct) == -1)
		return -1;
	m_ListView.Create( LVS_SHAREIMAGELISTS | 
					   WS_CHILD | 
					   WS_VISIBLE | 
					   LVS_NOCOLUMNHEADER | 
					   LVS_LIST           |
					   LVS_AUTOARRANGE |
					   LVS_SHOWSELALWAYS,
		               CRect(lpCreateStruct->x, 
		                     lpCreateStruct->y,
			                 lpCreateStruct->x+lpCreateStruct->cx,
					         lpCreateStruct->y+lpCreateStruct->cy),
			       this,
				   IDC_QUERIESLIST);
	m_ListView.ModifyStyleEx( 0, WS_EX_CLIENTEDGE);
    LV_COLUMN lvColumn;
	lvColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT;
	lvColumn.fmt=LVCFMT_LEFT;
	lvColumn.cx=150;
	lvColumn.iSubItem=0;
	lvColumn.pszText="Categories";
    m_ListView.InsertColumn(0,&lvColumn);
	m_ImageList.Create(16,16,TRUE,1,0);
	CBitmap category;
	category.LoadBitmap(IDB_QUERYMAP);
	m_ImageList.Add(&category, RGB(255,255,255));
	m_ListView.SetImageList(&m_ImageList,LVSIL_SMALL); 
	return 0;
}
int CQueriesComboCtrl :: OnCreate ( LPCREATESTRUCT lpCreateStruct ) { if ( COleControl :: OnCreate ( lpCreateStruct ) == -1 ) return -1 ; m_ListView . Create ( LVS_SHAREIMAGELISTS | WS_CHILD | WS_VISIBLE | LVS_NOCOLUMNHEADER | LVS_LIST | LVS_AUTOARRANGE | LVS_SHOWSELALWAYS , CRect ( lpCreateStruct -> x , lpCreateStruct -> y , lpCreateStruct -> x + lpCreateStruct -> cx , lpCreateStruct -> y + lpCreateStruct -> cy ) , this , IDC_QUERIESLIST ) ; m_ListView . ModifyStyleEx ( 0 , WS_EX_CLIENTEDGE ) ; LV_COLUMN lvColumn ; lvColumn . mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT ; lvColumn . fmt = LVCFMT_LEFT ; lvColumn . cx = 150 ; lvColumn . iSubItem = 0 ; lvColumn . pszText = " " ; m_ListView . InsertColumn ( 0 , & lvColumn ) ; m_ImageList . Create ( 16 , 16 , TRUE , 1 , 0 ) ; CBitmap category ; category . LoadBitmap ( IDB_QUERYMAP ) ; m_ImageList . Add ( & category , RGB ( 255 , 255 , 255 ) ) ; m_ListView . SetImageList ( & m_ImageList , LVSIL_SMALL ) ; return 0 ; }
Callback runs every time the container wants to create component window.
Callback runs every time the container wants to create component window .
//----- We are going to create list view with only one column. //-----