Board index » delphi » Calling main function
Brennan Hale-Matthew
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
|
Brennan Hale-Matthew
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Calling main function
Is there a way to call your main function from a procedure? I want to
user to have the option of restarting the program thanks |
Frederi
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Calling main functionQuoteBrennan Hale-Matthews wrote: Quote> I want to user to have the option of restarting the program whenever you want to restart the program. Note that this will not execute the initialization routines of the included routines again, though. label restart; begin { Restart the program } -- |
Ing. Franz Glase
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Calling main functionQuoteBrennan Hale-Matthews wrote: Of course you could do it with a label, as Frederic suggested. But who ??? |
Archie
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Calling main functionI tried... What i want to do is this little bit of code procedure yesno; var answer : char; begin writeln('Try again? y/n?'); readln(answer); if answer = 'y' then begin main; {or whatever... however you would call the main function} end else begin end; end; Once it calls the main procedure/function it would basically go through the QuoteFrederic wrote: |
Ing. Franz Glase
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Calling main functionQuoteArchie1 wrote: This is not an appropriate approach for a Pascal programmer! Write the procedure, which you treat as the "main" procedure as a It really seems that you are thinking in "C" vocabulary, using Begin :-) |
Horst Kraem
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Calling main functionOn Sun, 08 Aug 1999 11:58:56 -0700, Brennan Hale-Matthews Quote<halem...@cadvision.com> wrote: scratch the only safe solution is the one every good ol' mailbox program uses. Start the program from a batch file: rem test.bat program myprog; Regards |
Marcus Morri
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Calling main functionIn article <37ADD370.2F2B5...@cadvision.com>, Brennan Hale-Matthews <halem...@cadvision.com> writes Quote>Is there a way to call your main function from a procedure? I want to should contain a loop if you REALLY want to go round again). -- |
Yusuf Motar
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Calling main functionQuoteArchie1 wrote: main procedure looks something like this: BEGIN Of course you'll need to put USES CRT at the top, since ReadKey is used (in my Quote> else begin seems to be superfluous... |
Dr John Stockto
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Calling main functionJRS: In article <37AF1BCA.553EB...@hippo.ru.ac.za> of Mon, 9 Aug 1999 20:19:55 in news:comp.lang.pascal.borland, Yusuf Motara Quote<s...@hippo.ru.ac.za> wrote: function ReadKey : char ; assembler ; N.B. that is not an exact replacement for all of Crt.ReadKey; test it -- |
Matthias Büchs
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Calling main functionQuote>One can avoid needing Crt, in this instance, with really used procedures to your program. Maybe ... I don't have the source for Crt, maybe there's a "big" initialization part in it? -- |
Osmo Ronkan
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Calling main functionIn article <37AF1BCA.553EB...@hippo.ru.ac.za>, Yusuf Motara <s...@hippo.ru.ac.za> wrote: Quote
if ans=#0 then readkey; after the ans:=readkey Otherwise it would also react to some special keys. Osmo |
Yusuf Motar
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Calling main functionQuoteOsmo Ronkanen wrote: option if you choose to press an arrow key or whatever. Besides, if a person were to press a special key, the key would not be "Y" anyway, so it's not necessary =) -=Yusuf=- cunningly deprives the user of many options PS Of course to catch some silly {*word*81} pressing multiple keys before this choice WHILE KeyPressed DO would be a primitive solution. That would stop inadvertent choosing of the "Y" |
Dr John Stockto
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Calling main functionJRS: In article <7oor2o$q2...@news04.btx.dtag.de> of Tue, 10 Aug 1999 10:08:53 in news:comp.lang.pascal.borland, Matthias Bchse Quote<Matthias.Buec...@T-Online.de> wrote: Borland's Crt unit is monolithic; if any is used, all is included. Not much can go wrong with code as short as I offer above. I believe -- |
Mike Copela
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Calling main functionQuote> Why don't you want to use Crt? The linker only adds the concerned. Yes, Smart Linking (the TP/BP feature which binds/links on only referenced data and subprograms from Units) works quite nicely. However, it doesn't work at all for the CRT Unit, since it's written in assembler, which can't make use of Smart Linking. Thus, S/L will do a lot of good for most user-produced Units, but has no meaning to CRT (and perhaps the graphics ones, as well, I don't know the details)... |
Arno Feh
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Calling main functionQuoteYusuf Motara wrote: Quote> Yes, but the options are given as "([Y]/n)", meaning that "Y" is the default otherwise pressing e.g. an arrow key would cause the same effect as pressing 'Y' _two_ times! regards ------------------------------------------------------------------------ |
1. Call function in main from DLL?
2. Calling a function in main app from a DLL
3. pass a function called in a dll to the main program
4. Call a function in main from DLL?
5. DLL call a function in the calling app?
6. DLL calling a function in the calling EXE
7. Questions about calling a DLL functions and shellnotifyicon() function
8. Calling Delphi functions from user-defined functions
9. Ole error : Non function called as function
10. Pointer to a function or call a function inside EXE from a DLL