Set a specific starting function

Set a specific starting function

Postby Enrico Maria Giordano » Sun Jul 30, 2023 3:46 pm

Dear friends, is there a way to set a specific starting function (ie. different from the first function of the first PRG)?
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Set a specific starting function

Postby carlos vargas » Sun Jul 30, 2023 4: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)
User avatar
carlos vargas
 
Posts: 1721
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua


Re: Set a specific starting function

Postby Detlef » Sun Jul 30, 2023 8:43 pm

Enrico, INIT PROCEDURE does not work for you?
User avatar
Detlef
 
Posts: 209
Joined: Mon Feb 07, 2022 9:54 pm

Re: Set a specific starting function

Postby Enrico Maria Giordano » Sun Jul 30, 2023 9:20 pm

Can you show me a sample, please?
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Set a specific starting function

Postby Jimmy » Sun Jul 30, 2023 9:52 pm

hi Enrico,

Code: Select all  Expand view  RUN
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
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: Set a specific starting function

Postby Enrico Maria Giordano » Mon Jul 31, 2023 8: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?
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Set a specific starting function

Postby Jimmy » Mon Jul 31, 2023 8: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
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: Set a specific starting function

Postby Enrico Maria Giordano » Mon Jul 31, 2023 9:20 am

My request was specific: use a starting function that is not in the first module.
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Set a specific starting function

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

Re: Set a specific starting function

Postby Enrico Maria Giordano » Mon Jul 31, 2023 3: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.
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Set a specific starting function

Postby Antonio Linares » Mon Jul 31, 2023 3:14 pm

It should work fine, please try it :-)

It is just one more stack call
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: Set a specific starting function

Postby carlos vargas » Mon Jul 31, 2023 3: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)
User avatar
carlos vargas
 
Posts: 1721
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua

Re: Set a specific starting function

Postby Enrico Maria Giordano » Mon Jul 31, 2023 3: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.
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Set a specific starting function

Postby Enrico Maria Giordano » Mon Jul 31, 2023 3: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?
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 80 guests