The bc9Afx package showcases three items.
#1. The bc9Basic basic to c++ translator.
#2. TCLib. A tiny c++ library by Fred Harris; hacked, beat on, and added to, by me for use with bc9Basic. The history of this libaray can be found here:
http://www.jose.it-berater.org/smfforum/index.php?topic=5126.0
http://www.jose.it-berater.org/smfforum/index.php?topic=5132.0
http://www.jose.it-berater.org/smfforum/index.php?topic=5140.0

#3. A subset of the Amazing Jos Roca's Afx/CWindow sources ported (with his permission) from his most
    recent FreeBasic version.

I had wanted to port Jos's excellent PowerBASIC package but without the needed WinApi datatypes I was
lost. With his port to FreeBasic, the conversion, was much easier. I include his help file but this is 
for his complete FreeBasic port.

The bc9Afx package is for the creation of 64bit Unicode applications using the Microsoft Visual C++ 
compiler only. Tested with Visual Studio 2015 Community. This needs to be installed on the host system.
All applications created with this package "should" run on all 64bit platforms Vista+.
It has only been tested by me on Windows 10.

Most of the Afx demos were also tested with my normal Visual Studio C++ configuration.
The exe size differences are quite dramatic. As an example the CW_Layout demo:
With my normal VC++ configuration: 140,288 bytes
TCLib                            :  23,552 bytes

With this package you have a diverse platform where you can develop for tiny, complex, or a mix.
The apps built with TCLib alone can rival PowerBASIC and Tiny C in size while utilizing the c++ unicode
standard.
'------------------------------------------------------------------------------
Examples:
  bc9Afx\Examples\TCLib\Demox.bas
    Fred's TClib Demos ported to bc9Basic
  bc9Afx\Projects\
    This directory houses all projects created with the ide.
    Those that begin with CW_ are Jos CWindow demos.

'------------------------------------------------------------------------------
Quick Start:
#1. You must have Visual Studio 2015 installed. Tested only with the Community version.
#2. Download bc9Afx and unzip to your root directory (only tested with "c:")
#3  Run BcEdit.exe.
#4. Press Ctrl N
#5. Press F11
#6. double click on the tclConsole.bas listing and press the "Copy To Code Button".
#7. Save As HelloThere.bas by selecting Menu->File->SaveAs 
#8. Press Ctrl F5. This will translate,compile and run HelloThere. 
'------------------------------------------------------------------------------

'------------------------------------------------------------------------------
TCLib FIO:
  While Fred did implement conventional MSCRT File IO to TCLIb I elected to use a
WinApi approach, primarily because of conflicts with the core bc9Basic version.
These are for Fred's String (fstring) class only.
-------------------------------------------------
  OpenFile 
-------------------------------------------------
    This will handle both stack fstrings and fstrings created with new
    Open sFile[*] For [Input|Output|Append] As hFile
    example 1 :
        Dim As HANDLE hFile
        Raw As fstring fs("InFile.txt")
        Open fs For Input As hFile
    example 2 :
        Dim As HANDLE hFile
        Raw As fstring Ptr fs = new fstring("InFile.txt")
        Open fs* For Input As hFile
-------------------------------------------------
  FPrintS
-------------------------------------------------
      Raw As fstring sTmp
      ......
      sTmp = "Some text to write to a file"    
      fPrintS(hFile,sTmp)
    You can also use literals:
      fPrintS(hFile,"Some text to write to a file")
-------------------------------------------------
  LineInput
-------------------------------------------------
    Raw As fstring ,sTmp
    LineInput(hFile,&sTmp)
    or just pass itself if created with new
    Raw As fstring Ptr spTmp = new fstring("Hello There")   
    See examples in bc9Afx\Examples\TCLib\FileIO
'------------------------------------------------------------------------------
  FPut/FGet/FSeek
'------------------------------------------------------------------------------
    These are the same as their crt counterparts.
    See the demo project MakAddBin 
==============================================================================
Notes:
  Use the AfxGetCurDir instead of native bc9Basic CURDIR$
'------------------------------------------------------------------------------

'=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
How to create a project:
'=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
Menu->File->New Project
Enter the project name. This name will become your main source and resource file
names as well as the name of the project directory.

Enter a description.

The project path should be correct

Folder creation:
  For most of my projects I just check Project sub folder

Files Templates tabs: Templates not supported

Project Type: TClib or Windows Release Unicode
  Select the one you want. It can be edited later.

File Creation: Make sure both the Code file and Resource file are checked.

