FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Small Question about Word and FWH
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Small Question about Word and FWH
Posted: Mon Jul 17, 2023 05:31 PM

Dear Michel,

If you don't call cWord:Quit() does Word remain opened ?

So you can only call cWord:Quit() if there no more FWH apps using it

is that correct ? thanks

Are you using Borland or MSVC32 ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Small Question about Word and FWH
Posted: Mon Jul 17, 2023 05:48 PM

That is correct.

I use Borland

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Small Question about Word and FWH
Posted: Mon Jul 17, 2023 05:53 PM
Dear Michel,

Please change your function this way:
Code (fw): Select all Collapse
STATIC PROCEDURE WordQuit

    local nFWHApps := 0

    EnumWindows( { | hWnd | If( GetClassName( hWnd ) == "TWINDOW", nFWHApps++, ) } )

   if nFWHApps == 1
      cWord:Quit()
   endif

RETURN
I am emailing you a modified fivehc.lib

many thanks for your feedback
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Small Question about Word and FWH
Posted: Mon Jul 17, 2023 08:21 PM

Antonio,

If I understand well, this function is checking if another FWH-application is active.

This function is doing its job fantasticly.

But would it be difficult to create a same function for other applications or files (Word- or Excel-documents)?

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Small Question about Word and FWH
Posted: Mon Jul 17, 2023 08:32 PM

Dear Michel,

> would it be difficult to create a same function for other applications or files (Word- or Excel-documents)?

You simply apply the same logic:

if there is only one FWH app running then you can quit it, if not, you don't

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Small Question about Word and FWH
Posted: Mon Jul 17, 2023 08:53 PM

Antonio,

But what if Word is started manually?

The document in that session can't be closed either.

How to prevent that?

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Small Question about Word and FWH
Posted: Tue Jul 18, 2023 05:55 AM
Dear Michel,

Please use this code:
Code (fw): Select all Collapse
STATIC PROCEDURE WordQuit

    local nFWHApps := 0

    EnumWindows( { | hWnd | If( GetClassName( hWnd ) $ "TWINDOW,OpusApp", nFWHApps++, ) } )

   if nFWHApps == 1
      cWord:Quit()
   endif

RETURN
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Small Question about Word and FWH
Posted: Tue Jul 18, 2023 06:06 AM

Thanks a lot, Antonio.

I am away for the day and I will test it tonight.

Have a nice day.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Small Question about Word and FWH
Posted: Tue Jul 18, 2023 09:23 PM

Hello Antonio,

I did some testing.

The function returns 4 if a Word session is opened.

If a second Word session is opened, the function returns 6.

If no Word session is active, the function returns 3.

Weard, isn't it?

Any suggestion?

Thanks.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Small Question about Word and FWH
Posted: Wed Jul 19, 2023 06:22 AM
Dear Michel,

Please try it this way:
Code (fw): Select all Collapse
STATIC PROCEDURE WordQuit

    local nFWHApps := 0

    EnumWindows( { | hWnd | If( GetClassName( hWnd ) $ "TWINDOW,OpusApp", nFWHApps++, ) } )

   if nFWHApps == 4
      cWord:Quit()
   endif

RETURN
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Small Question about Word and FWH
Posted: Wed Jul 19, 2023 11:25 AM
Hello Antonio,

Thanks to all your efforts, I have made a combination of testing other FWH-applications and other Word-sessions.

This the code which seem to work (I need to do more tests):
Code (fw): Select all Collapse
STATIC PROCEDURE WordQuit

   LOCAL nFWHApps1 := 0
   LOCAL nFWHApps2 := 0

   EnumWindows( { | hWnd | If( GetClassName( hWnd ) == "TWINDOW"       , nFWHApps1++, ) } )
   EnumWindows( { | hWnd | If( GetClassName( hWnd ) $ "TWINDOW,OpusApp", nFWHApps2++, ) } )

   IF nFWHApps1 < 2 .AND. nFWHApps2 < 3
      cWord:Quit()
   ENDIF

RETURN
I do some more tests and I will let you know.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Small Question about Word and FWH
Posted: Wed Jul 19, 2023 01:09 PM
very good :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Small Question about Word and FWH
Posted: Wed Jul 19, 2023 02:14 PM

Antonio,

I can't use xHarbour Builder. EnumWinows() is unresolved, the message says.

What do i need to do to solve this problem?

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Small Question about Word and FWH
Posted: Wed Jul 19, 2023 04:52 PM

Dear Michel,

Already sent to your email

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Small Question about Word and FWH
Posted: Wed Jul 19, 2023 10:10 PM

Thanks a lot, Antonio.

This function is now also accepted in xHarbour Builder.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Continue the discussion