frequently ask ? : Computers : Programming : Languages : Bbcbasic

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

Entry

BBCBASIC: Windows: How to execute a program from your BBCBASIC program? [shell / child]

Feb 5th, 2006 11:45
Knud van Eeden,


----------------------------------------------------------------------
--- Knud van Eeden --- 05 February 2021 - 06:08 pm -------------------
BBCBASIC: Windows: How to execute a program from your BBCBASIC 
program? [shell / child]
---
Method: Using the ShellExecute() Windows API
---
Steps: Overview:
 1. -Call your program via the ShellExecute() command
     1. -E.g.
          SYS "ShellExecute", @hwnd%, 0, "OGGDEC", 0, "", 0
     2. -E.g.
          SYS "ShellExecute", @hwnd%, 0, exefile$, 0, "", 0
     3. -E.g.
          SYS "ShellExecute", @hwnd%, 0, "OGGDEC", 0, "<some 
parameters for OGGDEC>", 0
     4. -E.g.
          SYS "ShellExecute", @hwnd%, 0, "OGGDEC", "<some parameters 
for OGGDEC>", "<start directory for OGCDEC>", 0
     5. -E.g.
          SYS "ShellExecute", @hwnd%, 0, "notepad", 0, "", 1
     4. -E.g.
          SYS "ShellExecute", @hwnd%, 
0, "notepad.exe", "c:\test.txt", "c:\windows\system32\", 1
---
The general format of ShellExecute is:
  SYS "ShellExecute" <integer your window handle>,
                     <string that specifies operation to perform>,
                     <string that specifies executable file>,
                     <string that specifies the parameters of that 
executable file>,
                     <string that specifies the starting directory of 
that executable file>,
                     <integer whether window should be shown opened>
  ---
  Note:
   In case you have fill in a string, and you fill in
    0
   then that means an empty string
  ---
  Note:
   You will need to specify the startup directory of your executable
   sometimes to get it working correct.
   To see the startup directory, you should e.g. right click
   on the program icon or shortcut after installation, 
select 'Properties'
   and look at the starting directory.
   Fill this in as a parameter for ShellExecute.
---
This should be the preferred method to call your executable programs
from BBCBASIC for Windows, as it is the cleanest method
(e.g. usually not opening MSDOS windows).
===
Method: Using the '**' command
Steps: Overview:
 1. -Put '**' in front of the name of the executable filename or 
Microsoft Windows command
     1. -E.g.
      **DIR
     2. -E.g.
      **Notepad.exe
     3. -E.g.
      OSCLI "**" + exefile$
===
Method: Using the '*RUN' command
Steps: Overview:
 1. -Put '*RUN ' in front of the name of the executable filename or 
Microsoft Windows command
     1. -E.g.
      *RUN notepad.exe
     2. -E.g.
===
Method: Using the 'OSCLI' command, with parameter 'RUN'
Steps: Overview:
 1. -Put 'OSCLI " in front of the name of the executable filename or 
Microsoft Windows command
     1. -E.g.
          OSCLI "RUN" + " " + CHR$(34) + "notepad.exe" + CHR$(34)
     2. -E.g.
          OSCLI "RUN" + " " + CHR$(34) + exefile$ + CHR$(34)
===
Help: see also:
[help: program: BBCBASIC for Windows v5.00a or higher: search 
for '*RUN']
===
Internet: see also:
---
----------------------------------------------------------------------