Small Question about Word and FWH

Re: Small Question about Word and FWH

Postby Antonio Linares » Mon Jul 17, 2023 5: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42117
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Small Question about Word and FWH

Postby driessen » Mon Jul 17, 2023 5:48 pm

That is correct.

I use Borland
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Small Question about Word and FWH

Postby Antonio Linares » Mon Jul 17, 2023 5:53 pm

Dear Michel,

Please change your function this way:
Code: Select all  Expand view  RUN
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
User avatar
Antonio Linares
Site Admin
 
Posts: 42117
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Small Question about Word and FWH

Postby driessen » Mon Jul 17, 2023 8: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. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Small Question about Word and FWH

Postby Antonio Linares » Mon Jul 17, 2023 8: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42117
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Small Question about Word and FWH

Postby driessen » Mon Jul 17, 2023 8: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. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Small Question about Word and FWH

Postby Antonio Linares » Tue Jul 18, 2023 5:55 am

Dear Michel,

Please use this code:
Code: Select all  Expand view  RUN
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
User avatar
Antonio Linares
Site Admin
 
Posts: 42117
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Small Question about Word and FWH

Postby driessen » Tue Jul 18, 2023 6: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. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Small Question about Word and FWH

Postby driessen » Tue Jul 18, 2023 9: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. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Small Question about Word and FWH

Postby Antonio Linares » Wed Jul 19, 2023 6:22 am

Dear Michel,

Please try it this way:
Code: Select all  Expand view  RUN
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
User avatar
Antonio Linares
Site Admin
 
Posts: 42117
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Small Question about Word and FWH

Postby driessen » 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: Select all  Expand view  RUN
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. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Small Question about Word and FWH

Postby Antonio Linares » Wed Jul 19, 2023 1:09 pm

very good :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42117
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Small Question about Word and FWH

Postby driessen » Wed Jul 19, 2023 2: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. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Small Question about Word and FWH

Postby Antonio Linares » Wed Jul 19, 2023 4:52 pm

Dear Michel,

Already sent to your email
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42117
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Small Question about Word and FWH

Postby driessen » 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. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

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