| |

VerySource

 Forgot password?
 Register
Search
View: 840|Reply: 4

How to read the characters from a Static control and write it to another static control

[Copy link]

2

Threads

5

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-2-10 14:00:01
| Show all posts |Read mode
For example, I have a Chinese character in a Static control.
How do I read it out and write it into another blank Static control?
There is also a function to clear a static control with a character?
Reply

Use magic Report

0

Threads

20

Posts

21.00

Credits

Newbie

Rank: 1

Credits
21.00

 China

Post time: 2020-4-4 23:15:02
| Show all posts
First, you must change the ID of the Static control. You cannot use the default ID.
CString str;
GetDlgItem (IDC_STATIC1)-> GetWindowText (str);
GetDlgItem (IDC_STATIC1)-> SetWindowText ("");
GetDlgItem (IDC_STATIC2)-> SetWindowText (str);
UpdateData (FALSE);
This will satisfy all your requirements
Reply

Use magic Report

0

Threads

10

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 Invalid IP Address

Post time: 2020-4-5 02:45:01
| Show all posts
CString str;
GetDlgItem (IDC_STATICN)-> GetWindowText (str); // Get
GetDlgItem (IDC_STATICN1)-> SetWindowText (str); // Set
GetDlgItem (IDC_STATICN1)-> SetWindowText (_T ("")); // Empty
Reply

Use magic Report

0

Threads

59

Posts

43.00

Credits

Newbie

Rank: 1

Credits
43.00

 China

Post time: 2020-4-5 06:45:01
| Show all posts
First, you must change the id of this static control, you can not use the default (IDC_STATIC), and then use GetWidnowText or GetDlgItemText to get the text
Reply

Use magic Report

2

Threads

5

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

 Author| Post time: 2020-4-7 18:15:01
| Show all posts
Thank you upstairs
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list