BBC BASIC for Windows
« Assigning user icon to title and task bar »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 10:27pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1 2  Notify Send Topic Print
 hotthread  Author  Topic: Assigning user icon to title and task bar  (Read 2661 times)
19Grumpah42
Junior Member
ImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 57
xx Assigning user icon to title and task bar
« Thread started on: Nov 3rd, 2009, 8:39pm »

Can anyone point me in the right direction for replacing the given BBC icon in a programme? I have done...

SYS "LoadIconA",@hwnd%,@dir$+"LAN_title.ico" TO ret%

but it obviously takes more than that. I got lost on MSDN rather quickly, and Win-API Viewer did not offer any likely (to me!) suggestions. I had no luck on wiki either.

Thanks,
--Grahame
User IP Logged

C-2-Q 3GB, C-2-Duo 2GB, both GeForce 9500 GT, WinXP sp3. Two Linux Ubuntu boxes (rock solid, lean and mean, but they won't run BB4W!).
19Grumpah42
Junior Member
ImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 57
xx Re: Assigning user icon to title and task bar
« Reply #1 on: Nov 3rd, 2009, 9:22pm »

I think I have got part way there by reading last what I should have read first: the BB4W Help on API calls.
I've got as far as putting the icon in the system tray, but I really want to replace the BBC icon in the title bar. How would I do that?
--Grahame
User IP Logged

C-2-Q 3GB, C-2-Duo 2GB, both GeForce 9500 GT, WinXP sp3. Two Linux Ubuntu boxes (rock solid, lean and mean, but they won't run BB4W!).
admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Assigning user icon to title and task bar
« Reply #2 on: Nov 3rd, 2009, 9:39pm »

Quote:
I've got as far as putting the icon in the system tray, but I really want to replace the BBC icon in the title bar.

Replacing both is simply a case of selecting (or browsing for) the icon in the Compile dialogue, or adding a REM!Icon compiler directive:

http://www.bbcbasic.co.uk/bbcwin/manual/bbcwin1.html#executable

Don't attempt to change the icon when running under the IDE - it's BB4W's icon not your program's icon so please leave it alone! To give your program its own icon (and benefit from other Windows features like automatically remembering the folder last opened in a 'file selector') you must compile it. The intention is that you should only run your program under the IDE whilst it is being developed and debugged.

Richard.
« Last Edit: Nov 3rd, 2009, 9:49pm by admin » User IP Logged

19Grumpah42
Junior Member
ImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 57
xx Re: Assigning user icon to title and task bar
« Reply #3 on: Nov 3rd, 2009, 10:31pm »

That's perfect, Richard, thanks very much.

Incidentally, I have been using an icon editor called "Greenfish" which insists that the standard size for Win-XP icons is 20x20 for the window, 24x24 for the toolbar, but that is simply not true. They have to be sourced at 16x16 or they look nasty.

--Grahame
User IP Logged

C-2-Q 3GB, C-2-Duo 2GB, both GeForce 9500 GT, WinXP sp3. Two Linux Ubuntu boxes (rock solid, lean and mean, but they won't run BB4W!).
admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Assigning user icon to title and task bar
« Reply #4 on: Nov 4th, 2009, 08:42am »

Quote:
"Greenfish" which insists that the standard size for Win-XP icons is 20x20 for the window, 24x24 for the toolbar, but that is simply not true

There's not really any such thing as a 'standard' size, because it depends on the version of Windows, the selected Theme, the DPI setting etc. etc. That's why, for best results, you have to provide a set of icon images at different sizes (since icons don't scale well).

You can find some of the sizes relevant to your particular system configuration using SYS "GetSystemMetrics" with the SM_CXICON, SM_CYICON, SM_CXSMICON and SM_CYSMICON parameters.

On my XP PC the main icon sizes are:

small: 16x16 (e.g. used for titlebar/taskbar)
medium: 32x32 (e.g. used for desktop shortcuts)
large: 48x48 (e.g. used for explorer's tile view)

You should generally provide these sizes as a minimum, plus 256x256 (compressed) for best results on Vista.

Richard.
User IP Logged

19Grumpah42
Junior Member
ImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 57
xx Re: Assigning user icon to title and task bar
« Reply #5 on: Nov 5th, 2009, 02:53am »

Thanks Richard, just the information I needed.

I really missed that early borrowed icon for your magglass.exe programme, though I understand your reasons for not borrowing it for too long. I thought the least I could do was create a |free| one for you to use, so I have uploaded it to the http://tech.groups.yahoo.com/group/bb4w/files/WindowsAPI/ site as GEP_Mag-Icon.ico It was drawn at the four sizes you recommend and looks fine to me on desktop, icon tray, title bar and Explorer thumbnail, tile & icon. I don't have VISTA, but hopefully it would not do anything too bad to it.

It would certainly be a good help to me if you were to rebuild magglass with an active tray icon. I have successfully prototyped -- on a simple test-bed -- your original <rt-click> menu snippets for "&Hide" and "&Show", so hopefully they would work for magglass ( I can't know the answer to that). I find I want to get the glass off the screen quite often, and it is tedious to have to Close and re-Open the programme. A simple icon-tray control would be perfect.

--Grahame
User IP Logged

C-2-Q 3GB, C-2-Duo 2GB, both GeForce 9500 GT, WinXP sp3. Two Linux Ubuntu boxes (rock solid, lean and mean, but they won't run BB4W!).
admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Assigning user icon to title and task bar
« Reply #6 on: Nov 5th, 2009, 10:22am »

Quote:
I really missed that early borrowed icon for your magglass.exe programme, though I understand your reasons for not borrowing it for too long.

I don't understand: I am still using that very same icon for the Magnifying Glass! I have no plans to change it. If the icon isn't showing up on your system I have no idea why.

Quote:
It would certainly be a good help to me if you were to rebuild magglass with an active tray icon.

What would you want the SysTray (Notification Area) icon to do? It's normal to have one of those for a program that has no window, yet continues to run 'in the background', but not for a regular 'transient' application like the Magnifying Glass. I suppose it could duplicate the functionality of the right-click context menu, but I can't see any point.

Incidentally, early versions of my Magnifying Glass displayed an icon in the taskbar, which of course they shouldn't have because it doesn't have a minimise capability (or indeed any Windows menu); the taskbar icon simply wasted space with no function. I've fixed that in later versions; the window now has the WS_EX_TOOLWINDOW style which is intended for just this kind of application.

Richard.
« Last Edit: Nov 5th, 2009, 10:23am by admin » User IP Logged

19Grumpah42
Junior Member
ImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 57
xx Re: Assigning user icon to title and task bar
« Reply #7 on: Nov 5th, 2009, 12:13pm »

My point would be that a <rt-click> on the tray icon would allow you to 'Hide' -- SYS "ShowWindow", @hwnd%, 0 TO ret% -- or 'Show' -- SYS "ShowWindow", @hwnd%, 1 TO ret% -- the magnifying glass, for those occasions where you wanted it completely off the screen in between active use. This is not possible at present, without Close-ing and re-Opening the task, which is somewhat tedious. I would not suggest to duplicate the window <rt-click> functions in the tray <rt-click> functions, although it might be helpful to add 'Hide' to those options.

--Grahame
wink
User IP Logged

C-2-Q 3GB, C-2-Duo 2GB, both GeForce 9500 GT, WinXP sp3. Two Linux Ubuntu boxes (rock solid, lean and mean, but they won't run BB4W!).
19Grumpah42
Junior Member
ImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 57
smiley Re: Assigning user icon to title and task bar
« Reply #8 on: Nov 5th, 2009, 12:38pm »

I do not wish to belabour a rather small affair, but there are some operationsl constraints resulting from the lack of an active tray icon, relating to the inability to bring the magnifying glass back into 'focus', i.e. to the top of the z-stack.

While it is easy to "Hide' the glass by bringing the primary application to the top, there is no simple way to put it back below the glass. One has to move the primary application to one side, move the glass away from where one wants the primary application to be, move the primary application back to where one wants it, then move the glass over that window. This method makes it impossible to run the primary application at Maximised, which one often wants to do with pixel-perfecting applications.

Magnifying Glass does not appear in the <Alt><Tab> listing, so one cannot use that method to bring it to the z-top position.

Just based on my usage experience.
--Grahame
User IP Logged

C-2-Q 3GB, C-2-Duo 2GB, both GeForce 9500 GT, WinXP sp3. Two Linux Ubuntu boxes (rock solid, lean and mean, but they won't run BB4W!).
admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Assigning user icon to title and task bar
« Reply #9 on: Nov 5th, 2009, 3:37pm »

Quote:
there are some operationsl constraints resulting from the lack of an active tray icon, relating to the inability to bring the magnifying glass back into 'focus', i.e. to the top of the z-stack

The Magnifying Glass is already a 'topmost' window so it will always appear in front of all non-topmost windows. Unless you are in the habit of wanting to magnify the contents of another topmost window (e.g. Task Manager) you should not need to 'bring it to the front'. And if you are routinely creating your own topmost windows - DON'T!!

Quote:
While it is easy to "Hide' the glass by bringing the primary application to the top

There is something seriously wrong if you can do that. As the Magnifying Glass is a topmost window, you can't (or shouldn't be able to) bring another non-topmost window in front of it. Some investigation is required!

Quote:
One has to move the primary application to one side, move the glass away from where one wants the primary application to be, move the primary application back to where one wants it, then move the glass over that window.

If one had to do that it would indeed be completely unacceptable, but I use the Magnifying Glass a lot and I never have to do it.

Quote:
This is not possible at present, without Close-ing and re-Opening the task, which is somewhat tedious.

Do you have a particularly slow PC? On my PC closing the Magnifying Glass (right-click, Exit) is just as fast as hiding it using a Systray menu, and opening it again (double-clicking on its desktop icon) is almost instantaneous. Obviously if you're running a full-screen application (ugh!) you may not be able to get to the icon quite as quickly.

Normally what I would suggest, if you're not satisfied with how my program behaves, is to modify it yourself, because my habit has always been to release source code. However there has been something of a recent trend for other group members to release only compiled executables (often encrypted) so on this occasion I decided to follow suit.

Richard.
User IP Logged

19Grumpah42
Junior Member
ImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 57
xx Re: Assigning user icon to title and task bar
« Reply #10 on: Nov 8th, 2009, 03:36am »

Perhaps the inabilityof MagGlass to stay always on top at this location is to do with the NVIDIA drivers I happen to use for my EVGA-NVIDIA cards? I only suggest that because NVIDIA software is, how shall I say, quirky anyway.

I can understand people not wanting to release their source code, everytime.

--G cool
User IP Logged

C-2-Q 3GB, C-2-Duo 2GB, both GeForce 9500 GT, WinXP sp3. Two Linux Ubuntu boxes (rock solid, lean and mean, but they won't run BB4W!).
19Grumpah42
Junior Member
ImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 57
xx Re: Assigning user icon to title and task bar
« Reply #11 on: Nov 8th, 2009, 03:58am »

Since you said that MagGlass should never go behind another, I've checked it out a bit more. It happens with all of 7 applications I tried it on, none of them are supposed to be "always on top" and none of them are. However, bringing them to the top -- on top of MagGlass -- is a bit erratic: Sometimes it only takes one <left-click> on the app.s title bar, sometimes it takes 2 or 3. I find MagGlass may be more likely to disappear behind, with mouse movement at the same time as the title-bar click, it seems to be a phenomenon of statistically linked timing on the IRQ service. (?)

[If the 'test' application window had focus before moving MagGlass over it, it immediately loses focus (as expected).]

Hope this helps a bit.
--G
User IP Logged

C-2-Q 3GB, C-2-Duo 2GB, both GeForce 9500 GT, WinXP sp3. Two Linux Ubuntu boxes (rock solid, lean and mean, but they won't run BB4W!).
admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Assigning user icon to title and task bar
« Reply #12 on: Nov 8th, 2009, 09:40am »

Quote:
However, bringing them to the top -- on top of MagGlass -- is a bit erratic: Sometimes it only takes one <left-click> on the app.s title bar, sometimes it takes 2 or 3. I find MagGlass may be more likely to disappear behind, with mouse movement at the same time as the title-bar click

Try it with Task Manager instead: can you move a normal (non-topmost) window on top of that? Another window that should always be on top is BB4W's List Variables window, so you might like to try that one as well.

There's a caveat in the docs for SetWindowPos which suggests that I should be specifying the SWP_NOACTIVATE parameter (I'm not). I've modified the program just in case that's what's causing the anomaly on your system:

http://groups.yahoo.com/group/bb4w/files/Graphics/magglass.exe

Richard.
User IP Logged

19Grumpah42
Junior Member
ImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 57
xx Re: Assigning user icon to title and task bar
« Reply #13 on: Nov 8th, 2009, 6:48pm »

That seems analytical.

Using the original version, it seems that the window in focus and being moved has the priority for being on top. I can move task manager or BBCList Variables or MagGlass on top of any other window (including those in its "on top" group) and it will stay on top. When I select (title bar) the now underneath window then that will always come immediately, permanently on top if it is an "on top" window, or it will come on top after 1-3 (varies) title-bar clicks if it is a normal window (there is no way to select MagGlass when it is underneath, because no tray or task bar icon).

If I slide Task Manager across List Variables ( or vice versa) then the window being moved is the one which is immediately on top. The same also applies to moving them over MagGlass. The same applies also to a normal window slide across Task Manager, List Variables or MagGlass: the window being moved - although it has no Z-priority - goes immediately on top.

If I move a normal window over List Variables or Task Manager (but not MagGlass !) and then click the spuriously on top title bar (already in focus) 1 or 2 times, the underlying -- nominally "on top" -- window will resurface. Everything is then as expected.

In the case of a normal window slide across an "on top" window (Task Manager or List Variables but not MagGlass) I can toggle hide/show of the "on top" window just by repeatedly clicking the title bar of the normal window.

It seems to me that this part of Windows XP is a bit flaky (a bit like the "by agreement" multitasking in Windows 3 etc.). It's fairly easy to cope with this when the windows are all smallish and have corners, but almost impossible with MagGlass which has no corners to 'grasp' and is usually used in combination with a large, if not maximised, normal window.

I will download your revised version, see if SWP_NOACTIVATE makes a difference. Thanks for the continued study.
--Grahame
User IP Logged

C-2-Q 3GB, C-2-Duo 2GB, both GeForce 9500 GT, WinXP sp3. Two Linux Ubuntu boxes (rock solid, lean and mean, but they won't run BB4W!).
admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Assigning user icon to title and task bar
« Reply #14 on: Nov 8th, 2009, 9:45pm »

Quote:
it will come on top after 1-3 (varies) title-bar clicks if it is a normal window

In that case I'm sorry to say your PC has a serious fault. There should be no way in which you can move a non-topmost window in front of a topmost window.

Quote:
It seems to me that this part of Windows XP is a bit flaky

I have never heard of anybody else being similarly affected, so I have no reason to suspect that a bug in XP is to blame. In your position I would be extremely concerned. I would recommend re-installing Windows to see if that fixes it.

Richard.
User IP Logged

Pages: 1 2  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls