|
|
|
|
| |
I’m using Excel 2002 in Win 2000.
I'm using Stephen Bullen’s CFormChanger to beef up UserForm with
features like min/max buttons, sizeability, my own icon, etc.:
www.oaltd.co.uk
After tweaking, it works well, thanks to all you knights of the Net
(most recently Peter T.)
Now my problem is, I want it to show in the Alt+Tab dialog and it
doesn’t.
Yet at one point, it did appear there. So I might’ve broken it.
GetWindow(MyHWnd, GW_OWNER) confirms that Excel is the owner of my
UserForm. Is ownship an issue vis-a-vis Alt+Tab? (How could it be,
since an icon used to show in Alt+Tab?)
Do any other Windows properties affect Alt+Tab status?
(One wrinkle: When my icon did appear on Alt+Tab, it was not the one I
was loading (with WM_SETICON, ICON_BIG), but rather a duplicate Excel
icon. Don't know if that problem relates to my current one of no icon
showing at all.)
I don't think Excel’s “Windows in Taskbar” feature is relevant. When
you turn it on, every workbook appears on Alt+Tab, but with a
different icon--a workbook with tiny Excel ‘X’. So that looks like a
different animal.
I’ve scoured MSDN and cpearson.com, but am stuck.
Thanks much.
***
|
| |
|
| |
Was this post helpful to you? |
|
|
|
|
|
|
|
Reply |
| |
 |
