

If you’re in the right way, it look like pic16. TextBox1->GetWindowText(strTextBoxValue)
#How to use getwindowtext in mfc code
Well now I have declared my variable name strTextBoxValue type CString and I want go to the event button click to write the code to put textbox value to this variable, where can I go?, follow step 13ġ3) in the file explorer, just in left, double click on p, it look like pic15Įnter these lines of code in void CMyFirstAppDlg::OnButton1() Scroll down, after the DECLARE_MESSAGE_MAP(), enter the follow lines of code Hmmm where can I declare my variable in global like in vb6, follow step 12 babyġ2) in the file explorer, just in left, double click on myFirstAppDlg.h, it look like pic13 We need to declare a variable type string that can hold a textbox value, to do that follow step 11ġ1) click on FileView, it look like pic12

to do that, follow step 10ġ0) double click on button1, it look like pic10 and just click ok, after click ok, it look like pic11

Our goal is when we click on button1 we get value of textbox and display it in a messagebox like vb6. Well I’m not a good English speaker but I will try my best to show you how do that, just follow my images 🙂ġ) when you open vc++ 6, it look like pic 1Ģ) click on new option from menu, it look like my pic 2ģ) under project name type >myFirstApp and click ok, after click ok, it look like pic 3Ĥ) check the option Dialog based and click next, after click next, it look like pic 4Ħ) just click next again, it look like pic6 and click on finish buttonħ) after click on finish button, it look like pic 7, just click on okĩ) drag a textbox and a button into the form, it look like pic9
