Colderleo's blog Colderleo's blog
首页
Linux
C++
Python
前端
工具软件
mysql
索引
关于
GitHub (opens new window)

Colder Leo

热爱代码的打工人
首页
Linux
C++
Python
前端
工具软件
mysql
索引
关于
GitHub (opens new window)
  • Windows
gaoliu
2021-10-06

CEdit 和CStatic获取和设置文本框的方法

先设置多字节字符库

1、获取文本框输入

((CEdit*)GetDlgItem(IDC_EDIT_text))->GetWindowTextA(strTmp);
或者:关联变量m_dedit,然后m_dedit.GetWindowText(strTmp);
或者:GetWindowText(GetDlgItem(hWnd, IDC_SRCFILE), szPathname, _countof(szPathname));
或者: Static_GetText(GetDlgItem(hWnd, IDC_SRCFILE),  szPathname, _countof(szPathname));
1
2
3
4

2、设置文本框输入

((CStatic*)GetDlgItem(IDC_Sta_SjbPort))->SetWindowText("10003");
1

3、IP地址框获取输入的ip地址

BYTE f0,f1,f2,f3;
((CIPAddressCtrl *)(GetDlgItem(IDC_IPADDRESS3))) -> GetAddress(f0,f1,f2,f3);
Server_strIP.Format("%d.%d.%d.%d",f0,f1,f2,f3);
1
2
3
编辑 (opens new window)
上次更新: 2021/10/11, 12:43:58
最近更新
01
通过模板实现结构体成员拷贝-按成员名匹配
05-07
02
c++17通过模板获取类成员的个数
05-01
03
avx-sse切换惩罚
04-30
更多文章>
Theme by Vdoing | Copyright © 2019-2023 Colder Leo | MIT License
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式
×