|
|
| version 1.5, 2005/02/07 15:39:27 | version 1.8, 2005/03/20 13:12:50 |
|---|---|
| Line 10 | Line 10 |
| #include "calendar.h" | #include "calendar.h" |
| #if !defined(OSLANG_UTF8) | |
| #define tchar_2x str_2x | |
| #define tchar_2d str_2d | |
| #else | |
| static const TCHAR tchar_2x[] = _T("%.2x"); | |
| static const TCHAR tchar_2d[] = _T("%.2d"); | |
| #endif | |
| static UINT8 cbuf[8]; | static UINT8 cbuf[8]; |
| typedef struct { | typedef struct { |
| Line 33 static void set_cal2dlg(HWND hWnd, const | Line 42 static void set_cal2dlg(HWND hWnd, const |
| for (i=0; i<6; i++) { | for (i=0; i<6; i++) { |
| if (i != 1) { | if (i != 1) { |
| wsprintf(work, str_2x, cbuf[i]); | wsprintf(work, tchar_2x, cbuf[i]); |
| } | } |
| else { | else { |
| wsprintf(work, str_2d, cbuf[1] >> 4); | wsprintf(work, tchar_2d, cbuf[1] >> 4); |
| } | } |
| SetDlgItemText(hWnd, vircal[i].res, work); | SetDlgItemText(hWnd, vircal[i].res, work); |
| } | } |
| Line 52 static void vircalendar(HWND hWnd, BOOL | Line 61 static void vircalendar(HWND hWnd, BOOL |
| EnableWindow(GetDlgItem(hWnd, IDC_SETNOW), disp); | EnableWindow(GetDlgItem(hWnd, IDC_SETNOW), disp); |
| } | } |
| static UINT32 getbcd(char *str, int len) { | static UINT8 getbcd(const TCHAR *str, int len) { |
| UINT32 ret; | UINT ret; |
| UINT8 c; | TCHAR c; |
| if (!(*str)) { | |
| return(0xff); | |
| } | |
| ret = 0; | ret = 0; |
| while(len--) { | while(len--) { |
| c = *str++; | c = *str++; |
| Line 70 static UINT32 getbcd(char *str, int len) | Line 76 static UINT32 getbcd(char *str, int len) |
| return(0xff); | return(0xff); |
| } | } |
| ret <<= 4; | ret <<= 4; |
| ret |= (UINT8)(c - '0'); | ret |= (UINT)(c - '0'); |
| } | } |
| return(ret); | return((UINT8)ret); |
| } | } |
| LRESULT CALLBACK ClndDialogProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) { | LRESULT CALLBACK ClndDialogProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) { |
| char work[32]; | TCHAR work[32]; |
| UINT8 b; | UINT8 b; |
| int i; | int i; |
| HWND subwnd; | HWND subwnd; |
| Line 109 LRESULT CALLBACK ClndDialogProc(HWND hWn | Line 115 LRESULT CALLBACK ClndDialogProc(HWND hWn |
| } | } |
| for (i=0; i<6; i++) { | for (i=0; i<6; i++) { |
| GetDlgItemText(hWnd, vircal[i].res, | GetDlgItemText(hWnd, vircal[i].res, |
| work, sizeof(work)); | work, NELEMENTS(work)); |
| b = (UINT8)getbcd(work, 2); | b = getbcd(work, 2); |
| if ((b >= vircal[i].min) && (b <= vircal[i].max)) { | if ((b >= vircal[i].min) && (b <= vircal[i].max)) { |
| if (i == 1) { | if (i == 1) { |
| b = ((b & 0x10) * 10) + (b << 4); | b = ((b & 0x10) * 10) + (b << 4); |