--- trunk/reactos/subsys/system/calc/winecalc.c 2005-08-26 20:35:33 UTC (rev 17563)
+++ trunk/reactos/subsys/system/calc/winecalc.c 2005-08-26 21:02:47 UTC (rev 17564)
@@ -22,6 +22,7 @@
#include <math.h>
#include <windows.h>
+#include <tchar.h>
// #include <commctrl.h>
#include "winecalc.h"
@@ -71,9 +72,9 @@
// various display error messages
-static char err_invalid [CALC_BUF_SIZE];
-static char err_divide_by_zero [CALC_BUF_SIZE];
-static char err_undefined [CALC_BUF_SIZE];
+static TCHAR err_invalid [CALC_BUF_SIZE];
+static TCHAR err_divide_by_zero [CALC_BUF_SIZE];
+static TCHAR err_undefined [CALC_BUF_SIZE];
// calculator state is kept here
@@ -105,7 +106,7 @@
static HMENU menus[3];
-static char appname[40];
+static TCHAR appname[40];
static int debug;
@@ -123,33 +124,45 @@
WNDCLASS wc;
HWND hWnd;
HACCEL haccel;
-
- char s[CALC_BUF_SIZE];
+#ifdef UNICODE
+ CHAR s_ansi[CALC_BUF_SIZE];
+#endif
+ TCHAR s[CALC_BUF_SIZE];
int r;
hInstance = hInst;
- r = GetProfileString("SciCalc",
- "layout",
- "0",
+ r = GetProfileString(TEXT("SciCalc"),
+ TEXT("layout"),
+ TEXT("0"),
s,
CALC_BUF_SIZE
);
+#ifdef UNICODE
+ wcstombs(s_ansi, s, sizeof(s_ansi));
+ calc.sciMode = atoi(s_ansi);
+#else
calc.sciMode = atoi(s);
+#endif
if (calc.sciMode != 0 &&
calc.sciMode != 1)
calc.sciMode = 1; // Standard Mode
- r = GetProfileString("SciCalc",
- "UseSep",
- "0",
+ r = GetProfileString(TEXT("SciCalc"),
+ TEXT("UseSep"),
+ TEXT("0"),
s,
CALC_BUF_SIZE
);
- calc.digitGrouping = atoi(s);
+#ifdef UNICODE
+ wcstombs(s_ansi, s, sizeof(s_ansi));
+ calc.digitGrouping = atoi(s_ansi);
+#else
+ calc.digitGrouping = atoi(s);
+#endif
if (calc.digitGrouping != 0 &&
calc.digitGrouping != 1)
@@ -157,13 +170,13 @@
calc.new = 1; // initialize struct values
- if (!LoadString( hInst, IDS_APPNAME, appname, sizeof(appname)))
+ if (!LoadString( hInst, IDS_APPNAME, appname, sizeof(appname) / sizeof(appname[0])))
exit(1);
- if (!LoadString( hInst, IDS_ERR_INVALID_INPUT, err_invalid, sizeof(err_invalid)))
+ if (!LoadString( hInst, IDS_ERR_INVALID_INPUT, err_invalid, sizeof(err_invalid) / sizeof(err_invalid[0])))
exit(1);
- if (!LoadString( hInst, IDS_ERR_DIVIDE_BY_ZERO, err_divide_by_zero, sizeof(err_divide_by_zero)))
+ if (!LoadString( hInst, IDS_ERR_DIVIDE_BY_ZERO, err_divide_by_zero, sizeof(err_divide_by_zero) / sizeof(err_divide_by_zero[0])))
exit(1);
- if (!LoadString( hInst, IDS_ERR_UNDEFINED, err_undefined, sizeof(err_undefined)))
+ if (!LoadString( hInst, IDS_ERR_UNDEFINED, err_undefined, sizeof(err_undefined) / sizeof(err_undefined[0])))
exit(1);
wc.style = CS_HREDRAW | CS_VREDRAW;
@@ -197,7 +210,7 @@
ShowWindow( hWnd, cmdshow );
UpdateWindow( hWnd );
- if (!(haccel = LoadAccelerators(hInst, "MAIN_MENU")))
+ if (!(haccel = LoadAccelerators(hInst, TEXT("MAIN_MENU"))))
exit(1);
while( GetMessage(&msg, NULL, 0, 0) ) {
@@ -259,13 +272,13 @@
case WM_DESTROY:
{
int r;
- char s[CALC_BUF_SIZE];
+ TCHAR s[CALC_BUF_SIZE];
- sprintf(s, "%d", calc.sciMode);
- r = WriteProfileString("SciCalc", "layout", s);
+ _stprintf(s, TEXT("%d"), calc.sciMode);
+ r = WriteProfileString(TEXT("SciCalc"), TEXT("layout"), s);
- sprintf(s, "%d", calc.digitGrouping);
- r = WriteProfileString("SciCalc", "UseSep", s);
+ _stprintf(s, TEXT("%d"), calc.digitGrouping);
+ r = WriteProfileString(TEXT("SciCalc"), TEXT("UseSep"), s);
}
DestroyCalc( &calc );
@@ -277,7 +290,7 @@
case VK_F1:
calc.next = 1;
- MessageBox(hWnd, "No Help Available", "Windows Help", MB_OK);
+ MessageBox(hWnd, TEXT("No Help Available"), TEXT("Windows Help"), MB_OK);
return 0;
case VK_F2: // DWORD
@@ -365,7 +378,7 @@
case VK_DELETE:
calc.next = 1;
- calc.buffer[0] = '\0';
+ calc.buffer[0] = TEXT('\0');
calc_buffer_display(&calc);
return 0;
@@ -377,11 +390,11 @@
case WM_CHAR:
if (debug)
- show_debug(&calc, "Start WM_CHAR", wParam, lParam);
+ show_debug(&calc, TEXT("Start WM_CHAR"), wParam, lParam);
switch (wParam) {
- case '\x13': // Ctrl+S Sta Statistics
+ case TEXT('\x13'): // Ctrl+S Sta Statistics
if (hWndDlgStats) { // Statistics Box already displayed, focus but don't create another one
// SetFocus(hWndDlgStats);
@@ -400,7 +413,7 @@
hWndDlgStats = CreateDialog( // modeless dialog
calc.hInst, // handle to application instance
- "DLG_STATS", // identifies dialog box template name
+ TEXT("DLG_STATS"), // identifies dialog box template name
hWnd, // handle to owner window
StatsDlgProc); // pointer to dialog box procedure
@@ -413,14 +426,14 @@
break;
- case '\x01': // Ctrl+A Ave Statistics
- case '\x04': // Ctrl+D s Standard Deviation Statistics
- case '\x14': // Ctrl+T Sum Statistics
+ case TEXT('\x01'): // Ctrl+A Ave Statistics
+ case TEXT('\x04'): // Ctrl+D s Standard Deviation Statistics
+ case TEXT('\x14'): // Ctrl+T Sum Statistics
{
int i;
int n;
- char s[CALC_BUF_SIZE];
+ TCHAR s[CALC_BUF_SIZE];
double val = 0L;
double avg = 0L;
double total = 0L;
@@ -438,10 +451,10 @@
x[i] = val;
}
- if (LOWORD(wParam) != '\x14') // not sum only
+ if (LOWORD(wParam) != TEXT('\x14')) // not sum only
avg = total / n;
- if (LOWORD(wParam == '\x04')) { // standard deviation is sqrt(sum( xbar - x )^2 / (n-1))
+ if (LOWORD(wParam == TEXT('\x04'))) { // standard deviation is sqrt(sum( xbar - x )^2 / (n-1))
val = 0L;
for (i=0;i<n;i++)
@@ -453,28 +466,28 @@
total = sqrt(val / (n - 1)); // sample of population
}
- if (LOWORD(wParam) == '\x01') // average or mean
+ if (LOWORD(wParam) == TEXT('\x01')) // average or mean
total = avg;
calc_ftoa(&calc, total, s);
- strcpy(calc.buffer, s);
+ _tcscpy(calc.buffer, s);
calc_buffer_display(&calc);
}
break;
- case '\x03': // Ctrl+C Copy
+ case TEXT('\x03'): // Ctrl+C Copy
{
int i;
int len;
- char *s;
+ TCHAR *s;
HGLOBAL hGlobalMemory;
PSTR pGlobalMemory;
- if (!(len = strlen(calc.display)))
+ if (!(len = _tcslen(calc.display)))
return 0;
- if (!(hGlobalMemory = GlobalAlloc(GHND, len + 1)))
+ if (!(hGlobalMemory = GlobalAlloc(GHND, (len + 1) * sizeof(TCHAR))))
return 0;
if (!(pGlobalMemory = GlobalLock(hGlobalMemory)))
@@ -502,15 +515,15 @@
}
break;
- case '\x16': // Ctrl+V Paste
+ case TEXT('\x16'): // Ctrl+V Paste
{
- char *s;
+ TCHAR *s;
int c;
int cmd = 0;
int size = 0;
int i = 0;
HGLOBAL hGlobalMemory;
- PSTR pGlobalMemory;
+ LPTSTR pGlobalMemory;
if (IsClipboardFormatAvailable(CF_TEXT)) {
if (!OpenClipboard(hWnd))
@@ -522,13 +535,13 @@
if (!(size = GlobalSize(hGlobalMemory)))
return 0;
- if (!(s = (char *)malloc(size)))
+ if (!(s = (TCHAR *)malloc(size)))
return 0;
if (!(pGlobalMemory = GlobalLock(hGlobalMemory)))
return 0;
- strcpy(s, pGlobalMemory);
+ _tcscpy(s, pGlobalMemory);
GlobalUnlock(hGlobalMemory);
@@ -548,11 +561,11 @@
// parse the pasted data, validate and SendMessage it one character at a time.
// it would appear wincalc does it this way (slow), although very slow appearing on Wine.
- while ((c = *s++) && (i++ < size)) {
- if (c == ':') {
+ while ((c = *s++) && (i++ < size / sizeof(TCHAR))) {
+ if (c == TEXT(':')) {
cmd = 1;
}
- else if (c == '\\') {
+ else if (c == TEXT('\\')) {
SendMessage(hWnd, WM_KEYDOWN, VK_INSERT, lParam);
}
else {
@@ -560,34 +573,34 @@
cmd = 0;
switch(c) {
- case 'c': // clear memory
+ case TEXT('c'): // clear memory
- case 'C':
+ case TEXT('C'):
SendMessage(hWnd, WM_CHAR, 0x0c, lParam);
break;
- case 'e': // enable scientific notation
+ case TEXT('e'): // enable scientific notation
- case 'E':
+ case TEXT('E'):
SendMessage(hWnd, WM_CHAR, 'v', lParam);
break;
- case 'm': // store display in memory
+ case TEXT('m'): // store display in memory
- case 'M':
+ case TEXT('M'):
SendMessage(hWnd, WM_CHAR, 0x0d, NUMBER_OF_THE_BEAST);
break;
- case 'p': // add display to memory
+ case TEXT('p'): // add display to memory
- case 'P':
+ case TEXT('P'):
SendMessage(hWnd, WM_CHAR, 0x10, lParam);
break;
- case 'q': // clear current calculation
+ case TEXT('q'): // clear current calculation
- case 'Q':
- SendMessage(hWnd, WM_CHAR, '\x1b', lParam);
+ case TEXT('Q'):
+ SendMessage(hWnd, WM_CHAR, TEXT('\x1b'), lParam);
break;
- case 'r': // read memory into display
+ case TEXT('r'): // read memory into display
- case 'R':
+ case TEXT('R'):
SendMessage(hWnd, WM_CHAR, 0x12, lParam);
break;
default: // just eat it but complain
@@ -598,32 +611,32 @@
}
else {
if ((calc.numBase == NBASE_HEX) &&
- ((c >= '0' && c <= '9') ||
- (c >= 'a' && c <= 'f') ||
- (c >= 'A' && c <= 'F'))) {
+ ((c >= TEXT('0') && c <= TEXT('9')) ||
+ (c >= TEXT('a') && c <= TEXT('f')) ||
+ (c >= TEXT('A') && c <= TEXT('F')))) {
SendMessage(hWnd, WM_CHAR, c, lParam);
}
else if ((calc.numBase == NBASE_DECIMAL) &&
- (c >= '0' && c <= '9')) {
+ (c >= TEXT('0') && c <= TEXT('9'))) {
SendMessage(hWnd, WM_CHAR, c, lParam);
}
else if ((calc.numBase == NBASE_OCTAL) &&
- (c >= '0' && c <= '7')) {
+ (c >= TEXT('0') && c <= TEXT('7'))) {
SendMessage(hWnd, WM_CHAR, c, lParam);
}
else if ((calc.numBase == NBASE_BINARY) &&
- (c == '0' || c == '1')) {
+ (c == TEXT('0') || c == TEXT('1'))) {
SendMessage(hWnd, WM_CHAR, c, lParam);
}
- else if (c == '.' || c == ',' ||
- c == 'e' || c == 'E' ||
- c == '+' || c == '-') {
+ else if (c == TEXT('.') || c == TEXT(',') ||
+ c == TEXT('e') || c == TEXT('E') ||
+ c == TEXT('+') || c == TEXT('-')) {
SendMessage(hWnd, WM_CHAR, c, lParam);
}
- else if (c == ' ' || // eat harmless trash here
- c == ';' ||
- c == ':') {
+ else if (c == TEXT(' ') || // eat harmless trash here
+ c == TEXT(';') ||
+ c == TEXT(':')) {
; // noop
}
else { // extra spicy trash gets noticed
@@ -650,11 +663,11 @@
switch(LOWORD(wParam)) {
case IDM_COPY:
- SendMessage(hWnd, WM_CHAR, '\x03', lParam);
+ SendMessage(hWnd, WM_CHAR, TEXT('\x03'), lParam);
return 0;
case IDM_PASTE:
- SendMessage(hWnd, WM_CHAR, '\x16', lParam);
+ SendMessage(hWnd, WM_CHAR, TEXT('\x16'), lParam);
return 0;
case IDM_MODE_STANDARD:
@@ -739,11 +752,11 @@
return 0;
case IDM_HELP_TOPICS:
- MessageBox(hWnd, "No Help Available", "Windows Help", MB_OK);
+ MessageBox(hWnd, TEXT("No Help Available"), TEXT("Windows Help"), MB_OK);
return 0;
case IDM_ABOUT:
- DialogBox( calc.hInst, "DLG_ABOUT", hWnd, AboutDlgProc );
+ DialogBox( calc.hInst, TEXT("DLG_ABOUT"), hWnd, AboutDlgProc );
return 0;
case ID_CALC_NS_HEX:
@@ -944,39 +957,39 @@
case ID_CALC_SEVEN:
case ID_CALC_EIGHT:
case ID_CALC_NINE:
- SendMessage(hWnd, WM_CHAR, LOWORD(wParam)+'0' , lParam);
+ SendMessage(hWnd, WM_CHAR, LOWORD(wParam)+TEXT('0') , lParam);
break;
case ID_CALC_A:
- SendMessage(hWnd, WM_CHAR, 'a', lParam);
+ SendMessage(hWnd, WM_CHAR, TEXT('a'), lParam);
break;
case ID_CALC_B:
- SendMessage(hWnd, WM_CHAR, 'b', lParam);
+ SendMessage(hWnd, WM_CHAR, TEXT('b'), lParam);
break;
case ID_CALC_C:
- SendMessage(hWnd, WM_CHAR, 'c', lParam);
+ SendMessage(hWnd, WM_CHAR, TEXT('c'), lParam);
break;
case ID_CALC_D:
- SendMessage(hWnd, WM_CHAR, 'd', lParam);
+ SendMessage(hWnd, WM_CHAR, TEXT('d'), lParam);
break;
case ID_CALC_E:
- SendMessage(hWnd, WM_CHAR, 'e', lParam);
+ SendMessage(hWnd, WM_CHAR, TEXT('e'), lParam);
break;
case ID_CALC_F:
- SendMessage(hWnd, WM_CHAR, 'f', lParam);
+ SendMessage(hWnd, WM_CHAR, TEXT('f'), lParam);
break;
case ID_CALC_DECIMAL:
- SendMessage(hWnd, WM_CHAR, '.', lParam);
+ SendMessage(hWnd, WM_CHAR, TEXT('.'), lParam);
break;
case ID_CALC_BACKSPACE:
- SendMessage(hWnd, WM_CHAR, '\b', lParam);
+ SendMessage(hWnd, WM_CHAR, TEXT('\b'), lParam);
break;
case ID_CALC_CLEAR_ENTRY:
@@ -984,7 +997,7 @@
break;
case ID_CALC_CLEAR_ALL:
- SendMessage(hWnd, WM_CHAR, '\x1b', lParam);
+ SendMessage(hWnd, WM_CHAR, TEXT('\x1b'), lParam);
break;
case ID_CALC_MEM_CLEAR:
@@ -1004,75 +1017,75 @@
break;
case ID_CALC_SQRT:
- SendMessage(hWnd, WM_CHAR, '?', lParam); // this is not a wincalc keystroke
+ SendMessage(hWnd, WM_CHAR, TEXT('?'), lParam); // this is not a wincalc keystroke
break;
case ID_CALC_SQUARE:
- SendMessage(hWnd, WM_CHAR, '@', lParam);
+ SendMessage(hWnd, WM_CHAR, TEXT('@'), lParam);
break;
case ID_CALC_PI:
- SendMessage(hWnd, WM_CHAR, 'p', lParam);
+ SendMessage(hWnd, WM_CHAR, TEXT('p'), lParam);
break;
case ID_CALC_LN:
- SendMessage(hWnd, WM_CHAR, 'n', lParam);
+ SendMessage(hWnd, WM_CHAR, TEXT('n'), lParam);
break;
case ID_CALC_LOG10:
- SendMessage(hWnd, WM_CHAR, 'l', lParam);
+ SendMessage(hWnd, WM_CHAR, TEXT('l'), lParam);
break;
case ID_CALC_CUBE:
- SendMessage(hWnd, WM_CHAR, '#', lParam);
+ SendMessage(hWnd, WM_CHAR, TEXT('#'), lParam);
break;
case ID_CALC_POWER:
- SendMessage(hWnd, WM_CHAR, 'y', lParam);
+ SendMessage(hWnd, WM_CHAR, TEXT('y'), lParam);
break;
case ID_CALC_SIN:
- SendMessage(hWnd, WM_CHAR, 's', lParam);
+ SendMessage(hWnd, WM_CHAR, TEXT('s'), lParam);
break;
case ID_CALC_COS:
- SendMessage(hWnd, WM_CHAR, 'o', lParam);
+ SendMessage(hWnd, WM_CHAR, TEXT('o'), lParam);
break;
case ID_CALC_TAN:
- SendMessage(hWnd, WM_CHAR, 't', lParam);
+ SendMessage(hWnd, WM_CHAR, TEXT('t'), lParam);
break;
case ID_CALC_LSH:
- SendMessage(hWnd, WM_CHAR, '<', lParam);
+ SendMessage(hWnd, WM_CHAR, TEXT('<'), lParam);
break;
case ID_CALC_NOT:
- SendMessage(hWnd, WM_CHAR, '~', lParam);
+ SendMessage(hWnd, WM_CHAR, TEXT('~'), lParam);
break;
case ID_CALC_AND:
- SendMessage(hWnd, WM_CHAR, '&', lParam);
+ SendMessage(hWnd, WM_CHAR, TEXT('&'), lParam);
break;
case ID_CALC_OR:
- SendMessage(hWnd, WM_CHAR, '|', lParam);
+ SendMessage(hWnd, WM_CHAR, TEXT('|'), lParam);
break;
case ID_CALC_XOR:
- SendMessage(hWnd, WM_CHAR, '^', lParam);
+ SendMessage(hWnd, WM_CHAR, TEXT('^'), lParam);
break;
case ID_CALC_INT:
- SendMessage(hWnd, WM_CHAR, ';', lParam);
+ SendMessage(hWnd, WM_CHAR, TEXT(';'), lParam);
break;
case ID_CALC_FACTORIAL:
- SendMessage(hWnd, WM_CHAR, '!', lParam);
+ SendMessage(hWnd, WM_CHAR, TEXT('!'), lParam);
break;
case ID_CALC_RECIPROCAL:
- SendMessage(hWnd, WM_CHAR, 'r', lParam);
+ SendMessage(hWnd, WM_CHAR, TEXT('r'), lParam);
break;
case ID_CALC_SIGN:
@@ -1080,47 +1093,47 @@
break;
case ID_CALC_PLUS:
- SendMessage(hWnd, WM_CHAR, '+', lParam);
+ SendMessage(hWnd, WM_CHAR, TEXT('+'), lParam);
break;
case ID_CALC_MINUS:
- SendMessage(hWnd, WM_CHAR, '-', lParam);
+ SendMessage(hWnd, WM_CHAR, TEXT('-'), lParam);
break;
case ID_CALC_MULTIPLY:
- SendMessage(hWnd, WM_CHAR, '*', lParam);
+ SendMessage(hWnd, WM_CHAR, TEXT('*'), lParam);
break;
case ID_CALC_DIVIDE:
- SendMessage(hWnd, WM_CHAR, '/', lParam);
+ SendMessage(hWnd, WM_CHAR, TEXT('/'), lParam);
break;
case ID_CALC_EQUALS:
- SendMessage(hWnd, WM_CHAR, '=', lParam);
+ SendMessage(hWnd, WM_CHAR, TEXT('='), lParam);
break;
case ID_CALC_PERCENT:
- SendMessage(hWnd, WM_CHAR, '%', lParam);
+ SendMessage(hWnd, WM_CHAR, TEXT('%'), lParam);
break;
case ID_CALC_EXP:
- SendMessage(hWnd, WM_CHAR, 'x', lParam);
+ SendMessage(hWnd, WM_CHAR, TEXT('x'), lParam);
break;
case ID_CALC_FE:
- SendMessage(hWnd, WM_CHAR, 'v', lParam);
+ SendMessage(hWnd, WM_CHAR, TEXT('v'), lParam);
break;
case ID_CALC_LEFTPAREN:
- SendMessage(hWnd, WM_CHAR, '(', lParam);
+ SendMessage(hWnd, WM_CHAR, TEXT('('), lParam);
break;
case ID_CALC_RIGHTPAREN:
- SendMessage(hWnd, WM_CHAR, ')', lParam);
+ SendMessage(hWnd, WM_CHAR, TEXT(')'), lParam);
break;
case ID_CALC_MOD:
- SendMessage(hWnd, WM_CHAR, '%', lParam);
+ SendMessage(hWnd, WM_CHAR, TEXT('%'), lParam);
break;
case ID_CALC_DAT:
@@ -1128,23 +1141,23 @@
break;
case ID_CALC_AVE:
- SendMessage(hWnd, WM_CHAR, '\x01', lParam); // Ctrl+A
+ SendMessage(hWnd, WM_CHAR, TEXT('\x01'), lParam); // Ctrl+A
break;
case ID_CALC_S:
- SendMessage(hWnd, WM_CHAR, '\x04', lParam); // Ctrl+D
+ SendMessage(hWnd, WM_CHAR, TEXT('\x04'), lParam); // Ctrl+D
break;
case ID_CALC_STA:
- SendMessage(hWnd, WM_CHAR, '\x13', lParam); // Ctrl+S
+ SendMessage(hWnd, WM_CHAR, TEXT('\x13'), lParam); // Ctrl+S
break;
case ID_CALC_SUM:
- SendMessage(hWnd, WM_CHAR, '\x14', lParam); // Ctrl+T
+ SendMessage(hWnd, WM_CHAR, TEXT('\x14'), lParam); // Ctrl+T
break;
case ID_CALC_DMS:
- SendMessage(hWnd, WM_CHAR, 'm', lParam);
+ SendMessage(hWnd, WM_CHAR, TEXT('m'), lParam);
break;
default:
@@ -1156,7 +1169,7 @@
SetFocus(hWnd);
if (debug)
- show_debug(&calc, "After WM_CHAR", wParam, lParam);
+ show_debug(&calc, TEXT("After WM_CHAR"), wParam, lParam);
return 0;
@@ -1172,33 +1185,33 @@
// initialize keys lut for validating keystrokes in various number bases
- for (i='0';i<='9';i++) {
+ for (i=TEXT('0');i<=TEXT('9');i++) {
keys[NBASE_HEX][i] = 1;
keys[NBASE_DECIMAL][i] = 1;
- if (i <= '7')
+ if (i <= TEXT('7'))
keys[NBASE_OCTAL][i] = 1;
- if (i <= '1')
+ if (i <= TEXT('1'))
keys[NBASE_BINARY][i] = 1;
}
- for (i='a';i<='f';i++)
+ for (i=TEXT('a');i<=TEXT('f');i++)
keys[NBASE_HEX][i] = 1;
- for (i='A';i<='F';i++)
+ for (i=TEXT('A');i<=TEXT('F');i++)
keys[NBASE_HEX][i] = 1;
}
void InitMenus(HINSTANCE hInst)
{
- if (!(menus[MENU_STD] = LoadMenu(hInst,"MAIN_MENU")))
+ if (!(menus[MENU_STD] = LoadMenu(hInst,TEXT("MAIN_MENU"))))
exit(1);
- if (!(menus[MENU_SCIMS] = LoadMenu(hInst,"SCIMS_MENU")))
+ if (!(menus[MENU_SCIMS] = LoadMenu(hInst,TEXT("SCIMS_MENU"))))
exit(1);
- if (!(menus[MENU_SCIWS] = LoadMenu(hInst,"SCIWS_MENU")))
+ if (!(menus[MENU_SCIWS] = LoadMenu(hInst,TEXT("SCIWS_MENU"))))
exit(1);
CheckMenuItem(menus[MENU_STD], IDM_MODE_STANDARD, MF_CHECKED);
@@ -1264,11 +1277,11 @@
calc->value = 0;
calc->memory = 0;
calc->displayMode = 0;
- calc->buffer[0] = '\0';
- strcpy(calc->display, "0.");
+ calc->buffer[0] = TEXT('\0');
+ _tcscpy(calc->display, TEXT("0."));
calc->err = 0;
- calc->next = '\0';
+ calc->next = TEXT('\0');
calc->wordSize = WORDSIZE_QWORD;
calc->invMode = 0;
@@ -1284,7 +1297,7 @@
skipy = CALC_STANDARD_MARGIN_TOP + CALC_EDIT_HEIGHT;
calc->cb[0].id = 0;
- strcpy(calc->cb[0].label,"FILLER");
+ _tcscpy(calc->cb[0].label,TEXT("FILLER"));
calc->cb[0].color = CALC_COLOR_BLUE;
calc->cb[0].r.left = skipx + 4;
calc->cb[0].r.top = skipy + 2;
@@ -1295,7 +1308,7 @@
skipx = SZ_FILLER_X + MARGIN_STANDARD_BIG_X + 11;
calc->cb[1].id = ID_CALC_BACKSPACE;
- LoadString( hInst, IDS_BTN_BACKSPACE, calc->cb[1].label, sizeof(calc->cb[1].label));
+ LoadString( hInst, IDS_BTN_BACKSPACE, calc->cb[1].label, sizeof(calc->cb[1].label) / sizeof(calc->cb[1].label[0]));
calc->cb[1].color = CALC_COLOR_RED;
calc->cb[1].r.left = skipx;
calc->cb[1].r.top = skipy;
@@ -1306,7 +1319,7 @@
skipx += SZ_BIGBTN_X + MARGIN_SMALL_X;
calc->cb[2].id = ID_CALC_CLEAR_ENTRY;
- LoadString( hInst, IDS_BTN_CLEAR_ENTRY, calc->cb[2].label, sizeof(calc->cb[2].label));
+ LoadString( hInst, IDS_BTN_CLEAR_ENTRY, calc->cb[2].label, sizeof(calc->cb[2].label) / sizeof(calc->cb[2].label[0]));
calc->cb[2].color = CALC_COLOR_RED;
calc->cb[2].r.left = skipx;
calc->cb[2].r.top = skipy;
@@ -1317,7 +1330,7 @@
skipx += SZ_BIGBTN_X + MARGIN_SMALL_X;
calc->cb[3].id = ID_CALC_CLEAR_ALL;
- LoadString( hInst, IDS_BTN_CLEAR_ALL, calc->cb[3].label, sizeof(calc->cb[3].label));
+ LoadString( hInst, IDS_BTN_CLEAR_ALL, calc->cb[3].label, sizeof(calc->cb[3].label) / sizeof(calc->cb[3].label[0]));
calc->cb[3].color = CALC_COLOR_RED;
calc->cb[3].r.left = skipx;
calc->cb[3].r.top = skipy;
@@ -1331,7 +1344,7 @@
skipy += SZ_BIGBTN_Y + MARGIN_BIG_Y;
calc->cb[4].id = ID_CALC_MEM_CLEAR;
- LoadString( hInst, IDS_BTN_MEM_CLEAR, calc->cb[4].label, sizeof(calc->cb[4].label));
+ LoadString( hInst, IDS_BTN_MEM_CLEAR, calc->cb[4].label, sizeof(calc->cb[4].label) / sizeof(calc->cb[4].label[0]));
calc->cb[4].color = CALC_COLOR_RED;
calc->cb[4].r.left = skipx;
calc->cb[4].r.top = skipy;
@@ -1342,7 +1355,7 @@
skipx += SZ_MEDBTN_X + MARGIN_STANDARD_BIG_X;
calc->cb[5].id = ID_CALC_SEVEN;
- strcpy(calc->cb[5].label,"7");
+ _tcscpy(calc->cb[5].label,TEXT("7"));
calc->cb[5].color = CALC_COLOR_BLUE;
calc->cb[5].r.left = skipx;
calc->cb[5].r.top = skipy;
@@ -1353,7 +1366,7 @@
skipx += SZ_MEDBTN_X + MARGIN_SMALL_X;
calc->cb[6].id = ID_CALC_EIGHT;
- strcpy(calc->cb[6].label,"8");
+ _tcscpy(calc->cb[6].label,TEXT("8"));
calc->cb[6].color = CALC_COLOR_BLUE;
calc->cb[6].r.left = skipx;
calc->cb[6].r.top = skipy;
@@ -1364,7 +1377,7 @@
skipx += SZ_MEDBTN_X + MARGIN_SMALL_X;
calc->cb[7].id = ID_CALC_NINE;
- strcpy(calc->cb[7].label,"9");
+ _tcscpy(calc->cb[7].label,TEXT("9"));
calc->cb[7].color = CALC_COLOR_BLUE;
calc->cb[7].r.left = skipx;
calc->cb[7].r.top = skipy;
@@ -1375,7 +1388,7 @@
skipx += SZ_MEDBTN_X + MARGIN_SMALL_X;
calc->cb[8].id = ID_CALC_DIVIDE;
- strcpy(calc->cb[8].label,"/");
+ _tcscpy(calc->cb[8].label,TEXT("/"));
calc->cb[8].color = CALC_COLOR_RED;
calc->cb[8].r.left = skipx;
calc->cb[8].r.top = skipy;
@@ -1386,7 +1399,7 @@
skipx += SZ_MEDBTN_X + MARGIN_SMALL_X;
calc->cb[9].id = ID_CALC_SQRT;
- LoadString( hInst, IDS_BTN_SQRT, calc->cb[9].label, sizeof(calc->cb[9].label));
+ LoadString( hInst, IDS_BTN_SQRT, calc->cb[9].label, sizeof(calc->cb[9].label) / sizeof(calc->cb[9].label[0]));
calc->cb[9].color = CALC_COLOR_BLUE;
calc->cb[9].r.left = skipx;
calc->cb[9].r.top = skipy;
@@ -1400,7 +1413,7 @@
skipy += SZ_MEDBTN_Y + MARGIN_SMALL_Y;
calc->cb[10].id = ID_CALC_MEM_RECALL;
- LoadString( hInst, IDS_BTN_MEM_RECALL, calc->cb[10].label, sizeof(calc->cb[10].label));
+ LoadString( hInst, IDS_BTN_MEM_RECALL, calc->cb[10].label, sizeof(calc->cb[10].label) / sizeof(calc->cb[10].label[0]));
calc->cb[10].color = CALC_COLOR_RED;
calc->cb[10].r.left = skipx;
calc->cb[10].r.top = skipy;
@@ -1411,7 +1424,7 @@
skipx += SZ_MEDBTN_X + MARGIN_STANDARD_BIG_X;
calc->cb[11].id = ID_CALC_FOUR;
- strcpy(calc->cb[11].label,"4");
+ _tcscpy(calc->cb[11].label,TEXT("4"));
calc->cb[11].color = CALC_COLOR_BLUE;
calc->cb[11].r.left = skipx;
calc->cb[11].r.top = skipy;
@@ -1422,7 +1435,7 @@
skipx += SZ_MEDBTN_X + MARGIN_SMALL_X;
calc->cb[12].id = ID_CALC_FIVE;
- strcpy(calc->cb[12].label,"5");
+ _tcscpy(calc->cb[12].label,TEXT("5"));
calc->cb[12].color = CALC_COLOR_BLUE;
calc->cb[12].r.left = skipx;
calc->cb[12].r.top = skipy;
@@ -1433,7 +1446,7 @@
skipx += SZ_MEDBTN_X + MARGIN_SMALL_X;
calc->cb[13].id = ID_CALC_SIX;
- strcpy(calc->cb[13].label,"6");
+ _tcscpy(calc->cb[13].label,TEXT("6"));
calc->cb[13].color = CALC_COLOR_BLUE;
calc->cb[13].r.left = skipx;
calc->cb[13].r.top = skipy;
@@ -1444,7 +1457,7 @@
skipx += SZ_MEDBTN_X + MARGIN_SMALL_X;
calc->cb[14].id = ID_CALC_MULTIPLY;
- strcpy(calc->cb[14].label,"*");
+ _tcscpy(calc->cb[14].label,TEXT("*"));
calc->cb[14].color = CALC_COLOR_RED;
calc->cb[14].r.left = skipx;
calc->cb[14].r.top = skipy;
@@ -1455,7 +1468,7 @@
skipx += SZ_MEDBTN_X + MARGIN_SMALL_X;
calc->cb[15].id = ID_CALC_PERCENT;
- strcpy(calc->cb[15].label,"%");
+ _tcscpy(calc->cb[15].label,TEXT("%"));
calc->cb[15].color = CALC_COLOR_BLUE;
calc->cb[15].r.left = skipx;
calc->cb[15].r.top = skipy;
@@ -1469,7 +1482,7 @@
skipy += SZ_MEDBTN_Y + MARGIN_SMALL_Y;
calc->cb[16].id = ID_CALC_MEM_STORE;
- LoadString( hInst, IDS_BTN_MEM_STORE, calc->cb[16].label, sizeof(calc->cb[16].label));
+ LoadString( hInst, IDS_BTN_MEM_STORE, calc->cb[16].label, sizeof(calc->cb[16].label) / sizeof(calc->cb[16].label[0]));
calc->cb[16].color = CALC_COLOR_RED;
[truncated at 1000 lines; 1910 more skipped]