Windows 11, Visual Studio 2022, C++, MFC
I have been having great difficulties getting the basics working.
I was directed here from another Microsoft forum. When posting the question the drop downs for tag, child tag, and child item tag, have nothing that looks like a programming question for Visual Studio. Am I in the wrong place? If so, please redirect me.
Basic Problem
The code can write to the Edit Controls. It cannot clear them. The debugger indicates that the lower level calls are are defective, even though they work when the Edit Control is not full. I suspect my declarations have a defect that but my knowledge is insufficient.
Details
This app does some 512 bit arithmetic using an array of uint64_t. It displays the numbers, in hex, in Edit controls. Below is the lowest level of my code that does the hex display. lp_cedit points to the edit control. lp_binary points to an array of ints, uint64_t.
lp_cedit->Clear(); // first two images are for this line and stepping in.
…
``for( int i = 0; i < U64_COUNT; i++) `` ``{
``lp_binary->u64t[i] = input->u64t[i]; // copy the number to the lp_binary
``hex_string.Format(_T("%016llX "), lp_binary->u64t[i]); // Format each 64-bit word as hex
``lp_cedit->SetSel(-1, -1); // Move the cursor to the end of the edit control
``lp_cedit->ReplaceSel(hex_string); // second two images for this line.
``}
The very first time the code attempts to display anything, in the debugger, at the Clear function, the Autos panel shows:

Step into the Clear function to see

The Autos display looks bad, but it does not assert. Visual Studio makes no sound.
Step out and down to the first call to ReplaceSel to see

Looks OK to me. Step in to find the below
This looks bad. BUT it writes to the edit control. Until the Edit Control is full of text. They are set to no scroll. Then the Clear() does nothing, does not assert, and the ReplaceSel() does nothing but it does assert.
The two critical pointers are declared and set as shown below
CEdit`` ``*lp_cedit = nullptr;``
td_512_uint *lp_binary = nullptr;
and used further down successfully
p_cedit = &m_edit_input_a;
p_select_binary = &m_512_input_a;
The ReplaceSel() works until the Edit Control is full. The Clear() function appears to never work but never asserts. It seems obvious to me that I have a setup wrong.
I am hoping someone with more experience can recognize the problem.