fixed code to compile both as ansi and unicode version, build as unicode by default
[reactos.git] / reactos / subsys / system / calc / stats.c
index cb6cb60..8750577 100644 (file)
@@ -21,6 +21,7 @@
 #include <stdio.h> // sprintf
 
 #include <windows.h>
+#include <tchar.h>
 
 #include "stats.h"
 #include "resource.h"
@@ -41,8 +42,8 @@ BOOL CALLBACK StatsDlgProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
 
     case WM_INITDIALOG:
         hWndListBox = CreateWindow(
-            "LISTBOX", // pointer to registered class name
-            "Listbox", // pointer to window name
+            TEXT("LISTBOX"),   // pointer to registered class name
+            TEXT("Listbox"),   // pointer to window name
             WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_BORDER | LBS_NOINTEGRALHEIGHT,     // window style
                     6, // horizontal position of window
                     6, // vertical position of window
@@ -100,7 +101,7 @@ BOOL CALLBACK StatsDlgProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
 
     case WM_PAINT:
       {
-        char s[CALC_BUF_SIZE];
+        TCHAR s[CALC_BUF_SIZE];
         int lb_count;
         HFONT hFont;
         HFONT hFontOrg;
@@ -110,10 +111,10 @@ BOOL CALLBACK StatsDlgProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
         hFontOrg = SelectObject(hdc, hFont);
 
         lb_count = SendMessage(hWndListBox, LB_GETCOUNT, 0, 0);
-        sprintf(s, "n=%d", lb_count);
+        _stprintf(s, TEXT("n=%d"), lb_count);
 
         SetBkMode(hdc, TRANSPARENT);
-        TextOut(hdc, 98, 121, s, strlen(s));
+        TextOut(hdc, 98, 121, s, _tcslen(s));
         SelectObject(hdc, hFontOrg);
         EndPaint( hDlg, &ps );
 
@@ -121,7 +122,7 @@ BOOL CALLBACK StatsDlgProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
       }
        case WM_CLOSE:
         hWndDlgStats = 0;                                 // invalidate stats dialog
-        SendMessage(GetParent(hDlg), WM_CHAR, '\x13', 1); // disable stats related calculator buttons
+        SendMessage(GetParent(hDlg), WM_CHAR, TEXT('\x13'), 1); // disable stats related calculator buttons
         DestroyWindow( hDlg );
 
         return 0;