Copyright © 2002-2009 MultiMedia Soft 
Return to index  
 
Using the SDK in Visual Basic 6.0 
A sample application is available under the directory Samples\VB inside the directory used to install the SDK on you PC (default C:\Program Files\3D Button API\samples\VB
Here follow the steps required : 
  • Copy in your project directory the module file 3dbapi.bas that you can find in C:\Program Files\3D Button API\include and add it to your project: this file contains all the declarations needed in order to let your application use the 3dbapi.dll library. 
  • Now, for every Form whose buttons you want to change, manage the Form_Load subroutine and add the following line of code: 
  • abmContainerSubclass Me.hWnd 
    This will cause your Form  HWND to be added to a list of windows subclassed by the API. 
  • Now you must subclass every button inside the form: supposing you want to subclass the CommandButtons Command1 and Command2 and the CheckBox Check1, do the following: 
  • At design-time set the Style buttons property to 1 (Graphical ) 
    Add the following code to the Form_Load subroutine: 
    abmButtonSubclassEx Me.hWnd, Command1.hWnd, BS_PUSHBUTTON 
    abmButtonSubclassEx Me.hWnd, Command2.hWnd, BS_PUSHBUTTON 
    abmButtonSubclassEx Me.hWnd, Check1.hWnd, BS_CHECKBOX 
  • 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 button Command1 you will call the following function: 
    abmSetShape Command1.hWnd, 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 container, you will call the following function: 
    abmContainerSetting Me.Hwnd, SET_SHAPE, SHAPE_ELLIPSE 
  • A special case is requested when using OptionButtons (also known as Radio buttons): as you should know in order to group this kind of buttons, you must include them inside a Frame control; at this point the Frame control become the container of the included OptionButtons and so it must be subclassed in the same way used for the container Form so, if for example you have two OptionButtons named Option1 and Option2 inside a Frame named Frame1, you will use a code like the following: 
  • abmContainerSubclass Frame1.hWnd 
    abmButtonSubclassEx Frame1.hWnd, Option1.hWnd, BS_RADIOBUTTON 
    abmButtonSubclassEx Frame1.hWnd, Option2.hWnd, BS_RADIOBUTTON 
    The same rule applies if you embed CommandButtons or CheckBoxes inside a Frame control, because also in this case the Frame control becomes the buttons parent. 
  • Before destroying the Form, in order to avoid memory leaks, remember to unsubclass the Form itself (and any Frame control) managing the Form_Unload subroutine in the following way: 
  • abmContainerUnsubclass Me.hWnd 
    abmContainerUnsubclass Frame1.hWnd (if any) 
    There is no need to unsubclass the previously subclassed buttons. 
     
     
     
     
     
     
     
    Copyright © 2002-2009 MultiMedia Soft 
    Return to index