1 Attachment(s)
New email alert - may take a long time to notice
Windows Live Mail application's visual alert too weak. Tray
icon becomes yellow.
SCREENSHOT
Microsoft hasn't answered my inquiry about this matter, that I
sent to them 1-2 months ago.
SUMMARY:
I run Windows XP and use Windows Live Mail which is a
program – I don’t mean Windows Live Mail on the web. When I
receive new e-mail, I would really need that a window comes up
announcing the new mail and that the window stays there until I
close it down. How can I get this? How do you write a program
that solves this?
DETAILS:
When I receive an email, a sound is played, and the tray icon of
Windows Live Mail becomes a yellow envelope, instead of a white
one. If I’m running Windows Live Messenger as well, then a small
window (“toaster”) comes up announcing that there is new mail.
This window disappears after a second or two. I can only be
logged in on Messenger for one account, so I don’t get the
toaster window for the other accounts that I use Windows Live
Mail with. This toaster window (which comes up for only one
account) and the yellow envelope are not strong enough signals
that there is new mail. I would really need that a window comes
up announcing the new mail and that the window stays there until
I close it down. I use Windows Live Mail version 2008 (build
12.0.1606).
POSSIBLE APPROACH
Maybe you could install a hook to find out when the tray icon
changes, but I don’t know how.
Re: New email alert - may take a long time to notice
A reply I got on another site from someone nicknamed NickkDMax:
Well I suppose there are two approaches I may take one this:
#1 -- Use pop3/imap to poll the email account for new messages.
-- This is essentially what the chat program does, it polls you
email account and looks for new messages. There are a number of
pop2/imap libraries available (but your email server has to allow
these kinds of clients).
#2 -- A windows messaging hook. In windows events are normally
conveyed by messages. A program such as spy++ or Autohotkey's
AutoIt++ Window Message Spy will allow you to see what messages
are generated. Then you should be able to hook these (I would
probably use AutoHotkey for such a task) and preform whatever
action you need.
Re: New email alert - may take a long time to notice
My answer to NickDMax:
#1 -- Hotmail accounts use IMAP. The server that the chat program
is connected to sends a message to the chat program that there is
new mail, not the other way round, otherwise the chat program
wouldn’t immediately find out when there is new mail, which it
does.
I can’t find any IMAP library from a reliable download site, like
download.com or softpedia.com, but I have tried a program - POP
Peeper - that works like the Windows Live Mail program - but upon
new mail it pops up a window that stays there until you close it
down, which is just what I want. But POP Peeper only works with
some of my accounts (all IMAP). So this approach doesn’t work.
#2 --
I think Windows Live Messenger sends a window message to Windows
Explorer (explorer.exe) when it wants the tray icon to change.
Windows Explorer is the program that shows the tray bar.
I don’t have Spy++ as I only have the Express version of
MS Visual C++. Maybe you can use UI Spy which seems to
be the new version of Spy++. UI Spy is included in Microsofts
free (platform?) SDK.
Autohotkey has a Window Spy program but it doesn’t
show window messages, only “Active Window Info” like this:
------------------------------------------------------------------------
>>>>>>>>>>( Window Title & Class )<<<<<<<<<<<
ahk_class Shell_TrayWnd
>>>>>>>>>>>>( Mouse Position )<<<<<<<<<<<<<
On Screen: 748, 532 (less often used)
In Active Window: 750, -427
>>>>>>>>>( Now Under Mouse Cursor )<<<<<<<<
Color: 0xCED3D6 (Blue=CE Green=D3 Red=D6)
>>>>>>>>>>( Active Window Position )<<<<<<<<<<
left: -2 top: 959 width: 1284 height: 67
>>>>>>>>>>>( Status Bar Text )<<<<<<<<<<
>>>>>>>>>>>( Visible Window Text )<<<<<<<<<<<
Start
Notification Area
Running Applications
Running Applications
>>>>>>>>>>>( Hidden Window Text )<<<<<<<<<<<
11:04
>>>>( TitleMatchMode=slow Visible Text )<<<<
>>>>( TitleMatchMode=slow Hidden Text )<<<<
---------------------------------------------------------------------
The Windows API has functions for installing hooks, but I don’t
know how to use them, nor do I know what window message to look
for.
Re: New email alert - may take a long time to notice
Maybe you can use the following links which is really for
developing software for the hearing impaired:Microsoft Active
Accessibility. Maybe Windows Live Mail can let you know when
there is new mail - through the Active Accessibility SDK - so
that you can show a window on the screen, just as you would have
to do for the hearing impaired - and a bit visually impaired too
if you can't see the small envelope tray icon turn yellow.
"Microsoft Active Accessibility is designed to help accessibility
aids, called clients, interact with standard and custom user
interface (UI) elements of other applications and the operating
system. An Active Accessibility client is any program that uses
Active Accessibility to access, identify, or manipulate the UI
elements of an application. Clients include accessibility aids,
automated testing tools, and some computer-based training
applications.
"Using Active Accessibility, a client application can:
"- Query for information for example, about a UI element at a
particular location.
"- Receive notifications when information changes for example,
when a control becomes grayed or when a text string changes."
When Windows Live Mail was running and receiving a new email, the
program AccEvent, from the Microsoft Active Accessibility SDK,
captured this:
Code:
OBJ_CREATE (hidden)
OBJ_CREATE (hidden)
OBJ_CREATE (hidden)
OBJ_NAMECHANGE (hidden)
OBJ_SHOW Name="Receiving e-mail..." Role=push button State=invisible
OBJ_STATECHANGE Name="Receiving e-mail..." Role=push button State=normal
OBJ_NAMECHANGE (hidden)
OBJ_HIDE Name="Receiving e-mail..." Role=push button State=normal
OBJ_STATECHANGE Name="Receiving e-mail..." Role=push button State=invisible
OBJ_NAMECHANGE (hidden)
OBJ_DESTROY (hidden)
OBJ_DESTROY (hidden)
OBJ_DESTROY (hidden)
OBJ_DESTROY (hidden)
OBJ_STATECHANGE (hidden)
OBJ_STATECHANGE (hidden)
OBJ_STATECHANGE (hidden)
OBJ_STATECHANGE (hidden)
OBJ_STATECHANGE (hidden)
OBJ_STATECHANGE (hidden)
OBJ_NAMECHANGE (hidden)
OBJ_SHOW Name="Receiving e-mail..." Role=push button State=invisible
OBJ_STATECHANGE Name="Receiving e-mail..." Role=push button State=normal
OBJ_NAMECHANGE Name="1 new messages" Role=push button State=normal
OBJ_HIDE Name="1 new messages" Role=push button State=normal
OBJ_STATECHANGE Name="1 new messages" Role=push button State=invisible
I know too little C++ to be able to use the following code (that I found here)
Code:
// Global variable.
HWINEVENTHOOK g_hook;
// Initializes COM and sets up the event hook.
//
void InitializeMSAA()
{
CoInitialize(NULL);
g_hook = SetWinEventHook(
EVENT_SYSTEM_MENUSTART, EVENT_SYSTEM_MENUEND, // Range of events (4 to 5).
NULL, // Handle to DLL.
NULL, // The callback.
0, 0, // Process and thread IDs of interest (0 = all)
WINEVENT_OUTOFCONTEXT | WINEVENT_SKIPOWNPROCESS); // Flags.
}
// Unhooks the event and shuts down COM.
//
void ShutdownMSAA()
{
UnhookWinEvent(g_hook);
CoUninitialize();
}
// Callback function that handles events.
//
void CALLBACK HandleWinEvent(HWINEVENTHOOK hook, DWORD event, HWND hwnd,
LONG idObject, LONG idChild,
DWORD dwEventThread, DWORD dwmsEventTime)
{
IAccessible* pAcc = NULL;
VARIANT varChild;
HRESULT hr = AccessibleObjectFromEvent(hwnd, idObject, idChild, &pAcc, &varChild);
if ((hr == S_OK) && (pAcc != NULL))
{
BSTR bstrName;
pAcc->get_accName(varChild, &bstrName);
if (event == EVENT_SYSTEM_MENUSTART)
{
//printf("Begin: ");
}
else if (event == EVENT_SYSTEM_MENUEND)
{
//printf("End: ");
}
//printf("%S\n", bstrName);
SysFreeString(bstrName);
pAcc->Release();
}
}