Announcement

Collapse
No announcement yet.

Executed from console?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Executed from console?

    Hi all,

    Is there any way a program can know if it is executed
    from a console or not?

    Regards
    Peter

    ------------------
    [email protected]
    [email protected]
    www.dreammodel.dk

  • #2
    A GUI app is launched as a separate process when started from the command-line.

    Possibly info in the STARTUPINFO block returned via 'GetStartupInfo()' could offer some clues, but I've not experimented with it.

    What do you want to achieve by knowing how the app was started?

    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Lance
    mailto:[email protected]

    Comment


    • #3
      Lance,

      If my PBCC-app is not executed in a console it should end with
      a waitkey$

      Regards
      Peter

      ------------------
      [email protected]
      [email protected]
      www.dreammodel.dk

      Comment


      • #4
        Oh, PB/CC (different forum!)...

        STARTUPINFO should be able to help you here, but the easiest way (although not bullet-proof) is just test CURSORX and CURSORY at the start of the program...
        Code:
        FUNCTION PBMAIN
          IF CURSORX * CURSORY = 1 THEN 
            ' Cursor at top/left (assume console is clear, so *probably NOT* 
            ' launched from the command-line)
            StandAlone& = -1
          END IF
          ...
          IF StandAlone& THEN WAITKEY$
        END FUNCTION
        ------------------
        Lance
        PowerBASIC Support
        mailto:[email protected][email protected]</A>
        Lance
        mailto:[email protected]

        Comment

        Working...
        X