从编辑控件获取数据.我想获得反馈 [英] Get data from edit control. I wanna get feedback

查看:94
本文介绍了从编辑控件获取数据.我想获得反馈的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做一些功能.
当用户在编辑控件上键入value时,该值会在某些情况下被过滤.
我更改密码.我只是在代码的某些部分显示.
您可以检查我的代码并提供更好的方法吗?

I make some function.
When user type value on edit control, the value is filtered my some condition.
I change codes. I just show on some parts of my codes.
Can you check my codes and give better way?

void CSerialTestDlg::SetGainData()
{  

  std::wstring a=L"";  
  std::wstring a2=L"";
  std::wstring a3=L"";
 
  CString cstr="";
  CString cstrB="";
  CString cstrC="";
  
  int iLength=0;

  int *GainData = new int[3];
  memset(GainData,0x00,sizeof(int)*3);

  iLength=  Edit_VGain.GetWindowTextLengthA();
  a.resize(iLength);
  cstr = a.c_str();
  Edit_VGain.GetWindowTextA(cstr);

  iLength=  Edit_AGain.GetWindowTextLengthA();
  a2.resize(iLength);
  cstrB = a2.c_str();
  Edit_AGain.GetWindowTextA(cstrB);

  iLength=  Edit_BoardID.GetWindowTextLengthA();
  a3.resize(iLength);
  cstrC = a3.c_str();
  Edit_BoardID.GetWindowTextA(cstrC);

  delete GainData;


}

推荐答案

以下是您改进的代码:

Here is your improved code:

void CSerialTestDlg::SetGainData()
{  
  CString cstr="";
  CString cstrB="";
  CString cstrC="";

  Edit_VGain.GetWindowTextA(cstr);
  Edit_AGain.GetWindowTextA(cstrB);
  Edit_BoardID.GetWindowTextA(cstrC);
}


就我所见,完全一样.


Does exactly the same as far as I can see.


嗨!

为什么不简单地使用
Hi !

Why not simply use the
Edit.GetWindowText(MyStr)

,其中

MyStr 

的类型是

CString 

以在编辑框中获取字符串?

to get the string in the edit box ?


这篇关于从编辑控件获取数据.我想获得反馈的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