Hello, Win32ASM Community messageboard !
It's my first message here.

If you'll run attached EditControl.exe, you'll see in Edit: "Text #2".

WinSight, TheCustomiser, WinSpy++, Winspect, WinSteal, Count Characters
and many other programs will read also: "Text #2".

But few programs - Spy++, Spy (by Kobi), CopyText (by VSAP),
Window Scanner (InqSoft), Apirator (my draft) - will read: "Text #1" !

Can somebody explain this effect ?

Posted on 2003-09-03 18:29:40 by kero
You can test any editbox with help of InqSoft Window Scanner,
that read and write both types of texts above.

http://s0m.narod.ru/iws_inst.zip (from Home page),

Posted on 2003-09-04 01:05:55 by kero
run attached EditControl.exe
EditControl.exe crushed under w2ksp4 because DlgProg must have four parameters and ret 10h instead of two and ret 08h
Posted on 2003-09-04 01:19:39 by P2M
Oh, of course!
Last moment before my first post i "reduced" asm-file... eclipse.
I'm under kindly Win98 :) Thanx, P2M.

Attach - replaced.

Posted on 2003-09-04 04:13:39 by kero
Can somebody explain this effect ?

it seems to be that setting edit's control caption and setting it's text are 2 different things:confused:
Posted on 2003-09-04 16:10:59 by NEMO
Can somebody explain this effect ?
MS Spy++ (ver. 6.00.8168) use GetWindowText and show 'Text #1'.
MS Spy++ (ver. 7.00.8168) use WM_GETTEXT and show 'Text #2'.

Attached code is demo both methods.

PS from msdn GetWindowText Function (Windows User Interface)
This function cannot retrieve the text of an edit control in another application ... If the target window is owned by another process and has a caption, GetWindowText retrieves the window caption text ... To retrieve the text of a control in another process, send a WM_GETTEXT message directly instead of calling GetWindowText.
Posted on 2003-09-04 22:43:07 by P2M
GetWindowText retrives its classname
WM_GETTEXT retrives its content
Posted on 2003-09-04 23:10:29 by roticv
"MS Spy++ (ver. 6.00.8168) use GetWindowText and show 'Text #1'.
MS Spy++ (ver. 7.00.8168) use WM_GETTEXT and show 'Text #2'."

Very interesting (i use Spy++ v.6). Did MS comment this change ?

BTW, before starting this thread i was on MSDN and re-red about GetWindowText
and other Text API. But i didn't find passable answer for me.

"This function cannot retrieve the text of an edit control in another application..."

Cannot retrieve Text #2, but what about Text #1 of SAME edit control ?

P.S. At last today i found needful info in
"Programming Applications for Microsoft Windows" by Jeffrey Richter.

It seems to be, Nemo, that we have Editbox as "2-channel control".

Because standard Editbox is old control from Win16, where controls worked
in one address space, and present MS Windows looks after old programs
and makes all needful work. So Editbox in Win32 has 2 buffers:
one - "official", and one - "unofficial", inherited.

And if i have introduced this conception wrong let guru correct me.

Posted on 2003-09-05 13:30:22 by kero
This example presents usual Edit Box as top-level window, which can have different TitleBar's and TaskBar's texts.

Set TitleBar's text:
check both checkboxes,
type text in higher control (Edit, child of Edit :-) ),
and press button "SendMessage (WM_SETTEXT)" or button "SetWindowText".

Set TaskBar's text:
uncheck checkbox "EditProc/DefWindowProc (WM_SETTEXT)",
type text in same child Edit,
and press any of same buttons.

Also trigger:
right-click on any of same buttons changes its function from "Set" to "Get" and vice versa.

Also simple window finder:
set focus on "SendMessage (WM_S/GETTEXT)" or "S/GetWindowText" button,
place cursor over target window,
and press SPACE or ENTER key
(+ pressed CTRL key => GA_ROOT ancestor).

Note: for XP-style - press button "STAP_ALLOW_NONCLIENT on/off".

It is easy to make similar examples for "msctls_statusbar32" and "combobox".
Posted on 2008-06-17 23:08:41 by kero