Page 1 of 1
Word and Windows 7
Posted: Wed Jun 08, 2011 3:15 pm
by MarcoBoschi
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
Re: Word and Windows 7
Posted: Thu Jun 09, 2011 8:53 am
by MarcoBoschi
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
Re: Word and Windows 7
Posted: Thu Jun 09, 2011 3:46 pm
by MaxP
You can try with this source
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
Re: Word and Windows 7
Posted: Thu Jun 09, 2011 7:49 pm
by Jeff Barnes
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.
Re: Word and Windows 7
Posted: Fri Jun 10, 2011 7:00 am
by MarcoBoschi
Many thanks Massimo
It works
I dont' understand opusapp but it works
thanks again
Re: Word and Windows 7
Posted: Fri Jun 10, 2011 7:09 am
by MarcoBoschi
Jeff,
it works!
But is not a good idea to change this value in the customer registry editor.
King regards
marco
Re: Word and Windows 7
Posted: Fri Jul 01, 2011 12:38 pm
by MarcoBoschi
I have the same problem with Excel.
Juts created worksheet remains in background
Re: Word and Windows 7
Posted: Fri Jul 01, 2011 4:01 pm
by MaxP
In EXCEL you can try this source:
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
Posted: Fri Jul 01, 2011 4:45 pm
by Gale FORd
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