Jump to content
Sign in to follow this  
lyledg

Limit the number of characters in a GUI Input

Recommended Posts

lyledg

How do you limit the amount of characters that can be typed into the GUIcreateinput box? I am wanting to allow only 4 numbers in this function, and have created the GUI Input with the (ES_NUMBER 0x2000), value

Cheers

Share this post


Link to post
Share on other sites
lyledg

create the input... get it's $HWND and

Global $EM_LIMITTEXT = 0xF0C5
DLLCall("user32.dll","long","SendMessage",_
            "hwnd",$HWND,_
            "int",$EM_LIMITTEXT,_
            "int",10_
            "int,0)

EDIT: oh, wait... There is probably a GUISendMsg() equivilent...

GUISendMsg($ctrlID,$EM_LIMITTEXT,10,0)

Lar.

<{POST_SNAPBACK}>

Uh...Larry sorry for the ignorance...But how do I get the Window handle of a GUI input box?

Not sure how to go about this

My code for the two input boxes I want to limit the amount of characters for are as follows:

GLOBAL $TIME1 = GUICtrlCreateInput ("", 65, 500 , 80, 20,0x2000)
GUICtrlSetState(-1,$GUI_DISABLE)
GUICtrlCreateLabel ("To:", 150,500,20,20,)
GLOBAL $TIME2 = GUICtrlCreateInput ("",175,500, 80, 20,0x2000)
GUICtrlSetState(-1,$GUI_DISABLE)

Share this post


Link to post
Share on other sites
lyledg

Thanks Larry, that works great now!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×