Click "OK" button

You should find yourself in the resource file editor.
The resource editor has a menu item for creating an XP manifest.
This is the easiest approach but it creates an old limited version.
Here is how to create an updated one:
Add an XP Manifest to your project.
  Menu->Resource->Add XP Manifest
  Highlight (Ctrl-A) the code and delete.
  
Included with the package is afxmanifest.xml. This MANIFEST file should be used
with all apps using CWindow. You may want to edit it to reflect the compatability
of your app.

Select the basic source tab and press F11. Double click on the afxmanifest.xml.bas (only *.bas files
show hence the bas extention) and click the copy to code button.
Select the code (Ctrl-A) and then copy to clipboard with Ctrl-Insert.
Select the resource tab (make sure the editor pane has the focus caret should be seen on/off)
and paste the new manifest with Shift-Insert.
[OPTIONAL] Rename the file in the MANIFEST properties pane (on the right botton)to afxmanifest.xml
Return to the basic source pane and delete the manifest.

If you want to experiment with both tcl and standard c++ configurations (especailly to see the size
difference of the exe) select:
Menu->Project->Project Options
At the far right of the Project Options pop-up you will see two buttons with "..." as a caption.
Click the first(top) one to add the one you did not select before.
click the import button from the Project Build Options to add it.

Now with an emply edit window:
To get started press F11; It shows all the *.bas files in the Sniplet folder.
Note: You can add any often used code here to have it easily availble.
Double click on the tclAfxGui.bas file and then click the copy to code button.
See the comments at the top of the source.

There are three buttons to the left of the Project Type combo on the toolbar.
Compile: sends the source to the bc9Basic translator with options from the selected project type.
Run    : Runs the compiled app.
Go     : compiles and runs the app
'==============================================================================
Writing source:

  While bc9Basic will produce c++ source without a main or WinMain function it is not my coding
  style. All of the testing I have done uses the $NOMAIN directive at the beginning of the source.
  This package is for c++ code generation only so the next directive should be $CPP. If you want to
  use the Afx package along with the c++ STL use $CPPHDR instead of $CPP.
  bc9Basic has some powerful features, One of which is the $ONEXIT directive.
  It performs command line functions after the translation.
  In most of the examples you will see this line.
  $ONEXIT "ULEX.EXE $FILE$.CPP TCHARXLATER_VC.TXT"
  $FILE$ is a self-referencing substitute for the source file name without the extension.
  bc9Basic code is written just as you would normally write an ansi app.
  The secret ingredient is a utilty written by Wayne Halsdorf and Ian Casey: ULEX.
  ULEX unicodes the $FILE$.cpp file using a translation format located in the TCHARXLATER_VC.TXT file.
  You can have ULEX ignore code by sandwiching it between:
  !//<---UNICODE AWARE
   Dim As char ptr cp
  !//>---UNICODE AWARE
  
  Now we need to compile the c++ source and for that we have two batch files:
  VSCPP.BAT and TCLIB.BAT
  We again use $ONEXIT
  VSCPP.BAT wants $FILE$ then a leftover from 32/64 conditional compile: -m64
  After that we have gui or con for a GUI or Console application.
  TCLIB.BAT wants just the $FILE$
  
  $ONEXIT "VSCPP.BAT $FILE$ -m64 gui"
  $ONEXIT "TCLIB.BAT $FILE$"

  For TCLib we need some additional code for gui apps:

    $HEADER
        #include <commctrl.h>               /*'For CWindow*/ 
        #pragma comment(lib,"comctl32.lib") /*'For CWindow*/
        #pragma comment(lib,"gdi32.lib")    /*'For CWindow*/
        #pragma comment(lib,"advapi32.lib") /*'For DPI aware check*/
    $HEADER 
'==============================================================================
ISSUES:
'------------------------------------------------------------------------------
  I had problems with Templates so I did not investigate a work a round.
  My batch files want the main source and the rc file to have the same name.
  This is done automatically when creating a Project.
  Templates use the template name making it not compatable.
'------------------------------------------------------------------------------
  If using a 6.0 common controls manifest with your app, the height of a combobox 
  dropdown listbox is ignored. With CWindow.AddControl use a negative number of
  rows you wish to be shown.
  Or you can send this message with the number of rows to be shown.
  SendMessage(hCombobox,CB_SETMINVISIBLE,10,0)
'------------------------------------------------------------------------------
Please note the bc9Basic help file has not been updated.
The installing and update sections are not relevant.


James C. Fuller 11/01/2016




