R
Randy Sanders
Guest
We have code (attached snippet) that checks which column in a CListCtrl a user has double clicked in. It works correctly unless the user has the dialog open on a third monitor and the third monitor is configured to be to the far left of the first monitor. (In Windows the monitors will be listed as 3,2,1 left to right) The only way we have found to fix it is to change the order of the monitors in Windows and then physically rearrange them. Is there something else we can do to make this work programmaticly?
** CODE SNIPPET
void SEQUENCE_DLG::OnNMDblclkSequenceList1(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast<LPNMITEMACTIVATE>(pNMHDR);
DWORD dwPos;
//Get were the pick is in the list
dwPos = GetMessagePos();
//Set the screen points
POINT PopupMenuClientPoint;
PopupMenuClientPoint.x = LOWORD(dwPos);
PopupMenuClientPoint.y = HIWORD(dwPos);
// Convert the point from screen to client coordinates,
// relative to the listview
m_SEQUENCE_LIST1.ScreenToClient(&PopupMenuClientPoint);
LVHITTESTINFO hitinfo = { 0 };
hitinfo.pt = PopupMenuClientPoint;
m_SEQUENCE_LIST1.SubItemHitTest(&hitinfo);
....
After this code is ran, the hitinfo.iSubItem member will be -1, but only on the third monitor. If I drag the dialog to any other monitor or rearrange them, then it correctly returns the column number.
Continue reading...
** CODE SNIPPET
void SEQUENCE_DLG::OnNMDblclkSequenceList1(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast<LPNMITEMACTIVATE>(pNMHDR);
DWORD dwPos;
//Get were the pick is in the list
dwPos = GetMessagePos();
//Set the screen points
POINT PopupMenuClientPoint;
PopupMenuClientPoint.x = LOWORD(dwPos);
PopupMenuClientPoint.y = HIWORD(dwPos);
// Convert the point from screen to client coordinates,
// relative to the listview
m_SEQUENCE_LIST1.ScreenToClient(&PopupMenuClientPoint);
LVHITTESTINFO hitinfo = { 0 };
hitinfo.pt = PopupMenuClientPoint;
m_SEQUENCE_LIST1.SubItemHitTest(&hitinfo);
....
After this code is ran, the hitinfo.iSubItem member will be -1, but only on the third monitor. If I drag the dialog to any other monitor or rearrange them, then it correctly returns the column number.
Continue reading...