Now I will explain you the following code:
TCHAR is just a type that can either handle Ansi strings or - if you want to use Unicode - unicode strings. If you define a _UNICODE macro before you include the windows header you will use unicode strings.Code:TCHAR szStr[100] = ""; GetDlgItemText(hDlg, IDC_BUTTON, szStr, 100); SetDlgItemText(hDlg, IDC_EDITBOX, szStr);
The first function 'GetDlgItemText' retrieves the text of a specified control. The control is recognized by the HWND-handle of the parent (hDlg) and it's ID. szStr will now contain the string of how you labeld your button.
SetDlgItemText is the opposite of GetDlgItemText it lets you set the text of a specified control. The control is also recognized - as mentioned above - by the HWND handle of the parent and the controls ID.
You can set IDs in the resource editor. And you need to include the automatically created header file "resource.h".




Reply With Quote