Using the SDK in Visual C++ 6.0 (C++ without MFC)
A sample application is available under the directory Samples\VC inside the directory used to install the SDK on you PC (default C:\Program Files\3D Button API\samples\VC)
Here follow the steps required :
Add the 3dbapi.lib file that comes with our product installation package to your project : this will guarantee that, at runtime, the 3dbapi.dll library will be loaded. Supposing that you have installed the product in the default directory C:\Program Files\3D Button API you will find this file in C:\Program Files\3D Button API\lib
Copy in your project directory the header file 3dbapi.h that you can find in C:\Program Files\3D Button API\include and add the following line of code to all of the header files that will use the API exported functions:
This include statement can alternatively be included only once in the stdafx.h file if your project skeleton has been generated using the AppWizard.
If your project has been generated using the AppWizard, open the stdafx.h file and remove (or comment) the following line of code:
This will ensure that the WINAPI type used to declare the API exported functions will be recognized by the compiler.
Now, for every dialog box whose buttons you want to change, intercept the WM_INITDIALOG message and add the following line of code:
This will cause your dialog box HWND to be added to a list of windows subclassed by this API.
Now you must subclass every button inside the dialog box using the dialog box HWND and the button HWND (yes, all the buttons have their own HWND); supposing you want to subclass the OK and CANCEL buttons you will have to add the following code to the WM_INITDIALOG message handler:
HWND hwndBtnOK = GetDlgItem (hDlg, IDOK);
HWND hwndBtnCancel = GetDlgItem (hDlg, IDCANCEL);
abmButtonSubclass (hDlg, hwndBtnOK);
abmButtonSubclass (hDlg, hwndBtnCancel);
Before returning from the WM_INITDIALOG message handler, the subclassed buttons inside the dialog box will need to be notified if the dialog box background color is different from the system default; this task can be performed calling a general purpose function that will broadcast the color setting to all the buttons inside the container: this function is abmContainerSetting and can be used also for other type of settings; supposing that your dialog box would have a dark blue background you will use a line of code like this:
abmContainerSetting (hDlg, SET_COLOR_CONTAINER_BACK, RGB (0, 0, 128));
This call will notify to all the subclassed buttons inside the dialog box the container background color value.
At this point you can modify the buttons look & feel and behavior inside the container in two major ways:
One by one using the functions exported by the API; for example if you would like to set a elliptical shape to the OK button you will call the following function:
abmSetShape (hwndBtnOK, SHAPE_ELLIPSE);
All together at the same time, using the abmContainerSetting function; for example if you would like to set a elliptical shape to all the buttons inside the dialog box, you will call the following function:
abmContainerSetting (hDlg, SET_SHAPE, SHAPE_ELLIPSE);
Before destroying the dialog box, in order to avoid memory leaks, remember to unsubclass the dialog itself intercepting the WM_DESTROY message and adding the following line of code:
There is no need to unsubclass the previously subclassed buttons.