Help Please

Started by
4 comments, last by Indy 23 years, 3 months ago
Hi, Could someone tell me how to enter text in a EditBox in VC++? The boxes have been created by using the following command in the .rc file. EDITTEXT ...... I know that TextOut is the command for normal text output, but I want to display the text in the predefined boxes, not the parent dialog box. Unfortunately I do not have a copy of the MSDN to look-up the related commands. Any help will be appreciated. Thankyou
Indy
Advertisement
I think this is the one

SetWindowText
The SetWindowText function changes the text of the specified window''s title bar (if it has one). If the specified window is a control, the text of the control is changed. However, SetWindowText cannot change the text of a control in another application.

BOOL SetWindowText(
HWND hWnd, // handle to window or control
LPCTSTR lpString // address of string
);

Parameters
hWnd
Handle to the window or control whose text is to be changed.
lpString
Pointer to a null-terminated string to be used as the new title or control text.
Return Values
If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, callGetLastError.

I think I may not have made my problem clear. Basically what I want to do is print inside a EDITBOX that is visible but disabled(greyed out).

The dialog box is designed to take 3 numbers as inputs and display the answer(s) in 4 separate editboxes.

There must some sort of function/command that takes the editbox id and the text string and displays it.

Indy
Indy
Then you''ll probably want

GetDlgItem
The GetDlgItem function retrieves the handle of a control in the specified dialog box.

HWND GetDlgItem(
HWND hDlg, // handle of dialog box
int nIDDlgItem // identifier of control
);

Parameters
hDlg
Identifies the dialog box that contains the control.
nIDDlgItem
Specifies the identifier of the control to be retrieved.
Return Values
If the function succeeds, the return value is the window handle of the given control.

If the function fails, the return value is NULL, indicating an invalid dialog box handle or a nonexistent control. To get extended error information, callGetLastError.


as well
Wrong, wrong and wrong! If you''re trying to do what I think you''re trying to do you need SetDlgItemText():

SetDlgItemText
The SetDlgItemText function sets the title or text of a control in a dialog box.

BOOL SetDlgItemText(
HWND hDlg, // handle of dialog box
int nIDDlgItem, // identifier of control
LPCTSTR lpString // text to set
);

Parameters
hDlg
Identifies the dialog box that contains the control.
nIDDlgItem
Identifies the control with a title or text that is to be set.
lpString
Pointer to the null-terminated string that contains the text to be copied to the control.
http://www.winprog.org/tutorial
http://msdn.microsoft.com/library

This topic is closed to new replies.

Advertisement