Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Indy

Help Please

This topic is 6519 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!