FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Set a specific starting function
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Set a specific starting function
Posted: Sun Jul 30, 2023 03:46 PM

Dear friends, is there a way to set a specific starting function (ie. different from the first function of the first PRG)?

Posts: 1789
Joined: Tue Oct 11, 2005 05:01 PM
Re: Set a specific starting function
Posted: Sun Jul 30, 2023 04:18 PM

Enrico, tengo entendido que harbour busca una funci贸n llamada Main.

Ahora s铆 mal no recuerdo usando hbmk2 puedes indicar el nombre de una funci贸n que ser谩 tratada como el punto de ingreso de la app en lugar de Main.

Puedes ver la ayuda extendida de hbmk2 para ver cu谩l es ese par谩metro.

Salu2

Carlos Vargas

Desde Managua, Nicaragua (CA)
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Set a specific starting function
Posted: Sun Jul 30, 2023 06:04 PM

Thank you. And for xHarbour?

Posts: 218
Joined: Mon Feb 07, 2022 09:54 PM
Re: Set a specific starting function
Posted: Sun Jul 30, 2023 08:43 PM

Enrico, INIT PROCEDURE does not work for you?

Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Set a specific starting function
Posted: Sun Jul 30, 2023 09:20 PM

Can you show me a sample, please?

Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: Set a specific starting function
Posted: Sun Jul 30, 2023 09:52 PM
hi Enrico,
Code (fw): Select all Collapse
INIT PROCEDURE MainInit()
LOCAL cTitle 聽:= "FiveWin TGrid Listview Demo " + cVersion
LOCAL hWndDlg := FindWindowEx(,,, cTitle )
聽 聽IF !( hWndDlg == 0 )
聽 聽 聽 SetForegroundWindow( hWndDlg )
聽 聽 聽 BringWindowToTop( hWndDlg )
聽 聽 聽 ShowWindow( hWndDlg, 1 )
聽 聽 聽 UpdateWindow( hWndDlg )
聽 聽 聽 QUIT 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 // It is a second instance. Bye Bye
聽 聽ENDIF
RETURN

PROCEDURE Main()
greeting,

Jimmy
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Set a specific starting function
Posted: Mon Jul 31, 2023 08:02 AM

Thank you, but this is not what I'm asking for. I have many PRGs and a function MAIN() inside one of those (not the first linked). How can I force the function MAIN() to be executed as the first function?

Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: Set a specific starting function
Posted: Mon Jul 31, 2023 08:57 AM
hi Enrico,
Enrico Maria Giordano wrote:Thank you, but this is not what I'm asking for.
you ask for a Sample using INIT PROCEDURE
Enrico Maria Giordano wrote:I have many PRGs and a function MAIN() inside one of those (not the first linked).
How can I force the function MAIN() to be executed as the first function?
put you file with MAIN as 1st into your *,MAK or *,HBP
greeting,

Jimmy
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Set a specific starting function
Posted: Mon Jul 31, 2023 09:20 AM

My request was specific: use a starting function that is not in the first module.

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Set a specific starting function
Posted: Mon Jul 31, 2023 02:55 PM

Dear Enrico,

You could place a INIT PROCEDURE in the main file and then call a function from another module from it

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Set a specific starting function
Posted: Mon Jul 31, 2023 03:11 PM

Yes, I already thought about that but I'm not sure it is a good working solution. In fact, all the program would be executed inside the INIT PROCEDURE, that is not a good thing, I suppose.

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Set a specific starting function
Posted: Mon Jul 31, 2023 03:14 PM
It should work fine, please try it :-)

It is just one more stack call
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1789
Joined: Tue Oct 11, 2005 05:01 PM
Re: Set a specific starting function
Posted: Mon Jul 31, 2023 03:15 PM
using
hbmk2 -hhh
open the help file of hbmk2 with parameters in notepad
...
-main=<mainfunc> sustituye el nombre de la funci贸n o procedimento inicial
...
Salu2

Carlos Vargas

Desde Managua, Nicaragua (CA)
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Set a specific starting function
Posted: Mon Jul 31, 2023 03:33 PM
Antonio Linares wrote:It should work fine, please try it :-)

It is just one more stack call
Ok, I'll try, thank you.
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Set a specific starting function
Posted: Mon Jul 31, 2023 03:34 PM
carlos vargas wrote:using
hbmk2 -hhh
open the help file of hbmk2 with parameters in notepad ...
-main=<mainfunc> sustituye el nombre de la funci贸n o procedimento inicial
...
This is only for Harbour, not for xHarbour, right?