Vladimir Pankratov : taskmgr: Converted some functions to Unicode.

Alexandre Julliard julliard at winehq.org
Fri Aug 1 05:33:49 CDT 2008


Module: wine
Branch: master
Commit: 992d0043822454a290139409bbe4a9cd222eed7d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=992d0043822454a290139409bbe4a9cd222eed7d

Author: Vladimir Pankratov <scriptkid at mail.ru>
Date:   Fri Aug  1 12:18:25 2008 +0500

taskmgr: Converted some functions to Unicode.

---

 programs/taskmgr/trayicon.c |   36 +++++++++++++++++++-----------------
 1 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/programs/taskmgr/trayicon.c b/programs/taskmgr/trayicon.c
index e088f3f..25a5121 100644
--- a/programs/taskmgr/trayicon.c
+++ b/programs/taskmgr/trayicon.c
@@ -26,13 +26,13 @@
 #include <stdlib.h>
 #include <malloc.h>
 #include <memory.h>
-#include <tchar.h>
 #include <stdio.h>
 #include <winnt.h>
-    
+#include <shellapi.h>
+
+#include "wine/unicode.h"
 #include "taskmgr.h"
 #include "perfdata.h"
-#include "shellapi.h"
 
 HICON TrayIcon_GetProcessorUsageIcon(void)
 {
@@ -140,23 +140,24 @@ done:
 
 BOOL TrayIcon_ShellAddTrayIcon(void)
 {
-    NOTIFYICONDATA    nid;
+    NOTIFYICONDATAW    nid;
     HICON            hIcon = NULL;
     BOOL            bRetVal;
+    WCHAR           wszCPU_Usage[] = {'C','P','U',' ','U','s','a','g','e',':',' ','%','d','%','%',0};
 
-    memset(&nid, 0, sizeof(NOTIFYICONDATA));
+    memset(&nid, 0, sizeof(NOTIFYICONDATAW));
 
     hIcon = TrayIcon_GetProcessorUsageIcon();
 
-    nid.cbSize = sizeof(NOTIFYICONDATA);
+    nid.cbSize = sizeof(NOTIFYICONDATAW);
     nid.hWnd = hMainWnd;
     nid.uID = 0;
     nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
     nid.uCallbackMessage = WM_ONTRAYICON;
     nid.hIcon = hIcon;
-    wsprintf(nid.szTip, _T("CPU Usage: %d%%"), PerfDataGetProcessorUsage());
+    wsprintfW(nid.szTip, wszCPU_Usage, PerfDataGetProcessorUsage());
 
-    bRetVal = Shell_NotifyIcon(NIM_ADD, &nid);
+    bRetVal = Shell_NotifyIconW(NIM_ADD, &nid);
 
     if (hIcon)
         DestroyIcon(hIcon);
@@ -166,41 +167,42 @@ BOOL TrayIcon_ShellAddTrayIcon(void)
 
 BOOL TrayIcon_ShellRemoveTrayIcon(void)
 {
-    NOTIFYICONDATA    nid;
+    NOTIFYICONDATAW    nid;
     BOOL            bRetVal;
     
-    memset(&nid, 0, sizeof(NOTIFYICONDATA));
+    memset(&nid, 0, sizeof(NOTIFYICONDATAW));
     
-    nid.cbSize = sizeof(NOTIFYICONDATA);
+    nid.cbSize = sizeof(NOTIFYICONDATAW);
     nid.hWnd = hMainWnd;
     nid.uID = 0;
     nid.uFlags = 0;
     nid.uCallbackMessage = WM_ONTRAYICON;
     
-    bRetVal = Shell_NotifyIcon(NIM_DELETE, &nid);
+    bRetVal = Shell_NotifyIconW(NIM_DELETE, &nid);
     
     return bRetVal;
 }
 
 BOOL TrayIcon_ShellUpdateTrayIcon(void)
 {
-    NOTIFYICONDATA    nid;
+    NOTIFYICONDATAW    nid;
     HICON            hIcon = NULL;
     BOOL            bRetVal;
+    WCHAR           wszCPU_Usage[] = {'C','P','U',' ','U','s','a','g','e',':',' ','%','d','%','%',0};
     
-    memset(&nid, 0, sizeof(NOTIFYICONDATA));
+    memset(&nid, 0, sizeof(NOTIFYICONDATAW));
     
     hIcon = TrayIcon_GetProcessorUsageIcon();
     
-    nid.cbSize = sizeof(NOTIFYICONDATA);
+    nid.cbSize = sizeof(NOTIFYICONDATAW);
     nid.hWnd = hMainWnd;
     nid.uID = 0;
     nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
     nid.uCallbackMessage = WM_ONTRAYICON;
     nid.hIcon = hIcon;
-    wsprintf(nid.szTip, _T("CPU Usage: %d%%"), PerfDataGetProcessorUsage());
+    wsprintfW(nid.szTip, wszCPU_Usage, PerfDataGetProcessorUsage());
     
-    bRetVal = Shell_NotifyIcon(NIM_MODIFY, &nid);
+    bRetVal = Shell_NotifyIconW(NIM_MODIFY, &nid);
     
     if (hIcon)
         DestroyIcon(hIcon);




More information about the wine-cvs mailing list