Solved

Getting system tray's Mouse Move event....

Posted on 2000-02-16
2
263 Views
Last Modified: 2013-11-20
I saw a program once, that changed its system tray icon (the tray beside the clock... not the big icons on the task bar) whenever you moved your mouse ontop of it.   Now,  I know this isnt the same as a button mouse move, or a window mouse move event.. so does anyone know how to do this?

Please provide a link to a project,  an example,  or step by step on what to do.

Thanks!
0
Comment
Question by:Nitro187
2 Comments
 
LVL 1

Accepted Solution

by:
jianliuer earned 100 total points
ID: 2529727
Hi,Nitro187.
I have done the job before.I paste some codes here and hope it helpful.

Create a project named Test.

1.Add member varible         NOTIFYICONDATA m_tnd_Play;
and  
#define WM_STARTRECORD      (WM_USER+100)
in the test.h.

2.Add some codes in your InitInstance() function in the implementation file test.cpp
..
.....InitInstance()
{
.....
   m_pMainWnd->ShowWindow(SW_SHOW);
   m_pMainWnd->UpdateWindow();
....
///add codes here
   HICON hIcon=LoadIcon(IDI_ICON1);
   CWnd* pWnd= AfxGetMainWnd();
   m_tnd_Play.cbSize      = sizeof(NOTIFYICONDATA);
   m_tnd_Play.hWnd = pWnd->m_hWnd;
   m_tnd_Play.uID = 10;
   m_tnd_Play.uFlags = NIF_MESSAGE|NIF_ICON|NIF_TIP;
   m_tnd_Play.uCallbackMessage= WM_STARTRECORD;
   m_tnd_Play.hIcon = hIcon;
   strcpy(m_tnd_Record1.szTip,"Playing");
if (hIcon)
    {
       DestroyIcon(hIcon);
    }
   Shell_NotifyIcon(NIM_ADD, &m_tnd_Play);
}

3.Implementation in Mainfrm.cpp; CMainFrame::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
      if(message==WM_STARTRECORD)
      {
            switch(lParam)
            {
            case WM_LBUTTONDOWN:
                  break;
            case WM_RBUTTONDOWN:
                  break;
            case WM_MOUSEMOVE:
//////////////////////you can modify the icon here.
                  break;
            }
      }
      return CFrameWnd::DefWindowProc(message, wParam, lParam);

}

BOOL CMainFrame::DestroyWindow()
{
      CScreenCaptureApp* pApp=(CTestApp*)AfxGetApp();
      Shell_NotifyIcon(NIM_DELETE, &(pApp->m_tnd_Play));
      return CFrameWnd::DestroyWindow();
}

If there is any questions,please Email me jianliuer@sina.com.

Good Luck!

0
 

Author Comment

by:Nitro187
ID: 2529829
It works great!  Thanks a lot!
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
repeateFront java challenge 31 93
how to monitor remote shell execution on linux 9 100
isEverywhere  challenge 19 77
has77  challenge 9 85
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question