Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set text limit in an Edit Control

Status
Not open for further replies.

BillHart

Programmer
Jul 1, 2005
1
US
I want to limit the text in an Edit Control but don't see how I would obtain the handle of that edit control (see hWndControl in the code below), so as to be able to use SendMessage.
I do see the edit control with an ID of IDC_EDIT1 in the properties pane. Am using Visual C++ out of Visual Studio.Net.


HWND hWndControl;
int lResult;
lResult =SendMessage( hWndControl, EM_SETLIMITTEXT, 2,0);
 
BillHart,

If you are using MFC you can set the maximum number of characters in an edit control at design time in classwizard for the membervariables tab.

cdraycott
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top