|
Top |
|
|
|
|
|
|
|
|
|
|
|
|
| |
P.P.S.:
Another test: I tried setting my icons to Excel’s own.
Getting Excel's icons is easy. (Interestingly, these return a
different number from each other):
hIcon = GetClassLong(g_ExcelHWnd, GCL_HICONSM)
hIcon = GetClassLong(g_ExcelHWnd, GCL_HICON)
Both values of hIcon work equally well in setting your small icon (my
UserForm's title bar and Taskbar button):
Call SendMessage(g_OurHWnd, WM_SETICON, ICON_SMALL, hIcon)
But once again, loading the big icon fails. Neither value of hIcon
adds (a second) Excel icon to Alt+Tab:
Call SendMessage(g_OurHWnd, WM_SETICON, ICON_BIG, hIcon)
***
|
| |
|
| |
Was this post helpful to you? |
|
|
|
|
|
|
|
Reply |
| |
 |
|
Top |
|
|
|
|
|
|
|
|
|
| |
Try something along the following lines (not fully tested)
Private Sub UserForm_Resize()
If IsIconic(mFrmHwnd) Then
ShowWindow mFrmHwnd, SW_HIDE
SetWindowLong mFrmHwnd, GWL_HWNDPARENT, GetDesktopWindow
ShowWindow mFrmHwnd, SW_MINIMIZE
Else ' form being restored
If IsIconic(mAppHwnd) Then
' if XL is minimized restore it
ShowWindow mAppHwnd, SW_RESTORE
Else
' in case XL is not active window
AppActivate (Application.Caption)
End If
SetWindowLong mFrmHwnd, GWL_HWNDPARENT, mAppHwnd
End If
End Sub
' in the initialize event
mAppHwnd = FindWindow("XLMAIN", Application.Caption)
You didn't respond to my followup in your other thread, maybe you didn't see
it.
Regards,
Peter T
"Jim Luedke" <baobob@my-deja.com> wrote in message
news:53074d86-4de4-436d-97e5-6acb89f1a9ea@k26g2000vbp.googlegroups.com...
I’m using Excel 2002 in Win 2000.
I'm using Stephen Bullen’s CFormChanger to beef up UserForm with
features like min/max buttons, sizeability, my own icon, etc.:
www.oaltd.co.uk
After tweaking, it works well, thanks to all you knights of the Net
(most recently Peter T.)
Now my problem is, I want it to show in the Alt+Tab dialog and it
doesn’t.
Yet at one point, it did appear there. So I might’ve broken it.
GetWindow(MyHWnd, GW_OWNER) confirms that Excel is the owner of my
UserForm. Is ownship an issue vis-a-vis Alt+Tab? (How could it be,
since an icon used to show in Alt+Tab?)
Do any other Windows properties affect Alt+Tab status?
(One wrinkle: When my icon did appear on Alt+Tab, it was not the one I
was loading (with WM_SETICON, ICON_BIG), but rather a duplicate Excel
icon. Don't know if that problem relates to my current one of no icon
showing at all.)
I don't think Excel’s “Windows in Taskbar” feature is relevant. When
you turn it on, every workbook appears on Alt+Tab, but with a
different icon--a workbook with tiny Excel ‘X’. So that looks like a
different animal.
I’ve scoured MSDN and cpearson.com, but am stuck.
Thanks much.
***
|
| |
|
| |
Was this post helpful to you? |
|
|
|
|
|
|
|
Reply |
| |
 |
|
Top |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Peter:
Is the other thread you mention the one where I was trying to hide the
minimized title bar of a Bullen-enhanced UserForm?
If so, I did take your advice, it works like a charm, and I did submit
my reply into that thread stating that in your code, SW_HIDE is the
thing that does the trick, but I had to comment out SW_MINIMIZE
because it un-hides the title bar again:
Private Sub UserForm_Resize()
If IsIconic(mFrmHwnd) Then
ShowWindow mFrmHwnd, SW_HIDE
' ShowWindow mFrmHwnd, SW_MINIMIZE
End If
End Sub
***
When I submitted that reply a couple days ago, it showed in the thread
fine. But looking at the thread now, you're right; I don't see my
reply.
I don't at all understand this Google interface, which is what I use.
It has a number of points of bone-headed logic. Is it their fault?
The thread has 7 entries by you & me, but the bodies of the last three
headings are suppressed. There seems to have no method to read those
messages, one of which I assume is my reply.
So big thanks for help on both.
Jim
***
|
| |
|
| |
Was this post helpful to you? |
|
|
|
|
|
|
|
Reply |
| |
 |
|
Top |
|
|
|
|
|
|
|
|
|
| |
Peter:
Unbelievable. It works. Icon now shows on Alt+Tab.
***
And thanks to you, I learned a few things:
1. Window ownership (or whatever you call what GWL_HWNDPARENT sets)
seems to toggle Alt+Tab display. A window's parent may need to be the
Desktop.
2. Yep, I had to reinstate SW_MINIMIZE. Without it, the Alt+Tab icon
didn't show. That undoubtedly was the problem that started this
thread.
3. However, reinstating SW_MINIMIZE also reinstated that pesky
floating Win 3.1-style minimized title bar (if that’s the right
terminology--guess I was wrong calling it “MDI-style”). Which is what
I wanted to kill in the first place.
4. But happily, it went away again. I'm a little unsure about what
happened, but I surmise that, when Excel owned Me, it kept the
minimized title bar within its own space; whereas xferring my
parentage to Desktop invokes post-Win 3.1 behavior of hiding it at
3000,3000??
5. Finally, I really want the Alt+Tab icon to show at all times, not
just when minimized. All other apps do that, right? So I moved:
SetWindowLong(MyHWnd, GWL_HWNDPARENT, GetDesktopWindow)
amongst UserForm's startup stuff. (I actually put it in CFormChanger’s
class module.)
6. There is a residual problem:
The Alt+Tab icon isn't the icon I load (and which successfully
displays on the form and Taskbar button). It's the generic Windows
icon. If you have any ideas about that, I’d like to know. If not, I
can certainly live with it.
To summarize:
***
‘MODULE CFormChanger.
'Thanks to Steve Bullen.
‘Private Sub Class_Terminate()
‘By not xferring our parentage back to Excel on terminate, I feared we
'might be left in memory. But on exiting Excel (in fact, on just
exiting
'the workbook), we seem to be destroyed fine. So not necesary?:
‘Call SetWindowLong(MyHWnd, GWL_HWNDPARENT, ExcelHWnd)
‘End Sub
Public Property Set Form(oUserForm As Object)
‘This Bullen property--more of a method, really--is write-only.
‘(Apology: as a Delphi programmer, naked params w/out parens simply go
against God & country:)
Call SetWindowLong(MyHWnd, GWL_HWNDPARENT, GetDesktopWindow)
AddOtherGoodies ‘Min/max buttons, sizeability, etc.
End Property
Public Property Set ChangeIconTo(ByVal IconPath as String)
'Load and set ICON_SMALL and ICON_BIG.
'- ICON_SMALL displays on the U.L. corner of your window, and
' on the Taskbar button.
'- ICON_BIG displays on Alt+Tab. This has never worked for me.
End Property
‘MODULE UserForm.
Private FormChanger as CFormChanger
Private Sub UserForm_Initialize()
Set FormChanger = New CFormChanger
With FormChanger
If FindOurIcoFile(Path, ThisWorkbook.Path) Then
.ChangeIconTo = Path
End If
Set .Form = Me
'Etc.
End With
End Sub
Private Sub UserForm_Resize()
'Thanks to Peter T. in microsoft.public.excel.programming.
If IsIconic(MyHWnd) Then
Call ShowWindow(MyHWnd, SW_HIDE)
Call ShowWindow(MyHWnd, SW_MINIMIZE)
Else
If IsIconic(ExcelHWnd) Then
'If XL is minimized restore it
Call ShowWindow(ExcelHWnd, SW_RESTORE)
Else
' in case XL is not active window
Call AppActivate(Application.Caption)
End If
End If
End With
End Sub
Private Sub UserForm_Terminate()
Set FormChanger = Nothing
End Sub
'Or thereabouts.
***
So thanks again, Peter.
***
|
| |
|
| |
Was this post helpful to you? |
|
|
|
|
|
|
|
Reply |
| |
 |
