Click here to Skip to main content
15,906,106 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
GeneralRe: exports enum from COM Pin
vijay.victory21-Jan-09 2:26
vijay.victory21-Jan-09 2:26 
AnswerRe: exports enum from COM Pin
Stuart Dootson21-Jan-09 0:07
professionalStuart Dootson21-Jan-09 0:07 
QuestionCAtlHttpClient Pin
TURK18-Jan-09 7:08
TURK18-Jan-09 7:08 
AnswerRe: CAtlHttpClient Pin
Stuart Dootson18-Jan-09 7:37
professionalStuart Dootson18-Jan-09 7:37 
GeneralRe: CAtlHttpClient Pin
TURK18-Jan-09 8:16
TURK18-Jan-09 8:16 
GeneralRe: CAtlHttpClient Pin
Stuart Dootson18-Jan-09 8:27
professionalStuart Dootson18-Jan-09 8:27 
GeneralRe: CAtlHttpClient Pin
TURK18-Jan-09 9:51
TURK18-Jan-09 9:51 
QuestionCListViewCtrl creation does not produce column header arrow indicating sort order Pin
Jonathan Davies18-Jan-09 4:04
Jonathan Davies18-Jan-09 4:04 
I have a Dialog, inheriting from CDialogImpl, which contains a CListViewCtrl with three columns. In order to get the list items ordered correctly a custom sort function is used. It is in my handler for LVN_COLUMNCLICK< (Clicking a column header) that that the column header has the triangular bitmap indicating sort direction set.

On creation of the dialog, without the workaround shown below, no sort direction arrow appears on the header. I then have to call the LVN_COLUMNCLICK handler (see code) from OnInitDialog to force a sort of the first column in the order that my LVN_COLUMNCLICK handler sets the sort order triangular bitmap in the column header.
LRESULT CPortsDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
	...

	// Work-around to force list control to sort column 0 ascending on creation
	int idCtrl = 0;
	NMLISTVIEW nmlv;
	nmlv.iSubItem = 0;
	BOOL bHandled = FALSE;
	LPNMHDR lpNMHDR = reinterpret_cast<LPNMHDR>(&nmlv);
	OnLvnColumnclick(idCtrl, lpNMHDR, bHandled); 
	
        return 0;
}

This doesn't seem right; am I missing some feature that will ensure that upon creation a particular list column is sorted (using my custom sort) in, say, ascending order with the appropriate column header bitmap displayed to indicate this?

LRESULT CPortsDlg::OnLvnColumnclick(int /*idCtrl*/, LPNMHDR pNMHDR, BOOL& /*bHandled*/)
{
	// Get some calls where m_hwnd is 0
	if(!::IsWindow(m_hWnd))
	{
		return 0;
	}

	// ListView  Notification Message structure
	LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR); 

	// Want the format of the list column header
	HDITEM HeaderItem; 
	HeaderItem.mask = HDI_FORMAT; 
	
	// Attach a CHeaderCtrl to this CListViewCtrl's header
	CHeaderCtrl HeaderCtrl = m_ListViewCtrl.GetHeader(); 

	if(!::IsWindow(HeaderCtrl.m_hWnd))
	{
		return 0;
	}
	
	// For each list column...
	int nColumnCount = HeaderCtrl.GetItemCount();
	for(int nSelectedColumn = 0; nSelectedColumn < nColumnCount; nSelectedColumn++)
	{
		// Get the format for the sub-item (column)
		HeaderCtrl.GetItem(nSelectedColumn, &HeaderItem); 

		// Remove any up/down arrow from this column
		HeaderItem.fmt &= ~(HDF_SORTDOWN | HDF_SORTUP);

		if(nSelectedColumn == pNMLV->iSubItem)
		{
			// If this is a different column from any selected before use an up-arrow otherwise
			// base it on changing the direction from m_SortAscending
			m_SortAscending = (m_CurrentSortItem != pNMLV->iSubItem) ? true : !m_SortAscending; 

			HeaderItem.fmt |= m_SortAscending ? HDF_SORTUP : HDF_SORTDOWN;
		}
		// And update the column with the new format flags
		HeaderCtrl.SetItem(nSelectedColumn, &HeaderItem); 
	}
	m_CurrentSortItem = pNMLV->iSubItem;

	// Set the sort function to use passing a this ptr to the the global sort function
	m_ListViewCtrl.SortItems(SortFunc, (DWORD_PTR)this);
	return 0;
}

AnswerRe: CListViewCtrl creation does not produce column header arrow indicating sort order Pin
Stuart Dootson18-Jan-09 5:38
professionalStuart Dootson18-Jan-09 5:38 
GeneralRe: CListViewCtrl creation does not produce column header arrow indicating sort order Pin
Jonathan Davies18-Jan-09 11:34
Jonathan Davies18-Jan-09 11:34 
QuestionHow to achieve receiving file name using ICopyHook interface? Pin
SNI14-Jan-09 23:00
SNI14-Jan-09 23:00 
AnswerRe: How to achieve receiving file name using ICopyHook interface? Pin
Stuart Dootson17-Jan-09 23:01
professionalStuart Dootson17-Jan-09 23:01 
AnswerRe: How to achieve receiving file name using ICopyHook interface? Pin
gopu7418-Nov-09 5:53
gopu7418-Nov-09 5:53 
GeneralATL COM and DLL comparision........... [modified] Pin
vijay.victory13-Jan-09 23:52
vijay.victory13-Jan-09 23:52 
GeneralRe: ATL COM and DLL comparision........... Pin
Stuart Dootson14-Jan-09 10:37
professionalStuart Dootson14-Jan-09 10:37 
QuestionBSTR=&gt; CHARACTER ARRAY =&gt; BSTR conversion Pin
CHAN_SAI13-Jan-09 22:54
CHAN_SAI13-Jan-09 22:54 
AnswerRe: BSTR=&gt; CHARACTER ARRAY =&gt; BSTR conversion Pin
Stuart Dootson13-Jan-09 23:54
professionalStuart Dootson13-Jan-09 23:54 
GeneralRe: BSTR=&gt; CHARACTER ARRAY =&gt; BSTR conversion Pin
CHAN_SAI14-Jan-09 14:37
CHAN_SAI14-Jan-09 14:37 
GeneralRe: BSTR=&gt; CHARACTER ARRAY =&gt; BSTR conversion Pin
Stuart Dootson14-Jan-09 20:56
professionalStuart Dootson14-Jan-09 20:56 
QuestionATL_MSG_MAP identifier not found Pin
josip cagalj13-Jan-09 0:57
josip cagalj13-Jan-09 0:57 
AnswerRe: ATL_MSG_MAP identifier not found Pin
Stuart Dootson13-Jan-09 4:09
professionalStuart Dootson13-Jan-09 4:09 
GeneralRe: ATL_MSG_MAP identifier not found Pin
josip cagalj13-Jan-09 21:18
josip cagalj13-Jan-09 21:18 
GeneralRe: ATL_MSG_MAP identifier not found Pin
Stuart Dootson13-Jan-09 21:29
professionalStuart Dootson13-Jan-09 21:29 
QuestionRe: ATL_MSG_MAP identifier not found Pin
josip cagalj13-Jan-09 22:57
josip cagalj13-Jan-09 22:57 
AnswerRe: ATL_MSG_MAP identifier not found Pin
josip cagalj13-Jan-09 23:13
josip cagalj13-Jan-09 23:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.