简体   繁体   English

更新WINAPI中的文本框项目

[英]updating Text Box Items in WINAPI

I created a textbox with following code. 我创建了一个包含以下代码的文本框。 It is placed under WM_COMMAND of WNDPROC function. 它位于WNDPROC函数的WM_COMMAND下。

htextbox=CreateWindowEx(WS_EX_CLIENTEDGE,TEXT("Edit"), TEXT("test"), WS_CHILD \
                         | WS_VISIBLE | WS_BORDER, 100, 20, 140, 20, hWnd, NULL, NULL, NULL);

I want to update the element "test" written in the textbox when I receive: DT_MSG which is a message I receive from another application and the DT_MSG contains the item I want to write in the textbox. 我想在收到时更新文本框中写入的元素“test”:DT_MSG这是我从另一个应用程序收到的消息,而DT_MSG包含我想在文本框中写入的项目。 suppose the item I get is number say 假设我得到的项目是数字说

int a=dtmsg.somenumber

Do I have to delete the above htextbox window and again create new textbox window with updated value or is there alternative and I can simply update "test" item in the same text box? 我是否必须删除上面的htextbox窗口并再次创建具有更新值的新文本框窗口,或者是否可以替换,我可以在同一文本框中更新"test"项目?

您可以使用Win32 API SetWindowText更改编辑控件的文本

我想你可以这样做:

SetWindowText(htextbox, TEXT("new text"));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM