Opened 11 years ago

Closed 11 years ago

#2362 closed Bug (Fixed)

ControlGetText, WinGetTitle sometimes reads ANSI as Wide

Reported by: Ascend4nt@… Owned by: Jon
Milestone: Component: AutoIt
Version: Severity: None
Keywords: Cc:


Sometimes ControlGetText or WinGetTitle will return characters that display as a mess of '?'s (in Console output). This is because of an issue with SendMessage with WM_GETTEXT. Windows will sometimes return ANSI strings, and return the # of bytes rather than characters. AutoIt internally assumes this is Unicode and treats it as such - so it displays incorrectly.

To overcome this problem, zero out a buffer, fill it with WM_GETTEXT, then do a simple wcslen() on the return to compare it to the length that WM_GETTEXT returns. It should be roughly half the size if it is an ANSI string (you need to take into account odd # returns here).

I wrote script code that works around this problem, see:

Attachments (0)

Change History (1)

comment:1 Changed 11 years ago by Jon

  • Milestone set to
  • Owner set to Jon
  • Resolution set to Fixed
  • Status changed from new to closed

Fixed by revision [8072] in version:

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

as closed The owner will remain Jon.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.