Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
word = createobject('word.application')
word.visible = .t.
* Example use:
oWrd = createobject('word.application')
oWrd.height = _screen.height/2
oWrd.width = _screen.width/2
oWrd.top = _screen.height/8
oWrd.left = _screen.width/8
res = takewindow(oWrd.caption)
oWrd.visible = .t.
* Or:
SET HELP TO MyHelp.chm
HELP My Help Topic
res=TakeWindow( "My Help File's Window Title" )
* Author.....: William GC Steinford
* Date.......: Nov 6, 2002
* Abstract...: Place Any window inside any VFP window (main VFP window or DEFINE'd Window)
PROCEDURE TakeWindow
LPARAMETERS pcWindowTitle, pcParentWindow
LOCAL lnWHND, lnVFP, lnRes, lnCNT, lnWinCnt
DECLARE INTEGER FindWindow in win32api as apiFindWindow ;
INTEGER nClass, STRING cName
DECLARE INTEGER FindWindowEx in win32api as apiFindWindowEx ;
INTEGER nParent, INTEGER nChildAfter, ;
INTEGER nClass, STRING cName
* First get the VFP window handle
lnVFP = apiFindWindow( 0, _Screen.Caption )
if lnVFP<=0
RETURN -1
ENDIF
lnWinCnt = lnVFP
lnWHND = apiFindWindow( 0, pcWindowTitle )
* Not outside of VFP... if we have a parent window, check inside VFP
if lnWHND<=0 and vartype(pcParentWindow)='C' and not empty(pcParentWindow)
lnWHND=apiFindWindowEx( lnVFP, 0, 0, pcWindowTitle ) && Look in VFP window
if lnWHND=0 && Not in Main VFP window... This is the case if this window
&& was created by VFP
&& Container windows in VFP have no title
lnCNT = apiFindWindowEx( lnVFP, 0, 0, ' ) && Find in container window
do while lnWHND=0 and lnCNT<>0
lnWHND = apiFindWindowEx( lnCNT, 0, 0, pcWindowTitle ) && Look in container
lnCNT = apiFindWindowEx( lnVFP, lnCNT, 0, ' ) && Find next container window
enddo
endif
endif
if lnWHND<0
RETURN -1
endif
* Find the Parent Window
if vartype(pcParentWindow)='C' and not empty(pcParentWindow)
lnWinCNT=apiFindWindowEx( lnVFP, 0, 0, pcParentWindow ) && Look in container
if lnWinCnt=0 && Not in Main VFP window... This is the case if this window
&& was created by VFP
&& Container windows in VFP have no title
lnCNT = apiFindWindowEx( lnVFP, 0, 0, ' ) && Find in container window
do while lnWinCnt=0 and lnCNT<>0
lnWinCnt = apiFindWindowEx( lnCNT, 0, 0, pcParentWindow ) && Look in container
lnCNT = apiFindWindowEx( lnVFP, lnCNT, 0, ' ) && Find next container window
enddo
if lnWinCNT<=0
RETURN -1 && Couldnt find new parent window
endif
endif
else
if vartype(pcParentWindow)='N'
if pcParentWindow>=0
* Use provide WHND
lcWinCnt = pcParentWindow
else
* <0, indicates make child of main VFP window
* do Nothing (leave lcWinCnt=0)
endif
else
DEFINE WINDOW TakeWindowXoXoX TITLE "TakeWindowXoXoX" AT 0,0 Size 1,1
SHOW WINDOW TakeWindowXoXoX
* Find the empty-caption window inside VFP that contains "TakeWindowXoXoX"
lnWinCNT =0
lnCNT = apiFindWindowEx( lnVFP, 0, 0, ' ) && Find first container window
DO WHILE lnCnt<>0 and lnWinCnt=0
lnWinCNT = apiFindWindowEx( lnCNT, 0, 0, 'TakeWindowXoXoX' ) && Find Marker Window
if lnWinCnt=0
lnCNT = apiFindWindowEx( lnVFP, lnCNT, 0, ' ) && Find next container window
endif
ENDDO
if lnWinCnt<>0
lnWinCnt = lnCnt
endif
RELEASE WINDOW TakeWindowXoXoX
endif
endif
DECLARE INTEGER SetParent in Win32API as apiSetParent ;
INTEGER hWndChild, INTEGER hWndNewParent
if lnWinCnt<>0 && Use proper container window
lnRes = apiSetParent( lnWHND, lnWinCnt )
else
lnRes = apiSetParent( lnWHND, lnVFP )
endif
RETURN lnRes
* Author.....: William GC Steinford
* Date.......: Nov 6, 2002
* Abstract...: Make any VFP child/grandchild window
* instead a child of the desktop (Top level)
PROCEDURE FreeWindow
LPARAMETERS pcWindowTitle
LOCAL lnWHND, lnVFP, lnRes, lnCNT
DECLARE INTEGER FindWindow in win32api as apiFindWindow ;
INTEGER nClass, STRING cName
lnVFP = apiFindWindow( 0, _Screen.Caption )
if lnVFP<0
RETURN -1
ENDIF
DECLARE INTEGER FindWindowEx in win32api as apiFindWindowEx ;
INTEGER nParent, INTEGER nChildAfter, ;
INTEGER nClass, STRING cName
lnWHND = apiFindWindowEx( lnVFP, 0, 0, pcWindowTitle ) && Look in container
if lnWHND=0 && Not in Main VFP window... This is the case if this window
&& was created by VFP
lnCNT = 0 && Container windows in VFP have no title
lnCNT = apiFindWindowEx( lnVFP, 0, 0, ' ) && Find in container window
do while lnWHND=0 and lnCNT<>0
lnWHND = apiFindWindowEx( lnCNT, 0, 0, pcWindowTitle ) && Look in container
lnCNT = apiFindWindowEx( lnVFP, lnCNT, 0, ' ) && Find next container window
enddo
if lnWHND<0
RETURN -1
endif
endif
DECLARE INTEGER SetParent in Win32API as apiSetParent ;
INTEGER hWndChild, INTEGER hWndNewParent
lnRes = apiSetParent( lnWHND, 0 )
RETURN lnRes