Directly by the solution is: GetDlgItem (IDC), access to be manipulated and Windows/controls will be assigned to a global CWnd *,
In another window directly to the strong global CWnd * to controls to implement a series of operations,
Post some code below:
CodePudding user response:
//the global variable definition statement area
Extern CListCtrl * list;//here is my direct defined by manipulating control types, can also be defined as the CWnd * first, and then turn strong
//be manipulated _Dlg. H
List=(CListCtrl *) GetDlgItem (IDC_LIST1);
//control _Dlg. H
The list - & gt; InsertItem (0, tk - & gt; Type);
The list - & gt; SetItemText (0, 1, tk - & gt; The size);
The list - & gt; SetItemText (0, 2, tk - & gt; Time);
//code execution through window is fine for test
CodePudding user response:
Before in order to realize the function also asked many people, most of it is suggested that I use the PostMessage from manipulation of the window to be manipulated in sending a message to control the manipulation of the controls in the window, but when I asked why don't want to send a message to achieve, not reason, is probably, send messages, by manipulating the form of the message map function to achieve the control window is safe, I want to ask you a great god, really? If it is, in addition, two methods have what difference?CodePudding user response:
Do not have what distinction, you this kind of practice is the practice of global variables, disadvantages is that if you have a lot of control, may need a lot of global variables, global variables, the more the more difficult it is to read the code, there is another, PostMessage can be implemented within the child thread notification of UI controls, pointer that wouldn't work in the child thread, the child thread UI controls can cause abnormal operation,CodePudding user response:
UI design is expected to operate in one thread, you direct operating across threads are considered unsafe, multi-threaded operating global variables a truth with you, now you across processes to operation is the same, is riskyCodePudding user response:
Message is a kind of low coupling call wayCodePudding user response:
The role of handle is not to let you know I how,CodePudding user response:
Can don't use global variables don't have, Windows forms a GWLP_USERDATA reserved fields allow you to store your data, but few people useCodePudding user response:
The role of the invoice number, or benefits?Yuan on the role of the serial number, or benefits?
Id card number, or benefits?
The role of bank card number, or benefits?
CodePudding user response: