General

6.58 Cambiare il titolo della finestra di MSAccess, usando le API
  Antonio Biso
Option Compare Database
Option Explicit

Private Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" _
    (ByVal hwnd As Long, ByVal lpString As String) As Long
Private Declare Function GetActiveWindow Lib "user32" () As Long
Private Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" _
    (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long

Public Sub ChangeAccessTitle()
     Dim myhwnd%
     Const ACCWIN = "Omain"
     myhwnd% = GetActiveWindow()
     If myhwnd% <> 0 Then
         While ((CheckWindowClass(myhwnd%) <> ACCWIN) And (myhwnd% <> 0))
             myhwnd% = GetParent(myhwnd%)
         Wend
     Else
         Exit Sub
     End If
     If myhwnd% <> 0 Then
         SetWindowText myhwnd%, "TITOLO APPLICAZIONE - RELEASE - DATA"
     End If
End Sub

Private Function CheckWindowClass(hwnd%)
     Dim stringlength%
     Const maxstringsize = 255
     Dim safemembuffer As String * maxstringsize
     If hwnd% <> 0 Then
         stringlength% = GetClassName(hwnd%, safemembuffer, maxstringsize)
         CheckWindowClass = Left$(safemembuffer, stringlength%)
     End If
End Function

Public Sub ResetTitle()
     Dim myhwnd%
     Const ACCWIN = "Omain"
     myhwnd% = GetActiveWindow()
     If myhwnd% <> 0 Then
         While ((CheckWindowClass(myhwnd%) <> ACCWIN) And (myhwnd% <> 0))
             myhwnd% = GetParent(myhwnd%)
         Wend
         Else
             Exit Sub
     End If
     If myhwnd% <> 0 Then
         SetWindowText myhwnd%, "Microsoft Access"
     End If
End Sub
Mettendo questo modulo nel proprio database, chiamando la funzione ChangeAccessTitle nell'autoexec, scrivendo il titolo della propria applicazione dove dice di scriverlo e chiamando la ResetTitle ad ogni uscita dal database.


Se pensate di avere del materiale freeware interessante e volete pubblicarlo, allora leggete qui.