Using the SDK in Visual C++ 6.0 and Visual C++ .NET (with MFC)
A couple of sample applications are available under the directory Samples\MFC and Samples\VC.NET 2003 inside the directory used to install the SDK on you PC (default C:\Program Files\3D Button API\samples\mfc and C:\Program Files\3D Button API\Samples\VC.NET 2003)
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.
Copy in your project directory and add to your project the wrapper files 3DabmBtn.cpp and 3DabmBtn.h that you can find in C:\Program Files\3D Button API\include: these wrappers will ease the usage of the API because they will wrap all of its exported functions.
Add the following lines of code to the stdafx.h file:
Now, for every dialog box whose buttons you want to change, intercept the WM_INITDIALOG message, overriding the OnInitDialog function, and add the following line of code:
abmContainerSubclass (GetSafeHwnd ());
This will cause your dialog box HWND to be added to a list of windows subclassed by the API.
Now you must subclass every button inside the dialog box: supposing you want to subclass the OK and CANCEL buttons, whose ID are respectively IDOK and IDCANCEL, do the following:
Add the following member variables inside the dialog box class file header:
Add the following code to the OnInitDialog function:
m_btnOK.SubclassButton (this, IDOK);
m_btnCancel.SubclassButton (this, IDCANCEL);
Before returning from the OnInitDialog 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:
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 (GetSafeHwnd (), 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 through its handler function OnDestroy adding the following line of code:
There is no need to unsubclass the previously subclassed buttons.