Solved

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

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

830 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