ACC: How to Change the "Microsoft Access" Window Caption 1.x/2.0ID: Q95932
|
Advanced: Requires expert coding, interoperability, and multiuser skills.
Microsoft Access does not have property to set the main caption of the
Microsoft Access window. To change the default "Microsoft Access" caption
to your own text, you must call the Windows application programming
interface (API) SetWindowText() function.
To change the default "Microsoft Access" caption to your own text string,
create a new module in Microsoft Access and add the following function with
the appropriate declaration section.
NOTE: You may have some Microsoft Windows API functions defined in an
existing Microsoft Access library; therefore, your declarations may be
duplicates. If you receive a duplicate procedure name error message, remove
or comment out the declarations statement in your code.
NOTE: In the following sample code, an underscore (_) is used as a
line-continuation character. Remove the underscore from the end of the
line when re-creating this code in Access Basic.
'-----------------------------------------
' GLOBAL DECLARATION
'-----------------------------------------
Option Compare Database
Option Explicit
Declare Function FindWindow% Lib "User" (ByVal lpClassName As Any, _
ByVal lpWindowName As Any)
Declare Sub SetWindowText Lib "User" (ByVal hWnd%, ByVal lpString$)
'-----------------------------------------
' Function: SetCaption ()
' This function will set the caption of
' Microsoft Access's main window.
'-----------------------------------------
Function SetCaption ()
Dim hWnd%
hWnd% = FindWindow%("OMain", 0&)
Call SetWindowText(hWnd%, "This is cool!")
End Function
"Microsoft Windows Software Development Kit Programmer's Reference Volume 2: Functions," version 3.1
Additional query words: windows api
Keywords : kbprg
Version : 1.0 1.1 2.0
Platform : WINDOWS
Issue type : kbhowto
Last Reviewed: March 18, 1999