Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
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…
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.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

867 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

22 Experts available now in Live!

Get 1:1 Help Now