Hello,
this is a small project which I started some time ago but interrupted it for a while.
The idea is to use resources like menus, bitmaps, controls in a dll. In this case also use a dialog as a main window for small applications. An advantage would be that a visual resource editor like Resed
https://svn.code.sf.net/p/fbedit/code/ResEd22/ResEd.zipcould be used to arrange the controls, menues, etc in the dialog box. The project is then saved as a .rc file which can be compiled to a .res file with GoRc.exe which then can be linked to a dll or exe file.
There is a small Tutorial about dialog as a main window here:
https://www.relisoft.com/win32/windlg.htmlFor developing the application I linked the resources to a dll which can be created quite easily with OxygenBasic. The code for sliders_dll.o2bas is simply this:
$dll
$filename "Sliders.dll"
includepath "$/inc/"
#include "RTL32.inc"
'#include "RTL64.inc"
// do nothing
I used a small batch file to create the .res and .dll file and to start the main slider.o2bas file:
@echo off
set filename=Sliders
:: get path of Oxygenbasic
:: -------------------------
set o2_dir=c:\OxygenBasic
if not exist %o2_dir%\gxo2.exe goto missing_dir
if not exist %filename%.o2bas goto missing_file
:: delete exe, dll
::----------------
if exist %filename%.exe del %filename%.exe
if exist %filename%.dll del %filename%.dll
:: build dll
::----------
echo gxo2: Building dll file
%o2_dir%\gxo2.exe %filename%_dll.o2bas
cd res
if exist %filename%.rc %o2_dir%\tools\goRC %filename%.rc
cd ..
if exist res\%filename%.res %o2_dir%\tools\linkres2exe res\%filename%.res %filename%.dll
:: delete obj, res
::----------------
echo deleting obj, res files
if exist res\%filename%.obj del res\%filename%.obj
if exist res\%filename%.res del res\%filename%.res
::build or run main file
::-----------------------
echo gxo2: Starting %filename%.o2bas
%o2_dir%\gxo2.exe %filename%.o2bas
echo .
echo Done ...
goto goodbye
:missing_dir
echo.
echo Please correct the path for o2_dir in this batch file
echo.
pause
goto goodbye
:missing_file
echo.
echo Error:
echo missing %filename%.o2bas
echo .
pause
:goodbye
To run this project successfully, gxo2.exe (co2.exe) and oxygen.dll are expected in c:\oxygenbasic, GoRC.exe and LinkRes2exe.exe are expected in \OxygenBasic\tools. Otherwise the paths must be adapted in the batch file. I used the latest download of OxygenBasic (Dez. 11 2016).
To create a 32-bit executable of Sliders.o2bas the comment of:
'#include "$/inc/RTL32.inc" must be removed.
To create a 64-bit executable the comment of
'#include "$/inc/RTL64.inc" must be removed. This change must be done in Sliders_dll.o2bas for 64-bit too.
This small application already offers some interesting features: application icon, menu, toolbar, tooltips, buttons, sound, hotkeys, versioninfo - Right-Click with mouse on Sliders.dll and select details. Using Resed.exe (and I only applied it without customizing) still more is possible. The proceeding would always be similiar. The code and resources of the project are attached as a zip file.
Roland
Edit: deleted and modified project attached with later message
.