本文介绍了如何在MFC中动态读取CEDIT的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在标签控件中动态创建了CEDIT
代码是

 m_cTab.CreateEdit( false  8  0 ,P_TOP, 550  40  190 ); 


controlID为8,tabID为0
我想读取输入的值
我的代码是

 CString str = " " ;
CEdit * pedit =(CEdit *)GetDlgItem( 8 ); 


pedit无法获得编辑控制.
它显示
pedit = 0x00000000 {CEdit hWnd = ???}

当我使用

 CEdit * pedit =(CEdit *):: GetDlgItem(m_cTab.GetSafeHwnd(), 8 );  pre> 
它显示

 pedit = 0x003405fa {CEdit hWnd = ???} 
解决方案


I have created a CEDIT dynamically in tab control
code is

m_cTab.CreateEdit(false,8, 0,P_TOP, 550, 40, 190);


controlID is 8 and tabID is 0
I want to read entered value
my code is

CString str="";
CEdit* pedit=(CEdit*)GetDlgItem(8);


pedit does not get edit control.
It shows
pedit = 0x00000000 {CEdit hWnd=???}

and when I use like

CEdit* pedit=(CEdit*)::GetDlgItem(m_cTab.GetSafeHwnd(),8);


It shows

pedit = 0x003405fa {CEdit hWnd=???}
解决方案


这篇关于如何在MFC中动态读取CEDIT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-17 15:27