J
Jim Luedke
I’m running Excel 2002 in Win 2000.
Everyone ought to know about Stephen Bullen’s fantastic CFormChanger.
It helps bring UserForm a lot closer to a normal Windows app, letting
you add such standard features as modelessness, resizeability, icons,
caption, min/max buttons, minimizing to the Windows Taskbar, etc.
But, since day 1 for me, it sometimes gets into a state whereby it
always minimizes to a little title bar in the L.R. corner of the
screen *above* the Windows Taskbar. (But it puts a button on the
Taskbar too.) This could be due something I've changed in his code.
After much reading, I suspect it may be an MDI-style minimized title
bar.
Besides failing to understand how an OS can even permit a (what I
understand to be) Win 3.1 artifact to appear, say, 200 years after the
Industrial Revolution, my questions are many.
The most important is: How do I get rid of it?
***
Optionally, for anyone interested in learning a bit about Windows form
management travails, read on (O King Eternal):
Blogs seem to suggest it might not be entirely Microsoft’s fault for
retaining this artifact. One thread seems to suggest that, with the
introduction of the Desktop and Taskbar in Windows 95, Windows had to
do something with the vestigial MDI-style title bar. It seems MS
couldn’t just hide it, because many apps depended on its staying real
and visible. MS tried moving it to various exotic locations, like
-32000,-32000, but some apps still choked on it.
So it seems the Redrum, WA authorities finally decided on 3000,3000 as
an ideal compromise position to park the title bar. (Supposedly, if
your screen exceeds 3K shmixels, or you can rig up a battery of
monitors, you’ll see all your minimized apps parked out there in MS’s
Van Allen Belt.)
Some blogs say the little bar is sized at 160x31. (That might be at
high res, because on my screen (1024x768?), it’s 120x18).
By the way, you implement Bullen’s CFormChanger with something like:
Dim FormChanger as CFormChanger
Set FormChanger = New CFormChanger
With FormChanger
Set .Form = Me
.ShowMaximizedButton = True
.ShowMinimizedButton = True
.WhileYoureUpGetMeABeer = True
...etc.
End With
So I figure, I’ve got to hook into Windows messaging, or better use a
Resize event, or do something to hide or move the pesky bar.
Ideally, you'd want to do it at the class level, within the
CFormChanger Class Module, right?
So I took some tips from Chip Pearson’s *tremendous* site, which
everyone also ought to know about:
www.cpearson.com/excel/AppEvent.aspx
Within CFormChanger's module I tried:
Private WithEvents App As Application
Private Sub Class_Initialize()
Set App = Application
End Sub
Private Sub App_WindowResize(ByVal Wb As Workbook, ByVal Wn As
Window)
etc.
But this event never seems to fire for me. Why? (The runtime value of
Application is real--it pops up as I think "Microsoft Excel").
So then I tried UserForm’s own resize event, which of course fires
fine on minimize. But the problems intensify. If I try:
Private Sub UserForm_Resize()
With UserForm1
If (.Height <= 31) And (.Width <= 160) Then
.Top = 3000
.Left = 3000
End If
End With
End Sub
I get:
“Can't move or resize form while Minimized or Maximized”.
I mean, huh? I thought I just learned Windows *itself* moves everyone
on minimize? If I try:
With UserForm1
.Visible = ((.Height > 31) Or (.Width > 160))
End With
I get this gem--uninterpretable by the average gibbon:
“Function or interface marked as restricted, or the function uses
an Automation type not supported in Visual Basic”
and so on.
Is the problem rather at the Excel level? Some people seem to say
Excel is an MDI application. Is *that* true? If so, is there some
WS_KILL_MDI_BEHAVIOR property I can set?
Finally, while my UserForm/CFormChanger app is running, I do
frequently minimize it, then go and work in the VBA Editor. I figure
that's gotta be a challenge to Excel, what with two ancillary
workspaces hanging off it; maybe some pointers get croxxed?
Thanks all very much.
***
Everyone ought to know about Stephen Bullen’s fantastic CFormChanger.
It helps bring UserForm a lot closer to a normal Windows app, letting
you add such standard features as modelessness, resizeability, icons,
caption, min/max buttons, minimizing to the Windows Taskbar, etc.
But, since day 1 for me, it sometimes gets into a state whereby it
always minimizes to a little title bar in the L.R. corner of the
screen *above* the Windows Taskbar. (But it puts a button on the
Taskbar too.) This could be due something I've changed in his code.
After much reading, I suspect it may be an MDI-style minimized title
bar.
Besides failing to understand how an OS can even permit a (what I
understand to be) Win 3.1 artifact to appear, say, 200 years after the
Industrial Revolution, my questions are many.
The most important is: How do I get rid of it?
***
Optionally, for anyone interested in learning a bit about Windows form
management travails, read on (O King Eternal):
Blogs seem to suggest it might not be entirely Microsoft’s fault for
retaining this artifact. One thread seems to suggest that, with the
introduction of the Desktop and Taskbar in Windows 95, Windows had to
do something with the vestigial MDI-style title bar. It seems MS
couldn’t just hide it, because many apps depended on its staying real
and visible. MS tried moving it to various exotic locations, like
-32000,-32000, but some apps still choked on it.
So it seems the Redrum, WA authorities finally decided on 3000,3000 as
an ideal compromise position to park the title bar. (Supposedly, if
your screen exceeds 3K shmixels, or you can rig up a battery of
monitors, you’ll see all your minimized apps parked out there in MS’s
Van Allen Belt.)
Some blogs say the little bar is sized at 160x31. (That might be at
high res, because on my screen (1024x768?), it’s 120x18).
By the way, you implement Bullen’s CFormChanger with something like:
Dim FormChanger as CFormChanger
Set FormChanger = New CFormChanger
With FormChanger
Set .Form = Me
.ShowMaximizedButton = True
.ShowMinimizedButton = True
.WhileYoureUpGetMeABeer = True
...etc.
End With
So I figure, I’ve got to hook into Windows messaging, or better use a
Resize event, or do something to hide or move the pesky bar.
Ideally, you'd want to do it at the class level, within the
CFormChanger Class Module, right?
So I took some tips from Chip Pearson’s *tremendous* site, which
everyone also ought to know about:
www.cpearson.com/excel/AppEvent.aspx
Within CFormChanger's module I tried:
Private WithEvents App As Application
Private Sub Class_Initialize()
Set App = Application
End Sub
Private Sub App_WindowResize(ByVal Wb As Workbook, ByVal Wn As
Window)
etc.
But this event never seems to fire for me. Why? (The runtime value of
Application is real--it pops up as I think "Microsoft Excel").
So then I tried UserForm’s own resize event, which of course fires
fine on minimize. But the problems intensify. If I try:
Private Sub UserForm_Resize()
With UserForm1
If (.Height <= 31) And (.Width <= 160) Then
.Top = 3000
.Left = 3000
End If
End With
End Sub
I get:
“Can't move or resize form while Minimized or Maximized”.
I mean, huh? I thought I just learned Windows *itself* moves everyone
on minimize? If I try:
With UserForm1
.Visible = ((.Height > 31) Or (.Width > 160))
End With
I get this gem--uninterpretable by the average gibbon:
“Function or interface marked as restricted, or the function uses
an Automation type not supported in Visual Basic”
and so on.
Is the problem rather at the Excel level? Some people seem to say
Excel is an MDI application. Is *that* true? If so, is there some
WS_KILL_MDI_BEHAVIOR property I can set?
Finally, while my UserForm/CFormChanger app is running, I do
frequently minimize it, then go and work in the VBA Editor. I figure
that's gotta be a challenge to Excel, what with two ancillary
workspaces hanging off it; maybe some pointers get croxxed?
Thanks all very much.
***