-
July 27th, 2004, 01:50 PM
#31
I didnt set the HDITEM in the NMHEADER struct. Do I need to do this? usman999_1 said to use HDM_GETITEM message to get this. Could this be my problem?
Last edited by senkyoshi; July 27th, 2004 at 05:49 PM.
-
July 27th, 2004, 05:50 PM
#32
Instead I use pHCtrl->GetItem(3, &hdi). Here is what I have so far:
LRESULT CMyFileDialog::OnMyMessage(WPARAM, LPARAM)
{
CListCtrl* plc = (CListCtrl*)GetParent()->GetDlgItem(lst2)->GetDlgItem(1);
CHeaderCtrl *pHCtrl = plc->GetHeaderCtrl();
HWND hHeaderCtrl = pHCtrl->m_hWnd;
NMHDR nmHDR;
nmHDR.hwndFrom = hHeaderCtrl;
nmHDR.idFrom = pHCtrl->GetDlgCtrlID();
HDITEM hdi;
pHCtrl->GetItem(3, &hdi);
NMHEADER NMHeader;
NMHeader.hdr = nmHDR;
NMHeader.iItem = 3;
NMHeader.iButton = 0;
NMHeader.pitem = &hdi;
::SendMessage(::GetParent(hHeaderCtrl),WM_NOTIFY,NULL,(LPARAM)&NMHeader);
return 0;
}
Anyways, the dialog comes up great but it still doesnt sort by the modified column
-
July 29th, 2004, 11:05 AM
#33
Just figured it out
Just in case anyone cared I just figured out how to do it.
I made the Modified item the first in the header and then found the bounding rectangle for that item. Then, I did a PostMessage to simulate a button press. I couldnt get sendmessage to work at all. Anyways, I am so happy to finally have this case closed. Thanks to those that helped me! here is my code:
LRESULT CMyFileDialog::OnMyMessage(WPARAM, LPARAM)
{
CListCtrl* plc = (CListCtrl*)GetParent()->GetDlgItem(lst2)->GetDlgItem(1);
CHeaderCtrl *pHCtrl = plc->GetHeaderCtrl();
HDITEM hdi;
pHCtrl->GetItem(3, &hdi);
int iArray[] = {3,0,1,2};
pHCtrl->SetOrderArray(4, iArray);
CPoint point;
RECT pRect;
pHCtrl->GetItemRect(3, &pRect);
pHCtrl->PostMessage(WM_LBUTTONDOWN, MK_LBUTTON,MAKELONG((WORD) (pRect.left + 5),(WORD) (pRect.top + 5)));
pHCtrl->PostMessage(WM_LBUTTONUP, MK_LBUTTON,MAKELONG((WORD) (pRect.left + 5),(WORD) (pRect.top + 5)));
return 0;
}
-
July 29th, 2004, 11:17 AM
#34
Congratulation!
With the best regards,
Victor
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|