Error creating GUI edit control with large string

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
Relayer
Posts: 160
Joined: 30 Sep 2013, 13:09
Location: Delaware, USA

Error creating GUI edit control with large string

23 Dec 2016, 15:49

Hi,

This is just an observation and not a request for help...

I use a function that creates a GUI with an edit control for viewing the contents of variables for simple debugging. My function creates the edit control and then populates it by making the last parameter "% text" where 'text' contains the string to display. If 'text' contains a large string, say somewhere above 700K characters, an error is flagged and the script fails. The fix was to create a blank control and then fill it using GuiControl command. I don't know if this is intended to have this limitation or not. I'm using v.1.1.24.02 64 bit.

Relayer
just me
Posts: 9574
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Error creating GUI edit control with large string

23 Dec 2016, 16:31

I'm pretty sure it's not 'intended'. It's caused by the way AHK creates the Edit control. If you pass text whith Gui, Add, Edit, ... the text is passed to the control when it is created. Afterwards AHK sends a EM_TEXTLIMIT/EM_SETLIMITTEXT message.

Code: Select all

			// Now set the limit. Specifying a limit of zero opens the control to its maximum text capacity,
			// which removes the 32K size restriction.
This seems to be a bit too late in case you pass a text larger than the limit.
Before EM_LIMITTEXT is called, the default limit for the amount of text a user can enter in an edit control is 32,767 characters.

EM_LIMITTEXT
User avatar
Relayer
Posts: 160
Joined: 30 Sep 2013, 13:09
Location: Delaware, USA

Re: Error creating GUI edit control with large string

24 Dec 2016, 09:48

Thanks for the explanation!

Relayer

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], Ralf_Reddings200244 and 292 guests