forgot the code:
styles can be adapted from Vasant code..
this is my NoClose Routine
in the forms' init event:
call formnoclose(me)
in a module:
Private Declare Function FindWindowEx Lib "user32.dll" _
Alias "FindWindowExA" (ByVal hWnd1 As Long, _
ByVal hWnd2 As Long, ByVal lpsz1 As String, _
ByVal lpsz2 As String) As Long
Private Declare Function GetWindowLong Lib "user32.dll" _
Alias "GetWindowLongA" (ByVal hWnd As Long, _
ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32.dll" _
Alias "SetWindowLongA" (ByVal hWnd As Long, _
ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function DrawMenuBar Lib "user32.dll" ( _
ByVal hWnd As Long) As Long
Private Declare Function SetFocus Lib "user32.dll" ( _
ByVal hWnd As Long) As Long
Sub FormNoClose(objForm As Object)
Dim lpWnd&
Const GWL_STYLE = -16&
Const WS_SYSMENU = &H80000
lpWnd = GetHWnd(objForm.Caption)
If lpWnd Then
SetWindowLong lpWnd, GWL_STYLE, GetWindowLong(lpWnd, GWL_STYLE) And
Not WS_SYSMENU
DrawMenuBar lpWnd
SetFocus lpWnd
End If
End Sub
Function GetHWnd(ByVal sCaption$) As Long
If sCaption = vbNullString Then sCaption = Application.Caption
GetHWnd = FindWindowEx(0&, 0&, vbNullString, sCaption)
End Function
--
keepITcool
|
www.XLsupport.com | keepITcool chello nl | amsterdam
keepITcool wrote :