- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
In my QuickWin-Application, I wanted to limit the possible Input-character-number of an Edit-Box. Therefore I used:
iret= DlgSendCtrlMessage(Dlg,IDC_EDIT,EM_LIMITTEXT,16,0)
But it didn't work, I could input many more characters than 16.
I also tried the Original API-calls
iret= SendDlgItemMessage(Dlg&hwnd,IDC_EDIT,EM_LIMITTEXT,16,0)
and
iret= SendMessage(hwndEditbox,EM_LIMITTEXT,16,0)
but they didn't work either.
Where is the mistake?
Thank you for your help.
Burkhard
iret= DlgSendCtrlMessage(Dlg,IDC_EDIT,EM_LIMITTEXT,16,0)
But it didn't work, I could input many more characters than 16.
I also tried the Original API-calls
iret= SendDlgItemMessage(Dlg&hwnd,IDC_EDIT,EM_LIMITTEXT,16,0)
and
iret= SendMessage(hwndEditbox,EM_LIMITTEXT,16,0)
but they didn't work either.
Where is the mistake?
Thank you for your help.
Burkhard
Lien copié
2 Réponses
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
IIRC in CVF 6.1 and later there's flag DLG_LIMITTEXT for DlgSet (not sure about exact name -- see docs).
In any version, though, SendMessage or its variations will not work from the same routine from which you call DlgInit; dialog is actually created on DlgModal and Dlg%hWnd is invalid before that. To overcome this, you have to use callback for dialog init:
Jugoslav
In any version, though, SendMessage or its variations will not work from the same routine from which you call DlgInit; dialog is actually created on DlgModal and Dlg%hWnd is invalid before that. To overcome this, you have to use callback for dialog init:
iSt = DlgSetSub(Dlg, IDD_MYDIALOG, OnDialogInit)which is called immediately before dialog is displayed (i.e. on DlgModal) and do any initial SendMessages from OnDialogInit.
Jugoslav
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Many Thanks to you Yugoslav!
Your solution with "iSt = DlgSetSub(Dlg, IDD_MYDIALOG, OnDialogInit)" works.
The other type of solution with correct spelling
"DlgSet(Dlg,IDC_EDIT,16,DLG_TEXTLENGTH)"
does something else: The edit Box is filled with 16 Blanks, but the user is not limited to maximum input of 16 Characters.
Thanks again!! Burkhard
Your solution with "iSt = DlgSetSub(Dlg, IDD_MYDIALOG, OnDialogInit)" works.
The other type of solution with correct spelling
"DlgSet(Dlg,IDC_EDIT,16,DLG_TEXTLENGTH)"
does something else: The edit Box is filled with 16 Blanks, but the user is not limited to maximum input of 16 Characters.
Thanks again!! Burkhard

Répondre
Options du sujet
- S'abonner au fil RSS
- Marquer le sujet comme nouveau
- Marquer le sujet comme lu
- Placer ce Sujet en tête de liste pour l'utilisateur actuel
- Marquer
- S'abonner
- Page imprimable