|
Top |
|
|
|
|
|
|
|
|
|
|
|
|
| |
> So maybe the Q is:
>
> Can you show an icon other than your parent's, on Alt+Tab?
It's a good question. I'm guess it should be possible though I don't know
how. Keep tinkering, if/when you get it drop me a line!
Referring to your previous post -
> > However, reinstating SW_MINIMIZE also reinstated that pesky
> > floating Win 3.1-style minimized title bar
Not sure why that was happening for you - you're not by any chance
re-showing an already loaded form, that could indeed cause your floating
window (I mean doing myForm.Show again while already loaded).
> > whereas xferring my parentage to Desktop invokes
> > post-Win 3.1 behavior of hiding it at 3000,3000??
A hidden window's x:y is given a notional -32000:-32000. However you can't
simply move the hidden window (say with the MoveWindow API) back onto the
desktop to make visible.
Regards,
Peter T
"Jim Luedke" <baobob@my-deja.com> wrote in message
news:574ed6ed-db08-4af7-b09e-5136e4dc5334@p9g2000vbl.googlegroups.com...
>I just realized:
>
> By changing UserForm's GWL_HWNDPARENT to the Desktop, it's the
> Desktop's icon (the generic Windows icon) that shows on Alt+Tab.
>
> It also explains why, when an icon appeared sporadically on Alt+Tab
> before, it was a second Excel icon, since Excel was my parent window.
>
> So maybe the Q is:
>
> Can you show an icon other than your parent's, on Alt+Tab?
>
> 'Cause as I said, WM_SETICON displays ICON_SMALL just fine (form and
> Taskbar), but fails to execute ICON_BIG (Alt+Tab).
>
> ***
|
| |
|
| |
Was this post helpful to you? |
|
|
|
|
|
|
|
Reply |
| |
 |
|
Top |
|
|
|
|
|
|
|
|
|
| |
>> Can you show an icon other than your parent's, on Alt+Tab?
With thanks to Karl Peterson over in vb.general.discussion who suggested
instead of
SetWindowLong mFrmHwnd, GWL_HWNDPARENT, GetDesktopWindow
do
SetWindowLong mFrmHwnd, GWL_HWNDPARENT, 0&
I now see the form's custom icon in Alt-tab (when the form is minimized)
Regards,
Peter T
"Peter T" <peter_t@discussions> wrote in message
news:OlTddQ3OKHA.1876@TK2MSFTNGP06.phx.gbl...
>> So maybe the Q is:
>>
>> Can you show an icon other than your parent's, on Alt+Tab?
>
> It's a good question. I'm guess it should be possible though I don't know
> how. Keep tinkering, if/when you get it drop me a line!
>
>
> Referring to your previous post -
>
>> > However, reinstating SW_MINIMIZE also reinstated that pesky
>> > floating Win 3.1-style minimized title bar
>
> Not sure why that was happening for you - you're not by any chance
> re-showing an already loaded form, that could indeed cause your floating
> window (I mean doing myForm.Show again while already loaded).
>
>> > whereas xferring my parentage to Desktop invokes
>> > post-Win 3.1 behavior of hiding it at 3000,3000??
>
> A hidden window's x:y is given a notional -32000:-32000. However you can't
> simply move the hidden window (say with the MoveWindow API) back onto the
> desktop to make visible.
>
> Regards,
> Peter T
>
>
>
> "Jim Luedke" <baobob@my-deja.com> wrote in message
> news:574ed6ed-db08-4af7-b09e-5136e4dc5334@p9g2000vbl.googlegroups.com...
>>I just realized:
>>
>> By changing UserForm's GWL_HWNDPARENT to the Desktop, it's the
>> Desktop's icon (the generic Windows icon) that shows on Alt+Tab.
>>
>> It also explains why, when an icon appeared sporadically on Alt+Tab
>> before, it was a second Excel icon, since Excel was my parent window.
>>
>> So maybe the Q is:
>>
>> Can you show an icon other than your parent's, on Alt+Tab?
>>
>> 'Cause as I said, WM_SETICON displays ICON_SMALL just fine (form and
>> Taskbar), but fails to execute ICON_BIG (Alt+Tab).
>>
>> ***
>
>
|
| |
|
| |
Was this post helpful to you? |
|
|
|
|
|
|
|
Reply |
| |
 |
|
Top |
|
|
|
|
|
|
|
|