Word and Windows 7

Word and Windows 7

Postby MarcoBoschi » Wed Jun 08, 2011 3:15 pm

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
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: Word and Windows 7

Postby MarcoBoschi » Thu Jun 09, 2011 8:53 am

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
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: Word and Windows 7

Postby MaxP » Thu Jun 09, 2011 3:46 pm

You can try with this source

Best regards,
Massimo :wink:


Code: Select all  Expand view

#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
User avatar
MaxP
 
Posts: 85
Joined: Thu Jul 12, 2007 2:02 pm

Re: Word and Windows 7

Postby Jeff Barnes » Thu Jun 09, 2011 7:49 pm

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.
Thanks,
Jeff Barnes

(FWH 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Re: Word and Windows 7

Postby MarcoBoschi » Fri Jun 10, 2011 7:00 am

Many thanks Massimo
It works
I dont' understand opusapp but it works
thanks again
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: Word and Windows 7

Postby MarcoBoschi » Fri Jun 10, 2011 7:09 am

Jeff,
it works!
But is not a good idea to change this value in the customer registry editor.

King regards

marco
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: Word and Windows 7

Postby MarcoBoschi » Fri Jul 01, 2011 12:38 pm

I have the same problem with Excel.
Juts created worksheet remains in background
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: Word and Windows 7

Postby MaxP » Fri Jul 01, 2011 4:01 pm

In EXCEL you can try this source:
Code: Select all  Expand view

hProp := OleGetProperty( oExcel:hObj, "Hwnd" )
IF hProp <> NIL
    SetWindowPos( oExcel:Hwnd, -2, 0, 0, 0, 0, 3 )
ENDIF

 


Best regards,
Massimo :wink:
User avatar
MaxP
 
Posts: 85
Joined: Thu Jul 12, 2007 2:02 pm

Re: Word and Windows 7

Postby Gale FORd » Fri Jul 01, 2011 4:45 pm

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
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 107 guests