Microsoft KB Archive/100165

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 12:29, 19 July 2020 by X010 (talk | contribs) (Text replacement - """ to """)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

ACC1x: How to Use the CTL3D.DLL in Your MS Access Database


The information in this article applies to:

  • Microsoft Access versions 1.0, 1.1


This article describes how to achieve a three-dimensional look in your Microsoft Access database by using the CTL3D.DLL dynamic link library (DLL). Calling CTL3D.DLL APIs gives your dialog boxes a three- dimensional appearance.


This article assumes that you are familiar with Access Basic and with creating Microsoft Access applications with the programming tools provided with Microsoft Access. For more information on Access Basic, please refer to the "Introduction to Programming" manual.

You can use CTL3D.DLL to add effects to the common dialog boxes and message boxes in an Access Basic application. CTL3D.DLL does not currently work for the controls on an Access Basic form. To use CTL3D.DLL to enhance the common dialog boxes and message boxes in Access Basic, follow the steps below.

NOTE: You may have some Windows API functions defined in an existing Microsoft Access library; therefore, your declarations may be duplicates. If you receive the duplicate procedure name error, remove or comment the declare statement from your code.

   ' Note: Each command should be entered on one line.
   Option Explicit

   Declare Function GetModuleHandle% Lib "Kernel" (ByVal lpModuleName$)
   Declare Function Ctl3dAutoSubClass% Lib "Ctl3D.DLL" (ByVal hInst%)
   Declare Function Ctl3dRegister% Lib "Ctl3D.DLL" (ByVal hInst%)
   Declare Function Ctl3dUnRegister% Lib "Ctl3D.DLL" (ByVal hInst%)

   ' The following function needs to be called when your application
   '    starts.
   ' This will register Access and subclass dialogs and message boxes
   '    with the 3D look.
   Function Init ()
      Dim Inst%
      Dim ret
      Inst% = GetModuleHandle("MSACCESS.EXE")
      ret = Ctl3dRegister(Inst%)
      ret = Ctl3dAutoSubClass(Inst%)
   End Function

   ' The following function needs to be called when your application
   '    quits.
   Function ShutDown ()
      Dim Inst%
      Dim ret
      Inst% = GetModuleHandle("MSACCESS.EXE")
      ret = Ctl3dUnRegister(Inst%)
   End Function 

After running the Init() function from the Immediate window, an AutoExec macro, or a RunCode macro action, you can see the three- dimensional effects by running a macro or function that displays a message box.

NOTE: Remember to run the ShutDown() function before quitting Microsoft Access.

Additional query words: 3-D

Keywords : kbprg
Issue type : kbhowto
Technology :

Last Reviewed: November 4, 2000
© 2001 Microsoft Corporation. All rights reserved. Terms of Use.