Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2000-02-16
2
Medium Priority
?
276 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 400 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

927 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