'===========================================================================
' Subject: A FRONT-END PROGRAM FOR BC FILE    Date: 06-15-00 (10:54)       
'  Author: Gerome Guillemin                   Code: RAPIDQ                 
'  Origin: gguillemin@bvrp.com              Packet: RAPIDQ.ABC
'===========================================================================
' R A P I D - Q  B O O S T A

'/////////////////////////////////////////////////////////////////////////////////////////////////
'   Rapid-Q Boosta is a tiny Front-End to Rapid-Q's BC files !
'   -Purpose : using BC files compiled in mode RC -b
'   rather than always making Big EXE's with Rapid-Q
'   You can change code for your pleasure and use it
'   but if you use these routines, please mention the
'   author somewhere in your documentation :)
'   -Thanks to William Yu for his great RapidQ Compiler
'   -Creation time 06-15-2000 by Gerome GUILLEMIN
'   http://gedd123.free.fr (Some of my Freewares)
'   mailto: gedd123@free.fr for any comments/bugs/improvements
'   -Compiled with the Rapid-Q version of 09-06-2000
'   -Needed file to run this Front-End: Rapidq32.dll
'
'              * * * I M P O R T A N T ! * * *
'   -As in Rapid-Q, Command$(x) always starts at 1, please note, in the BAS files
'   turned into BC files, you'll have to note Command$(1) will be in fact Command$(2) !
'   -Up to 9 command$(x) supported : Command$(2) to Command$(10)
'   -Nota : when you compile 'File.bas -b', do not forget in your tests that Command$(1) is
'   in fact Command$(2) and so on...It can be more if you want... :)
'   -This .BAS file have to be Compiled with RC with no parameters (to make an EXE at 1st)
'   then, enjoy BC files ;)
'
'/////////////////////////////////////////////////////////////////////////////////////////////////

'Options for the Compiler
  $AppType GUI
  $TypeCheck ON
  $Optimize ON
  $include "RapidQ.inc"

' User's Variables
  DIM szBCFile as STRING
  
If Command$(1) = "/REG" then '(Must be launched once with '/REG' parameter to activate file association in the Registry !)

  'Declaration to execute '.BC' files
  DECLARE FUNCTION RQ_ExecuteFile LIB "RAPIDQ32.DLL" ALIAS "RQ_ExecuteFile" (FileName AS STRING) AS LONG

  Const HKEY_CLASSES_ROOT = &H80000000
  'Const HKEY_LOCAL_MACHINE = &H80000002

'To be done in the Registry:
  'HKEY_CLASSES_ROOT\BCFile = Rapid-Q Boosta
  'HKEY_CLASSES_ROOT\.bc = BCFile

  DIM Registry AS QRegistry
  DIM szCmd as STRING

'Name & path of the executable  
  szCmd = Command$(0) + " %1 %2 %3 %4 %5 %6 %7 %8 %9 %10"

' Associate BC files to this file once turned into executable
  Registry.RootKey = HKEY_CLASSES_ROOT
  Registry.OpenKey("\.bc", 1)
  Registry.WriteString("","BCFile")

  Registry.OpenKey("\BCFile", 1)
  Registry.WriteString("","Rapid-Q Boosta")
  Registry.OpenKey("shell\open\command", 1)
  Registry.WriteString("",szCmd)

Else

'Association is done ?, OK then... execute Code !
  szBCFile = command$(1)
  RQ_ExecuteFile(szBCFile)
  
End If
