ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Splash Screen Problem (https://www.excelbanter.com/excel-programming/331916-splash-screen-problem.html)

SMonczka

Splash Screen Problem
 
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



Vasant Nanavati

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





tkstock[_21_]

Splash Screen Problem
 

That's really cool.

Is there a good source for Windows API calls? I've been able to cu
and paste other people's work, but where is a good place to star
learning about it?

Thanks

--
tkstoc

-----------------------------------------------------------------------
tkstock's Profile: http://www.excelforum.com/member.php...fo&userid=1444
View this thread: http://www.excelforum.com/showthread.php?threadid=37952


Madiya

Splash Screen Problem
 
Vasant,
Can you please elaborate, how to use this code?
Regards,


Vasant Nanavati wrote:
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




Ivan F Moala[_53_]

Splash Screen Problem
 

Put the code in the Userform Module code.
If you use Excel 97 then you will need to change the Enum bit to
Constants.
Just remove the

Private Enum ESetWindowPosStyles

and

End Enum


--
Ivan F Moala


------------------------------------------------------------------------
Ivan F Moala's Profile: http://www.excelforum.com/member.php...fo&userid=1954
View this thread: http://www.excelforum.com/showthread...hreadid=379526


xld[_3_]

Splash Screen Problem
 

Ivan F Moala Wrote:
Put the code in the Userform Module code.
If you use Excel 97 then you will need to change the Enum bit t
Constants.
Just remove the

Private Enum ESetWindowPosStyles

and

End Enum


and precede it with Const!

or better

#If VBA6 Then
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
#Else
Const SWP_SHOWWINDOW = &H40
Const SWP_HIDEWINDOW = &H80
Const SWP_FRAMECHANGED = &H20
Const SWP_NOACTIVATE = &H10
Const SWP_NOCOPYBITS = &H100
Const SWP_NOMOVE = &H2
Const SWP_NOOWNERZORDER = &H200
Const SWP_NOREDRAW = &H8
Const SWP_NOREPOSITION = SWP_NOOWNERZORDER
Const SWP_NOSIZE = &H1
Const SWP_NOZORDER = &H4
Const SWP_DRAWFRAME = SWP_FRAMECHANGED
Const HWND_NOTOPMOST = -2
#End I

--
xl
-----------------------------------------------------------------------
xld's Profile: http://www.excelforum.com/member.php...nfo&userid=975
View this thread: http://www.excelforum.com/showthread.php?threadid=37952


keepITcool

Splash Screen Problem
 

Vasant, I ink you overcomplicate things:
all the rectangles and setwindowpos can go.

after the SetWindowLong you just need a SetFocus
Declare Function SetFocus Lib "user32.dll" (ByVal hWnd As Long) As Long



--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Vasant Nanavati wrote :

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.


keepITcool

Splash Screen Problem
 

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 :


Vasant, I ink you overcomplicate things:
all the rectangles and setwindowpos can go.

after the SetWindowLong you just need a SetFocus
Declare Function SetFocus Lib "user32.dll" (ByVal hWnd As Long) As
Long



--
keepITcool
www.XLsupport.com | keepITcool chello nl | amsterdam



Vasant Nanavati wrote :

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.


Madiya

Splash Screen Problem
 
Thanks Ivan.
I am using office XP. I copied the code to the normal bas module.
But how to implement it in a lengthy macro that runs for almost 3min?
Now I also feel that the code provided by vasant may be only for
removing the caption bar. Is it true?
Regards,
Madiya

Ivan F Moala wrote:
Put the code in the Userform Module code.
If you use Excel 97 then you will need to change the Enum bit to
Constants.
Just remove the

Private Enum ESetWindowPosStyles

and

End Enum


--
Ivan F Moala


------------------------------------------------------------------------
Ivan F Moala's Profile: http://www.excelforum.com/member.php...fo&userid=1954
View this thread: http://www.excelforum.com/showthread...hreadid=379526



Vasant Nanavati

Splash Screen Problem
 
keepITcool, I'm sure you 're correct. I just couldn't get the darn form to
repaint without all the RECT stuff, or the DrawMenuBar routine used by
Stephen Bullen.

Don't mean to sound defensive, but I was trying to get a quick answer to the
OP while waiting for a flight at the airport <g. As I acknowledged, it was
pretty ugly. Never thought about SetFocus.

Regards,

Vasant

"keepITcool" wrote in message
ft.com...

Vasant, I ink you overcomplicate things:
all the rectangles and setwindowpos can go.

after the SetWindowLong you just need a SetFocus
Declare Function SetFocus Lib "user32.dll" (ByVal hWnd As Long) As Long



--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Vasant Nanavati wrote :

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.




Madiya

Splash Screen Problem
 
Hi Ivan,
Thanks for reply. But I still failed to understand how to use this bit
of code. What shell I do after putting in the normal bas module?
I am using office XP.
Reghards


Bob Phillips[_7_]

Splash Screen Problem
 
Aah, but there is a difference. Yours removes the close button, but Vasant's
removes the whole caption bar, as requested.

--
HTH

Bob Phillips

"keepITcool" wrote in message
ft.com...

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 :


Vasant, I ink you overcomplicate things:
all the rectangles and setwindowpos can go.

after the SetWindowLong you just need a SetFocus
Declare Function SetFocus Lib "user32.dll" (ByVal hWnd As Long) As
Long



--
keepITcool
www.XLsupport.com | keepITcool chello nl | amsterdam



Vasant Nanavati wrote :

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.




Ivan F Moala[_54_]

Splash Screen Problem
 

Madiya Wrote:
Hi Ivan,
Thanks for reply. But I still failed to understand how to use this bit
of code. What shell I do after putting in the normal bas module?
I am using office XP.
Reghards


Hi Madiya
You will need to put any of the above codes in the Userform code module
and not the Std module.
Note; you will also need a backdoor in that with out a titlebar you
will have no close button.

somthing like

Private Sub UserForm_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Unload Me
End Sub

Will allow you to clode out the Form by doubleclickingh it.


--
Ivan F Moala


------------------------------------------------------------------------
Ivan F Moala's Profile: http://www.excelforum.com/member.php...fo&userid=1954
View this thread: http://www.excelforum.com/showthread...hreadid=379526


keepITcool

Splash Screen Problem
 

Ahh???

...as i said: "styles can be adapted from Vasant's code"


but if removing the caption, I do prefer an edge..
as in :

Sub FormNoCaption(objForm As Object)
Dim lpWnd&
Const GWL_STYLE = -16&
Const GWL_EX_STYLE = -20&
Const WS_CAPTION = &HC00000
Const WS_EX_CLIENTEDGE As Long = &H200&

lpWnd = GetHWnd(objForm.Caption)
If lpWnd Then
SetWindowLong lpWnd, GWL_STYLE, _
(GetWindowLong(lpWnd, GWL_STYLE) And Not WS_CAPTION)
SetWindowLong lpWnd, GWL_EX_STYLE, _
(GetWindowLong(lpWnd, GWL_EX_STYLE) Or WS_EX_CLIENTEDGE)
DrawMenuBar lpWnd
SetFocus lpWnd
End If
End Sub


note my code skips (lengthy) setwindowpos and the rectangles
and uses with drawmenubar/setfocus instead.
plus wraps it in a convenient reusable sub.

for playing with windows:
forget Spy++ .. get a copy of WinSpector
from http://www.windows-spy.com/

this (with many other options) allows for on the fly experiments..




--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Bob Phillips wrote :

Aah, but there is a difference. Yours removes the close button, but
Vasant's removes the whole caption bar, as requested.


Madiya

Splash Screen Problem
 
Thanks Ivan.
Its a great help. I started using it in my earlier running application.
I close the form at the end of my code as well as in error handeling.
My users will surely like it.
Thanks again.
Regards,

Ivan F Moala wrote:
Madiya Wrote:
Hi Ivan,
Thanks for reply. But I still failed to understand how to use this bit
of code. What shell I do after putting in the normal bas module?
I am using office XP.
Reghards


Hi Madiya
You will need to put any of the above codes in the Userform code module
and not the Std module.
Note; you will also need a backdoor in that with out a titlebar you
will have no close button.

somthing like

Private Sub UserForm_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Unload Me
End Sub

Will allow you to clode out the Form by doubleclickingh it.


--
Ivan F Moala


------------------------------------------------------------------------
Ivan F Moala's Profile: http://www.excelforum.com/member.php...fo&userid=1954
View this thread: http://www.excelforum.com/showthread...hreadid=379526



Madiya

Splash Screen Problem
 
Thanks Ivan.
Its a great help. I started using it in my earlier running application.
I close the form at the end of my code as well as in error handeling.
My users will surely like it.
Thanks again.
Regards,

Ivan F Moala wrote:
Madiya Wrote:
Hi Ivan,
Thanks for reply. But I still failed to understand how to use this bit
of code. What shell I do after putting in the normal bas module?
I am using office XP.
Reghards


Hi Madiya
You will need to put any of the above codes in the Userform code module
and not the Std module.
Note; you will also need a backdoor in that with out a titlebar you
will have no close button.

somthing like

Private Sub UserForm_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Unload Me
End Sub

Will allow you to clode out the Form by doubleclickingh it.


--
Ivan F Moala


------------------------------------------------------------------------
Ivan F Moala's Profile: http://www.excelforum.com/member.php...fo&userid=1954
View this thread: http://www.excelforum.com/showthread...hreadid=379526




All times are GMT +1. The time now is 03:55 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com