Hello !
The following code does not work in VFP6 and Win98
After SetWindowText function call the _screen.Caption does not change
Any suggestions please.

Kuido



PROCEDURE sedt
LOCAL hwnd, pol,t1,t2
DECLARE INTEGER GetActiveWindow IN Win32API
DECLARE INTEGER GetWindowText IN Win32API INTEGER hwnd, STRING
@lpString, INTEGER cch
DECLARE INTEGER SetWindowText IN Win32API INTEGER hWnd, STRING lpString
DECLARE INTEGER GetLastError IN Win32API

hwnd = GetActiveWindow()
t1=SPACE(40)
t2=LEN(t1)
t2=GetWindowText(hwnd,@t1,t2)
? "Window Text:", LEFT(t1,t2)
? _screen.Caption
pol="Uus tekst"
t2=SetWindowText(hwnd,pol)
IF t2 > 0
t1=SPACE(40)
t2=LEN(t1)
t2=GetWindowText(hwnd,@t1,t2)
? "Window Text after: ", LEFT(t1,t2)
? _screen.Caption
ELSE
? "ERROR", GetLastError()
ENDIF
RETURN

Re: _SCREEN.Caption and API SetWindowText by Josh

Josh
Mon Sep 13 08:13:01 CDT 2004

Why not just isue:
_screen.caption = "Uus Tekst"

On Mon, 13 Sep 2004 12:50:30 +0300, Kuido Külm <kuido@ids.ee> wrote:

>Hello !
>The following code does not work in VFP6 and Win98
>After SetWindowText function call the _screen.Caption does not change
>Any suggestions please.
>
>Kuido
>
>
>
>PROCEDURE sedt
>LOCAL hwnd, pol,t1,t2
>DECLARE INTEGER GetActiveWindow IN Win32API
>DECLARE INTEGER GetWindowText IN Win32API INTEGER hwnd, STRING
>@lpString, INTEGER cch
>DECLARE INTEGER SetWindowText IN Win32API INTEGER hWnd, STRING lpString
>DECLARE INTEGER GetLastError IN Win32API
>
>hwnd = GetActiveWindow()
>t1=SPACE(40)
>t2=LEN(t1)
>t2=GetWindowText(hwnd,@t1,t2)
>? "Window Text:", LEFT(t1,t2)
>? _screen.Caption
>pol="Uus tekst"
>t2=SetWindowText(hwnd,pol)
>IF t2 > 0
> t1=SPACE(40)
> t2=LEN(t1)
> t2=GetWindowText(hwnd,@t1,t2)
> ? "Window Text after: ", LEFT(t1,t2)
> ? _screen.Caption
>ELSE
> ? "ERROR", GetLastError()
>ENDIF
>RETURN


---
Remove x's to send.