| Forum List • Thread List • Refresh • New Topic • Search • Previous • Next 1 | 1. Minimizing a window to the system tray #13385 | Is there some simple way of doing this (and if there is, it goes without saying that I need to be able to detect if the user clicks on the icon and (re)opens the window) | 2. #13386 | Look at the trayicon.rex example script on my web page. | 3. Thanks for the pointer Jeff, but there's one thing I don't understand #13390 | The window text control says to click on the icon bar and hold. I include 3 screen captures to show what I'm doing (in case I'm misunderstanding you).
As you can see (?) from the 3rd capture, it seems that when I minimize the window via the icon in the top left-hand corner, it's minimized to both the system tray AND the taskbar which isn't what I'm after. I only what it minimized (and visible) in the tray
Am I doing something wrong ? | 4. After playing a bit, I came up with this solution #13394 Posted by: Michael S 2010-11-06 18:26:13 Last edited by: Michael S 2010-11-06 18:31:19 (Total edited 1 time) | Would you go this way, Jeff, or is there a better way ? I changed the trayicon example to the following
.....
err = guisetctlplacement(,,,,,,'HIDE')
again:
DO FOREVER
.......
WHEN 515 THEN
DO
guisetctlplacement(guiwindow,,,,,,'NORMAL')
guiaddctltext("TrayResult", "User double-clicked the icon")
END
......
wm_size:
temp = ARG(1) + ARG(2) + ARG(3) + ARG(4)
IF temp = 0 THEN
guisetctlplacement(,,,,,,'HIDE')
RETURN
One final question. I notice that when I close the window it disappears (of course), BUT how do I programmatically close/remove the icon from the system tray. It hangs around until I move the mouse over it (whereupon it disappears automatically) | 5. I'll answer that last question myself #13395 | There seems to be a slight bug in the example you posted. I changed the code to the following:-
IF shell_notifyicon(0, notifyicondata) == 0 THEN
DO
tray = 'No'
rc = wdwsay.rex("Failure setting the icon", "STOP")
END
ELSE
tray = "Yes"
guisetctlplacement(,,,,,,'HIDE')
again:
DO FOREVER
guigetmsg()
CATCH SYNTAX
CONDITION('M')
SIGNAL again
CATCH HALT
FINALLY
IF tray = 'Yes' THEN
DO
etc etc
However, I do have another problem, and that is I can only seem to get the left double-click on the icon in the system tray to "kick in" every other time. Here's an example of some says based on your code example. Any suggestions as to what/why this is happening ? | 6. In the end #13413 | I changed the code so that it would reopen the window if the right button was pressed.
One other question Jeff - is it correct to test for ARG(1) = 13 in WM_EXTRA to know that Windows is shutting down/restarting ? (I need to know so that I can save various settings before closing the application)
Based on the example in trayicon example, I could find in the MS documentation that WM_RBUTTONDOWN = 0x0204 = 516 (dec), but I couldn't find any equivalent value for WM_QUERYENDSESSION or WM_ENDSESSION | 7. #13414 | When doing a google search for the numeric value of a WM_ constant, add #define to your search request:
#define WM_QUERYENDSESSION
For example, the above will reveal the text:
#define WM_QUERYENDSESSION 0x0011
Note that 0x before a number is the C language's hexadecimal. (Same as appending 'X in REXX). So this is decimal 17. I haven't experimented with a QUERYENDSESSION event handler (which is how you handle that. Not from a WM_EXTRA event handler. WM_EXTRA is only needed for some rare WM_ values that REXX GUI doesn't know about and list in the "Event handlers" listbox, such as the tray messages, or your own custom messages). Kare once did and reported that Windows doesn't always report it. (Maybe it's sent only to the active window). Note that you have only a few seconds before your script is terminated. | 8. I tested a bit at work. #13415 | The results I got seemed a bit strange, but I'll include them here, nonetheless.
Using (as we do) XP Pro resulted in the following values being passed to arg(1) arg(2) and arg(3) in WM_EXTRA.
Logoff -2147483637 0 59 (Strange first value ??) Restart 11 0 59 Shutdown 11 0 59
so my code simply tests for 0/59 in args 1 & 2. If it finds it, I write my outstanding data to my files and "pretend" to do a WM_CLOSE to close everything tidily.
Note that the 13 mentioned in the earlier append seems to be the restart/shutdown values when running ordinary XP | 9. I thought I'd append this last "finesse" I added #13423 |
wm_size:
temp = ARG(1) + ARG(2) + ARG(3) + ARG(4)
IF temp = 0 THEN
DO
guisetctlplacement(,,,,,,'HIDE')
notifyicondata.7 = active_tupp_code
rc = shell_notifyicon(1, notifyicondata)
END
RETURN
What this does is to change the tip shown when the mouse passes over the icon in the system try yo whatever is currently in active_tupp_code (TUPP is a system at work that is used to register time spent on various projects). I've written an application that allows a user to automatically keep track of which project (tupp code) they're working on. All they have to do is check on the code they're working on at the moment and a time starts for that code. The "finesse" above allows them to pass the mouse over the system tray icon to see which code is currently being debited. rather than opening the window to see | Forum List • Thread List • Refresh • New Topic • Search • Previous • Next 1 |
|
|