FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Open WORD and put it on top
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Open WORD and put it on top
Posted: Sun Feb 27, 2011 01: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 (fw): Select all Collapse
#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
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: Open WORD and put it on top
Posted: Sun Feb 27, 2011 02:32 PM
Hello Marc

try this way

Code (fw): Select all Collapse
   hWnd := FindWindow( "opusapp", 0 )
   if hWnd != nil
      BringWindowToTop( hWnd )
   endif
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: Open WORD and put it on top
Posted: Sun Feb 27, 2011 02:40 PM

Thanks Daniel,

That is working fine!!

Regards,
Marc

Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite

Continue the discussion