There is a much easier way. Set your splash screen AND Main form properties as such -
MaxButton = False
MinButton = False
Moveable = False
Now add the following code that will disable the "x"/close button. This way the splash will show and can not be minimised, closed, moved or nothing. It will only happen once all events is done in your main form.:)
In a module, add the following code -
Option Explicit
'windows constants
Public Const SWP_DRAWFRAME As Long = &H20
Public Const SWP_NOMOVE As Long = &H2
Public Const SWP_NOSIZE As Long = &H1
Public Const SWP_NOZORDER As Long = &H4
Public Const SWP_FLAGS = SWP_NOZORDER Or SWP_NOSIZE Or _
SWP_NOMOVE Or SWP_DRAWFRAME
'menu flags
Public Const MF_BYCOMMAND As Long = &H0
Public Const MF_BYPOSITION As Long = &H400
Public Const MF_REMOVE As Long = &H1000
Public Const MIIM_STATE As Long = &H1
Public Const MIIM_ID As Long = &H2
Public Const MIIM_SUBMENU As Long = &H4
Public Const MIIM_CHECKMARKS As Long = &H8
Public Const MIIM_TYPE As Long = &H10
Public Const MIIM_DATA As Long = &H20
Public Const MFT_STRING As Long = &H0
Public Const MFT_RADIOCHECK As Long = &H200
Public Const MFS_DISABLED As Long = &H3
Public Type MENUITEMINFO
cbSize As Long
fMask As Long
fType As Long
fState As Long
wID As Long
hSubMenu As Long
hbmpChecked As Long
hbmpUnchecked As Long
dwItemData As Long
dwTypeData As String
cch As Long
End Type
Public Declare Function GetMenuItemInfo Lib "user32" _
Alias "GetMenuItemInfoA" _
(ByVal hMenu As Long, ByVal uItem As Long, _
ByVal fByPosition As Long, lpmii As MENUITEMINFO) As Long
Public Declare Function GetMenuItemCount Lib "user32" _
(ByVal hMenu As Long) As Long
Public Declare Function GetSystemMenu Lib "user32" _
(ByVal hwnd As Long, _
ByVal bRevert As Long) As Long
Public Declare Function RemoveMenu Lib "user32" _
(ByVal hMenu As Long, _
ByVal nPosition As Long, _
ByVal wFlags As Long) As Long
Public Declare Function DrawMenuBar Lib "user32" _
(ByVal hwnd As Long) As Long
Public 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
Public Sub MenuRemoveClose(frm As Form)
Dim c As Long
Dim hMenu As Long
Dim mInfo As MENUITEMINFO
Dim pos As Long
'get the system menu handle
hMenu = GetSystemMenu(frm.hwnd, 0)
'loop backwards through the menu
For c = GetMenuItemCount(hMenu) To 0 Step -1
With mInfo
.cbSize = Len(mInfo)
.fMask = MIIM_TYPE Or MIIM_ID
.fType = MFT_STRING
.dwTypeData = Space$(256)
.cch = Len(mInfo.dwTypeData)
End With
'Retrieve the current MENUITEMINFO.
'Specifying fByPosition=True indicates
'uItem points to an item by position.
'Returns 1 if successful
If GetMenuItemInfo(hMenu, c, True, mInfo) = 1 Then
'The close command has an ID of 61536. Once
'that has been deleted, in a MDI Child window
'two separators would remain (in a SDI one
'separator would remain).
'
'To assure that this code will cover both
'MDI and SDI system menus, 1 is subtracted
'from the item number (c) to remove either
'the top separator (of the two that will
'remain in a MDIChild), or the single SDI
'one (that would remain if this code was
'applied against a SDI form.)
If (mInfo.wID = 61536) Then
Call RemoveMenu(hMenu, c, _
MF_REMOVE Or MF_BYPOSITION)
Call RemoveMenu(hMenu, c - 1, _
MF_REMOVE Or MF_BYPOSITION)
End If
End If
Next
'force a redraw of the non-client
'area of the form to cause the
'disabled X to paint correctly
Call SetWindowPos(frm.hwnd, 0, 0, 0, 0, 0, SWP_FLAGS)
Call DrawMenuBar(frm.hwnd)
End Sub
In your form, call it as in -
Call MenuRemoveClose(Me)