Solved

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

Posted on 2000-02-16
2
260 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

707 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now