ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

systray.cpp
Go to the documentation of this file.
00001 /*
00002  * Copyright 2004 Martin Fuchs
00003  *
00004  * Pass on icon notification messages to the systray implementation
00005  * in the currently running shell.
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this library; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00020  */
00021 
00022 #include <precomp.h>
00023 
00024 /* copy data structure for tray notifications */
00025 typedef struct TrayNotifyCDS_Dummy {
00026     DWORD    cookie;
00027     DWORD    notify_code;
00028     DWORD    nicon_data[1];    // placeholder for NOTIFYICONDATA structure
00029 } TrayNotifyCDS_Dummy;
00030 
00031 /* The only difference between Shell_NotifyIconA and Shell_NotifyIconW is the call to SendMessageA/W. */
00032 static BOOL SHELL_NotifyIcon(DWORD dwMessage, void* pnid, HWND nid_hwnd, int nid_size, BOOL unicode)
00033 {
00034     HWND hwnd;
00035     COPYDATASTRUCT data;
00036 
00037     BOOL ret = FALSE;
00038     int len = sizeof(TrayNotifyCDS_Dummy) - sizeof(DWORD) + nid_size;
00039 
00040     TrayNotifyCDS_Dummy* pnotify_data = (TrayNotifyCDS_Dummy*) alloca(len);
00041 
00042     pnotify_data->cookie = 1;
00043     pnotify_data->notify_code = dwMessage;
00044     memcpy(&pnotify_data->nicon_data, pnid, nid_size);
00045 
00046     data.dwData = 1;
00047     data.cbData = len;
00048     data.lpData = pnotify_data;
00049 
00050     for(hwnd = 0; (hwnd = FindWindowExW(0, hwnd, L"Shell_TrayWnd", NULL)); )
00051         if ((unicode ? SendMessageW : SendMessageA)(hwnd, WM_COPYDATA, (WPARAM)nid_hwnd, (LPARAM)&data))
00052             ret = TRUE;
00053 
00054     return ret;
00055 }
00056 
00057 
00058 /*************************************************************************
00059  * Shell_NotifyIcon            [SHELL32.296]
00060  * Shell_NotifyIconA            [SHELL32.297]
00061  */
00062 BOOL WINAPI Shell_NotifyIconA(DWORD dwMessage, PNOTIFYICONDATAA pnid)
00063 {
00064     return SHELL_NotifyIcon(dwMessage, pnid, pnid->hWnd, pnid->cbSize, FALSE);
00065 }
00066 
00067 /*************************************************************************
00068  * Shell_NotifyIconW            [SHELL32.298]
00069  */
00070 BOOL WINAPI Shell_NotifyIconW(DWORD dwMessage, PNOTIFYICONDATAW pnid)
00071 {
00072     return SHELL_NotifyIcon(dwMessage, pnid, pnid->hWnd, pnid->cbSize, TRUE);
00073 }

Generated on Sun May 27 2012 04:26:31 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.