Open WORD and put it on top

Open WORD and put it on top

Postby Marc Vanzegbroeck » Sun Feb 27, 2011 1:47 pm

Hello,

In my application I wnt open open a Word-file and put it on to the screen, so the client can directly input his text into word.
Opening Word is not a problem, but place in on top doesn't work.

Here is a extraction of my code, so you can test is. You have to create a test.doc file in c:\test.
After the window is open, you have to click the window and the word-file will open but..., it is minimized...
Does anyone know the solution to maximize Word

Code: Select all  Expand view
#INCLUDE "FiveWin.ch"
func test()
   local oWnd
   DEFINE WINDOW oWnd TITLE 'Click on the window to open word'
   ACTIVATE WINDOW oWnd MAXIMIZED ON CLICK openword()
return

func openword()
   local oword,oDoc,hWnd
   local cFile := 'c:\temp\test.doc'
   oWord := TOleAuto():New("Word.Application")
   oDoc := oWord:Documents:Open(cFile)
   oWord:Visible := .T.
   oWord:WindowState := 1

   hWnd := FindWindow(0,'test.doc')
   if hWnd != nil
     BringWindowToTop( hWnd )
   endif
return
 


Thanks,
Marc
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: Open WORD and put it on top

Postby Daniel Garcia-Gil » Sun Feb 27, 2011 2:32 pm

Hello Marc

try this way

Code: Select all  Expand view
  hWnd := FindWindow( "opusapp", 0 )
   if hWnd != nil
      BringWindowToTop( hWnd )
   endif
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: Open WORD and put it on top

Postby Marc Vanzegbroeck » Sun Feb 27, 2011 2:40 pm

Thanks Daniel,

That is working fine!!

Regards,
Marc
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 93 guests