I have two application of uses fwh.
First one is testfont.prg that is changed a little bit in fwh sample directory.
- Code: Select all Expand view RUN
- // Testing fonts
#include "FiveWin.ch"
//----------------------------------------------------------------------------//
function Main()
local oWnd, fntArial, oSay
DEFINE WINDOW oWnd FROM 1, 1 TO 20, 80 ;
TITLE "Testing Fonts"
DEFINE FONT fntArial NAME "Arial" SIZE 0, -25
@ 2, 2 SAY oSay PROMPT "Hello world" FONT fntArial SIZE 180, 80
oWnd:cargo:=oSay
ACTIVATE WINDOW oWnd
fntArial:End()
return nil
//----------------------------------------------------------------------------//
Second is
- Code: Select all Expand view RUN
- #include "FiveWin.ch"
// run testfont.prg before this
PROCEDURE Main()
local oFont, oWnd, oBtn
DEFINE FONT oFont NAME "Arial" SIZE 0, -25
DEFINE WINDOW oWnd FROM 30, 10 TO 40, 80 ;
TITLE "My Test Windows"
@ 1,3 BUTTON oBtn PROMPT "Change Hello World to HeyHeyHey" size 500,50 font oFont OF oWnd ACTION MyAction(oWnd)
oWnd:cargo := oBtn
ACTIVATE WINDOW oWnd
RETURN
FUNCTION MyAction(oWnd)
LOCAL cTestApp := "Testing Fonts", hWnd, hWnd_W, oWnd1
//MsgInfo("Button pressed")
hWnd := FindWindow( 0, cTestApp)
IF !EMPTY(hWnd)
? "FOUND", hWnd, cTestApp
BringWindowToTop( hWnd )
hWnd_W := GetWindow(hWnd,0)
? hWnd, hWnd_W, "hWnd, hWnd from GetWindow()"
oWnd1 := oWndFromhWnd(hWnd)
xbrowser oWnd1
? oWnd1, oWnd1 == nil
IF oWnd1 != nil
oWnd1:SetFocus()
oWnd1:ocargo:SetText("HeyHeyHey")
ENDIF
ELSE
MsgAlert("Run testfont app before pressing button.")
ENDIF
RETURN .T.
These can be builded via buildh32.bat in sample directory.
First run testfont application. then run MyWTest1 application. I want to change say prompt "Hello World" text in testfont to "HeyHeyHey" from pressing in MyTestTest1 application. I can not found the object.
I think oWndfromhWnd() function can only find objects within the same application.
Is there any idea?
Thanks.