[AccessD] Application Title Bar

Jim Dettman jimdettman at verizon.net
Sat Jul 19 04:54:34 CDT 2008


Tony,

  Paste the following into a module:

Option Compare Database
Option Explicit

'Copy this into a public module
Private Declare Function SetWindowText Lib "User32" Alias "SetWindowTextA"
(ByVal hWnd As Long, ByVal lpString As String) As Long
Declare Function IsZoomed Lib "User32" (ByVal hWnd As Long) As Integer
Declare Function IsIconic Lib "User32" (ByVal hWnd As Long) As Integer
  
Public Sub SetFormTitle(frm As Form, TitleText As String)

    Dim fhWnd As Long
    fhWnd = frm.hWnd
    SetWindowText fhWnd, TitleText
    
End Sub

Public Sub SetAppTitle(TitleText As String)

    SetWindowText Application.hWndAccessApp, TitleText

End Sub

In the forms module, paste:

'===================================================================
'Property Maximized
'
'This procedure uses the Property Get statement to define the custom
'form property 'Maximized' by calling the IsZoomed() function.
'
'Return Value:
'    True(-1) - The form is maximized.
'    False(0) - The form is not maximized.
'
'====================================================================

Public Property Get Maximized() As Integer
     Maximized = IsZoomed(Me.hWnd) * -1
End Property

'====================================================================
'Property Minimized
'
'This procedure uses the Property Get statement to define the custom
'form property 'Minimized' by calling the IsIconic() function.
'
'Return Value:
'    True(-1) - The form is minimized.
'    False(0) - The form is not minimized.
'
'====================================================================

Public Property Get Minimized() As Integer
     Minimized = IsIconic(Me.hWnd) * -1
End Property

'===================================================================
'Property Maximized
'
'This procedure uses the Property Let statement to set the value of
'the custom form property 'Maximized'. The IsMax argument must be
'defined as the same data type returned by the corresponding Property
'Get procedure for the same custom property.
'
'====================================================================

Public Property Let Maximized(IsMax As Integer)
     If IsMax Then
         Me.SetFocus
         DoCmd.Maximize
     Else
         Me.SetFocus
         DoCmd.Restore
     End If
End Property

'====================================================================
'Property Minimized
'
'This procedure uses the Property Let statement to set the value of
'the custom form property 'Minimized'. The IsMin argument must be
'defined as the same data type returned by the corresponding Property
'Get procedure for the same custom property.
'
'====================================================================

Public Property Let Minimized(IsMin As Integer)
     If IsMin Then
         Me.SetFocus
         DoCmd.Minimize
     Else
         Me.SetFocus
         DoCmd.Restore
     End If
End Property


 and finially in the OnResize event:

  If Me.Maximized = True Then
    SetFormTitle Me, ""
    SetAppTitle "This is the test application"
  Else
    SetFormTitle Me, "my Form"
  End If

  You might want to add some more code to that to pull the App title from
the startup properties in the OnResize event rather then hard coding it as I
did.

  I believe this will give you what you want.

Jim.



-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Tony Septav
Sent: Friday, July 18, 2008 8:29 AM
To: Access Developers discussion and problem solving
Subject: [AccessD] Application Title Bar

Hey All
Is there  way to remove a form's name from the application titlebar when 
it is maximized. I just want the application name to appear, not AppName 
- [FormName].
Thanks
-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list