Click here to Skip to main content
15,887,596 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Object Data lost when dialog is moved 'off screen Pin
Richard Andrew x648-Jan-16 15:34
professionalRichard Andrew x648-Jan-16 15:34 
GeneralRe: Object Data lost when dialog is moved 'off screen Pin
Member 1225301011-Jan-16 5:45
Member 1225301011-Jan-16 5:45 
QuestionHow to analyze what time Windows 7(XP) once run any program? Pin
AnsiliWork7-Jan-16 14:55
AnsiliWork7-Jan-16 14:55 
SuggestionRe: How to analyze what time Windows 7(XP) once run any program? Pin
Richard MacCutchan7-Jan-16 22:08
mveRichard MacCutchan7-Jan-16 22:08 
GeneralRe: How to analyze what time Windows 7(XP) once run any program? Pin
AnsiliWork8-Jan-16 19:32
AnsiliWork8-Jan-16 19:32 
QuestionRe: How to analyze what time Windows 7(XP) once run any program? Pin
David Crow8-Jan-16 11:56
David Crow8-Jan-16 11:56 
AnswerRe: How to analyze what time Windows 7(XP) once run any program? Pin
AnsiliWork8-Jan-16 20:31
AnsiliWork8-Jan-16 20:31 
QuestionStrange CListBox Behavior Pin
wdolson7-Jan-16 14:44
wdolson7-Jan-16 14:44 
I have a bizarre problem with a dialog. I created a dialog to move items between two lists. The left list box has the pool of possible items that are unused on the left and the items being used on the right. In between the two are a bunch of buttons to move selected items left or right, or move the entire list from one box to the other.

The boxes are defined as:
C++
CListBox m_lstLeft;
CListBox m_lstRight;

In the .RC file the boxes are defined as follows:

C++
LISTBOX         IDC_LSEL_LSTLEFT,7,25,115,186,LBS_MULTIPLESEL | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
LISTBOX         IDC_LSEL_LSTRIGHT,178,25,115,186,LBS_MULTIPLESEL | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP

The code for loading and handling the boxes is the same with just the names of the boxes changed. For example the move right button handling code extracts an item from the left box and puts in the the right and the move left button does the opposite.

Moving an item from the left box to the right works as expected. The code to get the item from the left box is:

C++
CArray<int,int> aryListBoxSel;
aryListBoxSel.SetSize(nCount);
m_lstLeft.GetSelItems(nCount, aryListBoxSel.GetData());
for(i=0; i<nCount; i++)
{
    idx = aryListBoxSel.GetAt(i);
    val = (float)m_lstLeft.GetItemData(idx);
    // does stuff with val here
}

If idx 2, the third item in the list ends up in val as expected.

However, moving from right to left, using a mirror image of the same code:

C++
idx = aryListBoxSel.GetAt(i);
val = (float)m_lstRight.GetItemData(idx);

val is always the last item in the list, no matter what idx is.

I compared the code and everything is a mirror image of the other. The two lists are defined the same way, loaded the same way, and accessed the same way.

What could possibly be wrong? As far as I can tell, I am setting up two identical list boxes and getting two different results.

modified 8-Jan-16 4:01am.

GeneralRe: Strange CListBox Behavior Pin
Richard MacCutchan7-Jan-16 22:07
mveRichard MacCutchan7-Jan-16 22:07 
GeneralRe: Strange CListBox Behavior Pin
Jochen Arndt7-Jan-16 22:18
professionalJochen Arndt7-Jan-16 22:18 
SuggestionRe: Strange CListBox Behavior Pin
Jochen Arndt7-Jan-16 22:17
professionalJochen Arndt7-Jan-16 22:17 
GeneralRe: Strange CListBox Behavior Pin
wdolson7-Jan-16 22:42
wdolson7-Jan-16 22:42 
GeneralRe: Strange CListBox Behavior Pin
Richard MacCutchan7-Jan-16 22:51
mveRichard MacCutchan7-Jan-16 22:51 
AnswerRe: Strange CListBox Behavior Pin
wdolson7-Jan-16 23:09
wdolson7-Jan-16 23:09 
GeneralRe: Strange CListBox Behavior Pin
Jochen Arndt7-Jan-16 23:11
professionalJochen Arndt7-Jan-16 23:11 
GeneralRe: Strange CListBox Behavior Pin
wdolson7-Jan-16 23:18
wdolson7-Jan-16 23:18 
GeneralRe: Strange CListBox Behavior Pin
Jochen Arndt7-Jan-16 23:26
professionalJochen Arndt7-Jan-16 23:26 
GeneralRe: Strange CListBox Behavior Pin
wdolson7-Jan-16 23:33
wdolson7-Jan-16 23:33 
GeneralRe: Strange CListBox Behavior Pin
Jochen Arndt7-Jan-16 23:42
professionalJochen Arndt7-Jan-16 23:42 
GeneralRe: Strange CListBox Behavior Pin
Richard MacCutchan8-Jan-16 1:04
mveRichard MacCutchan8-Jan-16 1:04 
QuestionEasy to use asymmetric (public key) encryption Pin
peterchen6-Jan-16 5:26
peterchen6-Jan-16 5:26 
QuestionHow to communicate between two different app using SendMessage API? Pin
Anasuya201529-Dec-15 19:56
Anasuya201529-Dec-15 19:56 
AnswerRe: How to communicate between two different app using SendMessage API? Pin
Richard MacCutchan29-Dec-15 22:29
mveRichard MacCutchan29-Dec-15 22:29 
GeneralRe: How to communicate between two different app using SendMessage API? Pin
Anasuya201530-Dec-15 2:32
Anasuya201530-Dec-15 2:32 
QuestionRe: How to communicate between two different app using SendMessage API? Pin
Richard MacCutchan30-Dec-15 2:41
mveRichard MacCutchan30-Dec-15 2:41 

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.