View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Vasant Nanavati Vasant Nanavati is offline
external usenet poster
 
Posts: 1,080
Default Splash Screen Problem

If you don't mind some complicated API stuff:

Option Explicit

Private Declare Function FindWindowA Lib "user32" _
(ByVal lpClassName As String, ByVal lpWindowName _
As String) 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 Declare Function GetWindowLong Lib "user32" _
Alias "GetWindowLongA" (ByVal hwnd As Long, _
ByVal nindex As Long) As Long

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 GetWindowRect Lib "user32" ( _
ByVal hwnd As Long, lpRect As RECT) As Long

Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type

Private Enum ESetWindowPosStyles
SWP_SHOWWINDOW = &H40
SWP_HIDEWINDOW = &H80
SWP_FRAMECHANGED = &H20
SWP_NOACTIVATE = &H10
SWP_NOCOPYBITS = &H100
SWP_NOMOVE = &H2
SWP_NOOWNERZORDER = &H200
SWP_NOREDRAW = &H8
SWP_NOREPOSITION = SWP_NOOWNERZORDER
SWP_NOSIZE = &H1
SWP_NOZORDER = &H4
SWP_DRAWFRAME = SWP_FRAMECHANGED
HWND_NOTOPMOST = -2
End Enum

Private Const WS_SYSMENU = &H80000
Private Const WS_CAPTION = &HC00000
Private Const GWL_STYLE = (-16)

Private Sub UserForm_Initialize()
Dim lStyle As Long, hwnd As Long, tR As RECT
hwnd = FindWindowA(vbNullString, Me.Caption)
GetWindowRect hwnd, tR
Me.Caption = ""
lStyle = GetWindowLong(hwnd, GWL_STYLE)
lStyle = lStyle And Not WS_SYSMENU
lStyle = lStyle And Not WS_CAPTION
SetWindowLong hwnd, GWL_STYLE, lStyle
SetWindowPos hwnd, _
0, tR.Left, tR.Top, _
tR.Right - tR.Left, tR.Bottom - tR.Top, _
SWP_NOREPOSITION Or SWP_NOZORDER Or SWP_FRAMECHANGED
Me.Repaint
End Sub

Kind of ugly but I just slapped it together from a variety of sources.

I'm assuming you have some OnTime code to dismiss the form.

--

Vasant

"Smonczka" wrote in message
oups.com...
I am making a splash screen that pops up when a long running macro is
started. I was wondering is there a way to eliminate (not show) the
caption bar on the window when it pops up.

Thanks,
Steve Monczka