Visual Basic Tip: 09/11/95

How to use Ctl3D.DLL functions to make Standard Windows Message Boxes and Common Dialogs appear 3-D using Visual Basic.
' Declare Statements

     Declare Function GetModuleHandle Lib "Kernel" (ByVal ModuleName As String) As Integer

     Declare Function Ctl3dAutoSubclass Lib "Ctl3D.DLL" (ByVal hInst As Integer) As Integer

     Declare Function Ctl3dRegister Lib "Ctl3D.DLL" (ByVal hInst As Integer) As Integer

     Declare Function Ctl3dUnregister Lib "Ctl3D.DLL" (ByVal hInst As Integer) As Integer

' Turns on a 3D effect on all Windows message and dialog boxes your program uses.

' You must call the ThreeDOff before the program ends!

     Sub ThreeDOn ()

        INST% = GetModuleHandle(App.EXEName)

        x% = Ctl3dRegister(INST%)

        x% = Ctl3dAutoSubclass(INST%)

     End Sub

' Turns off the 3D effect for VB message boxes turned on by the ThreedDOn function.

' You MUST make sure this function is called before the program ends.

     Sub ThreeDOff()

        INST% = GetModuleHandle(App.EXEName)

        x% = Ctl3dUnregister(INST%)

      End Sub

Simply call ThreeDOn to switch the 3-D look on. Call Msgbox to get an idea what the 3-D effect looks like. Make sure to call ThreeDOff before the program ends. That's All!
Return to Phil's Web Page
Last Modified: Sep 12, 1995

Last updated on 95/09/14 19:06:21 EDT.