Page 1 of 2
Set a specific starting function
Posted: Sun Jul 30, 2023 3:46 pm
by Enrico Maria Giordano
Dear friends, is there a way to set a specific starting function (ie. different from the first function of the first PRG)?
Re: Set a specific starting function
Posted: Sun Jul 30, 2023 4:18 pm
by carlos vargas
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.
Re: Set a specific starting function
Posted: Sun Jul 30, 2023 6:04 pm
by Enrico Maria Giordano
Thank you. And for xHarbour?
Re: Set a specific starting function
Posted: Sun Jul 30, 2023 8:43 pm
by Detlef
Enrico, INIT PROCEDURE does not work for you?
Re: Set a specific starting function
Posted: Sun Jul 30, 2023 9:20 pm
by Enrico Maria Giordano
Can you show me a sample, please?
Re: Set a specific starting function
Posted: Sun Jul 30, 2023 9:52 pm
by Jimmy
hi Enrico,
Code: Select all | Expand
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()
Re: Set a specific starting function
Posted: Mon Jul 31, 2023 8:02 am
by Enrico Maria Giordano
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?
Re: Set a specific starting function
Posted: Mon Jul 31, 2023 8:57 am
by Jimmy
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
Re: Set a specific starting function
Posted: Mon Jul 31, 2023 9:20 am
by Enrico Maria Giordano
My request was specific: use a starting function that is not in the first module.
Re: Set a specific starting function
Posted: Mon Jul 31, 2023 2:55 pm
by Antonio Linares
Dear Enrico,
You could place a INIT PROCEDURE in the main file and then call a function from another module from it
Re: Set a specific starting function
Posted: Mon Jul 31, 2023 3:11 pm
by Enrico Maria Giordano
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.
Re: Set a specific starting function
Posted: Mon Jul 31, 2023 3:14 pm
by Antonio Linares
It should work fine, please try it
It is just one more stack call
Re: Set a specific starting function
Posted: Mon Jul 31, 2023 3:15 pm
by carlos vargas
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
...
Re: Set a specific starting function
Posted: Mon Jul 31, 2023 3:33 pm
by Enrico Maria Giordano
Antonio Linares wrote:It should work fine, please try it
It is just one more stack call
Ok, I'll try, thank you.
Re: Set a specific starting function
Posted: Mon Jul 31, 2023 3:34 pm
by Enrico Maria Giordano
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?