Heenan, Lambert
Lambert.Heenan at chartisinsurance.com
Wed Apr 20 09:46:23 CDT 2011
I had a need for a form with no border at all, and Google helped me find the code. Regrettably I did not record where I got it, so I cannot credit the author, but a simple API call did the trick. In the form's module include this... Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, _ ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Private Const GWL_STYLE = (-16) Private Const WS_BORDER = &H800000 Private Const WS_MAXIMIZEBOX = &H10000 Private Const WS_MINIMIZEBOX = &H20000 Private Const WS_DLGFRAME = &H400000 Private Const WS_THICKFRAME = &H40000 Private Const SWP_FRAMECHANGED = &H20 Private Const SWP_NOMOVE = &H2 Private Const SWP_NOSIZE = &H1 Private Const SWP_NOZORDER = &H4 Then, for my borderless for the form's Load event was... Private Sub Form_Load() Dim lStyle As Long lStyle = GetWindowLong(Me.hwnd, GWL_STYLE) lStyle = lStyle And Not (WS_BORDER Or WS_DLGFRAME Or WS_MAXIMIZEBOX Or WS_MINIMIZEBOX Or WS_THICKFRAME) Call SetWindowLong(Me.hwnd, GWL_STYLE, lStyle) SWP_NOSIZE Or SWP_NOZORDER End Sub By changing that load event to the following you wind up with a form with no title bar but with a sizable border (though it starts out with a height that includes the invisible title bar???). Private Sub Form_Load() Dim lStyle As Long lStyle = GetWindowLong(Me.hwnd, GWL_STYLE) lStyle = lStyle And Not (WS_DLGFRAME Or WS_MAXIMIZEBOX Or WS_MINIMIZEBOX) Call SetWindowLong(Me.hwnd, GWL_STYLE, lStyle) End Sub Be sure to set the form's border style to Sizable. Lambert -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin Sent: Tuesday, April 19, 2011 4:37 PM To: 'Access Developers discussion and problem solving' Subject: [AccessD] Hide Form Title Bar Dear List: I want to eliminate the form title bar on a pop up form but still need the border to be sizable. Is there a way to do this? MTIA Rocky Smolin Beach Access Software 858-259-4334 Skype: rocky.smolin www.e-z-mrp.com <http://www.e-z-mrp.com/> www.bchacc.com <http://www.bchacc.com/> -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com