Copyright © 2002-2009 MultiMedia Soft 
Return to index  
 
Using the SDK in Visual C++ 6.0 (C without MFC) 
This SDK has been written using the C++ language so if you want to call its functions from within a "C" module you must use a coherent calling convention: this task can be performed in three different ways: 
1. Compile the "C" modules that use the SDK using the /TP switch (could cause the generation of errors on already existing code) and follow the same steps described in section C++ without MFC
2. Rename the "C" modules from *.c to *.cpp (could cause the generation of errors on already existing code) and follow the same steps described in section C++ without MFC
3. Follow the steps below. 
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\cdecl\ 
  • 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: 
  • #include "3dbapi.h" 
    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: 
  • #define WIN32_LEAN_AND_MEAN 
    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: 
  • abmContainerSubclass (hDlg); 
    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 behaviour 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: 
  • abmContainerUnsubclass (hDlg); 
    There is no need to unsubclass the previously subclassed buttons. 
     
     
     
     
     
     
    Copyright © 2002-2009 MultiMedia Soft 
    Return to index