Tuesday, June 29, 2010

Set character limit on Text Box

Hi friends,
This post will help you set characters limit on your text box control on your custom dialogs as well as inbuilt dialogs. Often we need to set limit on such type of controls like in case of password controls. Please use the code below and modify according to you if needed.

hEditName = CtrlGetDlgItem("", hDlg, SD_EDIT_NAME);
where,
hEditName -- Handler to the text box control.
hDlg -- handler to the dialog
SD_EDIT_NAME -- name of the text control here. You can change this parameter by the name of your control.

if (nLen < 255) then
nLen = 255;
endif;
SendMessage(hEditName, EM_LIMITTEXT, nLen-1, 0);

1 comment:

  1. Hi ,is this fucntion exists CtrlGetDlgItem ,Please let me know how to access edit control of default dialogs of installshield

    ReplyDelete