In xp at the end of execution of this program I see word in foreground
In Windows 7 I have to click to bring it in foreground.
Any ideas
King regards
Marco
#include "fivewin.ch"
function Main()
LOCAL oWord, oText
oWord := CreateObject( "Word.Application" )
oWord:Documents:Add()
oText := oWord:Selection()
oText:Font:Size := 16
oText:Invoke( "TypeText", "Test 1" + CRLF + CRLF )
oText:Font:Size := 8
oText:Invoke( "TypeText", "Test 2" + CRLF+ CRLF )
oText:Font:Size := 12
oText:Invoke( "TypeText", "Test 3" + CRLF+ CRLF )
oWord:Visible := .T.
oWord:WindowState := 1 // Maximize
return nil
Word and Windows 7
- MarcoBoschi
- Posts: 1072
- Joined: Thu Nov 17, 2005 11:08 am
- Location: Padova - Italy
- Contact:
- MarcoBoschi
- Posts: 1072
- Joined: Thu Nov 17, 2005 11:08 am
- Location: Padova - Italy
- Contact:
Re: Word and Windows 7
Please try this
Many thanks
#include "fivewin.ch"
function Main()
LOCAL oDlg, oButton
DEFINE DIALOG oDLg FROM 10 , 10 TO 800 , 800 PIXEL
@ 1 , 1 BUTTON oButton OF oDlg ACTION CREATEWORD()
ACTIVATE DIALOG oDlg CENTER
RETURN NIL
FUNCTION CREATEWORD()
LOCAL oWord , oText
oWord := CreateObject( "Word.Application" )
oWord:Documents:Add()
oText := oWord:Selection()
oText:Font:Size := 16
oText:Invoke( "TypeText", "Test 1" + CRLF + CRLF )
oText:Font:Size := 8
oText:Invoke( "TypeText", "Test 2" + CRLF+ CRLF )
oText:Font:Size := 12
oText:Invoke( "TypeText", "Test 3" + CRLF+ CRLF )
oWord:Visible := .T.
oWord:WindowState := 1 // Maximize
return nil
Many thanks
#include "fivewin.ch"
function Main()
LOCAL oDlg, oButton
DEFINE DIALOG oDLg FROM 10 , 10 TO 800 , 800 PIXEL
@ 1 , 1 BUTTON oButton OF oDlg ACTION CREATEWORD()
ACTIVATE DIALOG oDlg CENTER
RETURN NIL
FUNCTION CREATEWORD()
LOCAL oWord , oText
oWord := CreateObject( "Word.Application" )
oWord:Documents:Add()
oText := oWord:Selection()
oText:Font:Size := 16
oText:Invoke( "TypeText", "Test 1" + CRLF + CRLF )
oText:Font:Size := 8
oText:Invoke( "TypeText", "Test 2" + CRLF+ CRLF )
oText:Font:Size := 12
oText:Invoke( "TypeText", "Test 3" + CRLF+ CRLF )
oWord:Visible := .T.
oWord:WindowState := 1 // Maximize
return nil
Marco Boschi
info@marcoboschi.it
info@marcoboschi.it
Re: Word and Windows 7
You can try with this source
Best regards,
Massimo
Best regards,
Massimo

