Click here to Skip to main content
15,894,017 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Compiler: Visual C++ Standard Edition 4.0
Language: C
Project type: Win32

Problem: I have created 6 edit controls and one pushbutton. I created them
in this order: 4 edit controls, pushbutton, 2 edit controls(read only).
They all function properly BUT I can copy the text from only the 3rd and
4th edit boxes. The buffers were initialized when declared and the 1st and
2nd buffers get over written with spaces. I am using Edit_GetText to get
the text. This program is being written to make a calculation. The data in
the first 4 edit boxes will be used to make the calculation and the answers
will be displayed in the last 2 edit boxes. The pushbutton is the Calc button.
So, I enter the text in the first 4 boxes, hit the calc button, and then as
a test I display the text using TextOut and only the text from number 3 and 4
are displayed. The lines used for number 1 and 2 are blank. These are not
dialog boxes, just edit controls. I have done a lot of research and tried
different things but have not solved the problem. I would appreciate some
help very much. Thanks, John
Posted
Comments
BillWoodruff 11-Oct-14 10:19am    
fyi: there is a C/C++ Forum here under the Discussions Tab
[no name] 11-Oct-14 12:58pm    
Some code demonstrating this problem would help.

1 solution

I finally discovered the problem. As stated I'm using six edit controls, two of
which are read only. I declared a four element array for the input controls and
a two element array for the output controls: hEditIN[4] and hEditOut[2]. Then I
used for loops to create them; looping through the arrays as well as their IDs and screen positions. Well, I discovered today that in the loop for the read only controls I used hEditIN instead of hEditOut!!!!!! Since I wasn't paying any attention to the read only controls at this point I didn't catch the error.
Now after the Calc button is clicked WM_COMMAND catches it and I loop through
the hEditIN array and call Edit_GetText for each element and at this point
display the results in the parent window. Man, what an experience! Now I can get on with it!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900