Set a specific starting function

User avatar
Enrico Maria Giordano
Posts: 8728
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Set a specific starting function

Post 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)?
User avatar
carlos vargas
Posts: 1721
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua

Re: Set a specific starting function

Post 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.
Salu2
Carlos Vargas
Desde Managua, Nicaragua (CA)
User avatar
Detlef
Posts: 209
Joined: Mon Feb 07, 2022 9:54 pm

Re: Set a specific starting function

Post by Detlef »

Enrico, INIT PROCEDURE does not work for you?
User avatar
Jimmy
Posts: 1733
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: Set a specific starting function

Post 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()
greeting,
Jimmy
User avatar
Enrico Maria Giordano
Posts: 8728
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Set a specific starting function

Post 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?
User avatar
Jimmy
Posts: 1733
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: Set a specific starting function

Post 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
greeting,
Jimmy
User avatar
Enrico Maria Giordano
Posts: 8728
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Set a specific starting function

Post by Enrico Maria Giordano »

My request was specific: use a starting function that is not in the first module.
User avatar
Antonio Linares
Site Admin
Posts: 42273
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Set a specific starting function

Post 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
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Enrico Maria Giordano
Posts: 8728
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Set a specific starting function

Post 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.
User avatar
Antonio Linares
Site Admin
Posts: 42273
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Set a specific starting function

Post by Antonio Linares »

It should work fine, please try it :-)

It is just one more stack call
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
carlos vargas
Posts: 1721
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua

Re: Set a specific starting function

Post 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
...
Salu2
Carlos Vargas
Desde Managua, Nicaragua (CA)
User avatar
Enrico Maria Giordano
Posts: 8728
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Set a specific starting function

Post 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.
User avatar
Enrico Maria Giordano
Posts: 8728
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Set a specific starting function

Post 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?
Post Reply