Code: Select all | Expand
#include "fivewin.ch"
function Main()
LOCAL oDlg, oButton
DEFINE DIALOG oDLg FROM 10 , 10 TO 800 , 800 PIXEL
@ 1 , 1 BUTTON oButton OF oDlg ACTION CREATEWORD()
ACTIVATE DIALOG oDlg CENTER
RETURN NIL
FUNCTION CREATEWORD()
LOCAL oWord , oText , hWnd
oWord := CreateObject( "Word.Application" )
oWord:Documents:Add()
oText := oWord:Selection()
oText:Font:Size := 16
oText:Invoke( "TypeText", "Test 1" + CRLF + CRLF )
oText:Font:Size := 8
oText:Invoke( "TypeText", "Test 2" + CRLF+ CRLF )
oText:Font:Size := 12
oText:Invoke( "TypeText", "Test 3" + CRLF+ CRLF )
oWord:Visible := .T.
oWord:WindowState := 1 // Maximize
hWnd := FindWindow( "opusApp" )
IF hWnd > 0
SetWindowPos( hWnd, -2, 0, 0, 0, 0, 3 )
ENDIF
return nil
- Jeff Barnes
- Posts: 933
- Joined: Sun Oct 09, 2005 1:05 pm
- Location: Ontario, Canada
- Contact:
Re: Word and Windows 7
Hi Marco,
This is per the Microsoft Knowledge Base article #886217:
To resolve this issue, modify the value of the ForegroundLockTimeout registry entry in Registry Editor. To do this, follow these steps:
1 Click the Start Orb, click Run, type regedit in the Open box, and then click OK.
2 In Registry Editor, locate and then click the following registry subkey:
HKEY_CURRENT_USER\Control Panel\Desktop
3 In the right pane, locate and then double-click ForegroundLockTimeout.
4 Under Base, click Decimal, type 0 in the Value data box, and then click OK. Note The default decimal value for the ForegroundLockTimeout registry entry is set as 200000.
5 Quit Registry Editor.
6 Restart your computer.
*This must be done for each User Account on the system.
This is per the Microsoft Knowledge Base article #886217:
To resolve this issue, modify the value of the ForegroundLockTimeout registry entry in Registry Editor. To do this, follow these steps:
1 Click the Start Orb, click Run, type regedit in the Open box, and then click OK.
2 In Registry Editor, locate and then click the following registry subkey:
HKEY_CURRENT_USER\Control Panel\Desktop
3 In the right pane, locate and then double-click ForegroundLockTimeout.
4 Under Base, click Decimal, type 0 in the Value data box, and then click OK. Note The default decimal value for the ForegroundLockTimeout registry entry is set as 200000.
5 Quit Registry Editor.
6 Restart your computer.
*This must be done for each User Account on the system.
Thanks,
Jeff Barnes
(FWH 16.11, xHarbour 1.2.3, Bcc730)
Jeff Barnes
(FWH 16.11, xHarbour 1.2.3, Bcc730)
- MarcoBoschi
- Posts: 1072
- Joined: Thu Nov 17, 2005 11:08 am
- Location: Padova - Italy
- Contact:
Re: Word and Windows 7
Many thanks Massimo
It works
I dont' understand opusapp but it works
thanks again
It works
I dont' understand opusapp but it works
thanks again
Marco Boschi
info@marcoboschi.it
info@marcoboschi.it
- MarcoBoschi
- Posts: 1072
- Joined: Thu Nov 17, 2005 11:08 am
- Location: Padova - Italy
- Contact:
Re: Word and Windows 7
Jeff,
it works!
But is not a good idea to change this value in the customer registry editor.
King regards
marco
it works!
But is not a good idea to change this value in the customer registry editor.
King regards
marco
Marco Boschi
info@marcoboschi.it
info@marcoboschi.it
- MarcoBoschi
- Posts: 1072
- Joined: Thu Nov 17, 2005 11:08 am
- Location: Padova - Italy
- Contact:
Re: Word and Windows 7
I have the same problem with Excel.
Juts created worksheet remains in background
Juts created worksheet remains in background
Marco Boschi
info@marcoboschi.it
info@marcoboschi.it
Re: Word and Windows 7
In EXCEL you can try this source:
Best regards,
Massimo
Code: Select all | Expand
hProp := OleGetProperty( oExcel:hObj, "Hwnd" )
IF hProp <> NIL
SetWindowPos( oExcel:Hwnd, -2, 0, 0, 0, 0, 3 )
ENDIF
Best regards,
Massimo

Re: Word and Windows 7
We have 20+ computers updated to Windows 7 so far and I have not had this problem.
I use the following lines:
::oExcel:Visualizar(.t.)
sysrefresh()
::oExcel := nil
I use the following lines:
::oExcel:Visualizar(.t.)
sysrefresh()
::oExcel := nil