diff --git a/BuildMenu/BuildMenu.cpp b/BuildMenu/BuildMenu.cpp index 031293b..c0836cc 100644 --- a/BuildMenu/BuildMenu.cpp +++ b/BuildMenu/BuildMenu.cpp @@ -12,9 +12,9 @@ static char THIS_FILE[] = __FILE__; #endif -/* Menu 和 Command Item的結構 +/* Menu M Command Itemc -檔案內部儲存方式: +ɮפxs覡: WORD MAIN_ITEM_COUNT CMDITEM ITEMS[TOTAL_COUNT] DWORD ACCELCOUNT @@ -22,16 +22,16 @@ ACCEL ACC_ITEMS[ACCELCOUNT] struct CMDITEM { - BYTE TYPE, CT_MENU,CT_HAS_SUB,CT_CMD,如果TYPE=0則為Separator,後面幾項都沒有 - WORD ID_OR_SUBCOUNT 如果有CT_HAS_SUB,為SUBCOUNT,如果沒有則為ID - WORD state 只有Menu才有此項目 - WORD LEN TEXT的長度,含0 - CHAR TEXT[] 長度不定,0結尾 + BYTE TYPE, CT_MENU,CT_HAS_SUB,CT_CMD,pGTYPE=0hSeparatorA᭱XS + WORD ID_OR_SUBCOUNT pGCT_HAS_SUB,SUBCOUNT,pGShID + WORD state uMenu~ + WORD LEN TEXT,t0 + CHAR TEXT[] פw,0 } */ -// 用來產生UI檔的程式碼 +// ΨӲUIɪ{X void UIWriteMenu(CBuffer& ui, HMENU hmenu, char* text, WORD state) { CMenu menu; menu.Attach(hmenu); @@ -80,7 +80,7 @@ void UIWriteMenu(CBuffer& ui, HMENU hmenu, char* text, WORD state) std::unique_ptr BuildUIBuffer() { -// 用來產生UI檔的程式碼 +// ΨӲUIɪ{X std::unique_ptr ui(new CBuffer()); // MessageBox( NULL, OutPath, NULL, MB_OK ); diff --git a/Lite/AES.cpp b/Lite/AES.cpp index 792f09f..bad4120 100644 --- a/Lite/AES.cpp +++ b/Lite/AES.cpp @@ -24,8 +24,8 @@ CAES::~CAES() } - -void CAES::EnterPassword(CString passwd) +// ANSI hack, CStringA +void CAES::EnterPassword(CStringA passwd) { int len = (passwd.GetLength() / 16 + (passwd.GetLength() % 16 ? 1 : 0)) * 16; char pad[32]; diff --git a/Lite/AES.h b/Lite/AES.h index caa2d0c..1730eb1 100644 --- a/Lite/AES.h +++ b/Lite/AES.h @@ -15,7 +15,8 @@ class CAES : public CRijndael { public: - void EnterPassword(CString passwd); + // ANSI hack, CStringA + void EnterPassword(CStringA passwd); inline BOOL IsInitialized(){ return m_bInit; } CAES(); virtual ~CAES(); diff --git a/Lite/AddressDlg.cpp b/Lite/AddressDlg.cpp index 653634e..65c0fa4 100644 --- a/Lite/AddressDlg.cpp +++ b/Lite/AddressDlg.cpp @@ -34,7 +34,7 @@ CString CAddressDlg::GetFormattedAddress() const if (port == 23 || port <= 0) return address; CString buf; - buf.Format("%s:%d", LPCTSTR(address), port); + buf.Format(TEXT("%s:%d"), LPCTSTR(address), port); return buf; } @@ -52,7 +52,7 @@ BOOL CAddressDlg::OnInitDialog() { CComboBox* combo = (CComboBox*)GetDlgItem(IDC_ADDRESS); combo->SetWindowText(address); - GetDlgItem(IDC_PORT)->SetWindowText("23"); + GetDlgItem(IDC_PORT)->SetWindowText(TEXT("23")); POSITION pos = AppConfig.history.GetHeadPosition(); CString str; @@ -108,7 +108,7 @@ void CAddressDlg::OnAddressChanged() if (addr.IsValid()) { CString port_text; - port_text.Format("%d", addr.Port()); + port_text.Format(TEXT("%d"), addr.Port()); port_field->SetWindowText(port_text); } -} \ No newline at end of file +} diff --git a/Lite/AnsiBar.cpp b/Lite/AnsiBar.cpp index f9b3507..b1ba254 100644 --- a/Lite/AnsiBar.cpp +++ b/Lite/AnsiBar.cpp @@ -45,7 +45,7 @@ void CAnsiBar::OnBk() mnu.CreatePopupMenu(); for (int i = 10;i < 18;i++) { - mnu.AppendMenu(MF_OWNERDRAW, i, ""); + mnu.AppendMenu(MF_OWNERDRAW, i, TEXT("")); } CRect rc; ::GetWindowRect(::GetDlgItem(m_hWnd, IDC_ANSIBAR_BK), rc); @@ -67,7 +67,7 @@ void CAnsiBar::OnFg() mnu.CreatePopupMenu(); for (int i = 10;i < 26;i++) { - mnu.AppendMenu(MF_OWNERDRAW, i, ""); + mnu.AppendMenu(MF_OWNERDRAW, i, TEXT("")); } CRect rc; ::GetWindowRect(::GetDlgItem(m_hWnd, IDC_ANSIBAR_FG), rc); @@ -108,7 +108,7 @@ void CAnsiBar::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct) if (GetRValue(clr) <= 128 && GetGValue(clr) <= 128 && GetBValue(clr) <= 128) txtclr = 0xffffff; dc.SetTextColor(txtclr); - char txt[5]; + TCHAR txt[5]; dc.DrawEdge(&lpDrawItemStruct->rcItem, lpDrawItemStruct->itemState&ODS_SELECTED ? EDGE_SUNKEN : EDGE_RAISED, BF_RECT); ::GetWindowText(lpDrawItemStruct->hwndItem, txt, 5); dc.DrawText(txt, 4, &lpDrawItemStruct->rcItem, DT_VCENTER | DT_CENTER | DT_SINGLELINE); diff --git a/Lite/AppConfig.cpp b/Lite/AppConfig.cpp index 3ecbb72..6e35142 100644 --- a/Lite/AppConfig.cpp +++ b/Lite/AppConfig.cpp @@ -116,7 +116,7 @@ CString GetIEPath() HKEY hk = NULL; // RegOpenKey( HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\IEXPLORE.EXE", &hk ); // RegQueryValue( hk, NULL, fpath.GetBuffer(_MAX_PATH), &len); - RegQueryValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\IEXPLORE.EXE", fpath.GetBuffer(_MAX_PATH), &len); + RegQueryValue(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\IEXPLORE.EXE"), fpath.GetBuffer(_MAX_PATH), &len); // RegCloseKey( hk ); fpath.ReleaseBuffer(); return fpath; diff --git a/Lite/AutoComplete.cpp b/Lite/AutoComplete.cpp index fc01012..5830621 100644 --- a/Lite/AutoComplete.cpp +++ b/Lite/AutoComplete.cpp @@ -277,7 +277,7 @@ int CAutoComplete::CompareItem(const void *p1, const void *p2) int r = item1->strstrpos - item2->strstrpos; if (0 != r) return r; - return strcmp(m_pOpenedList->m_pSrc->GetAt(item1->strpos), + return _tcscmp(m_pOpenedList->m_pSrc->GetAt(item1->strpos), m_pOpenedList->m_pSrc->GetAt(item2->strpos)); } diff --git a/Lite/AutoReplyPage.cpp b/Lite/AutoReplyPage.cpp index 6107f93..9e2fad8 100644 --- a/Lite/AutoReplyPage.cpp +++ b/Lite/AutoReplyPage.cpp @@ -74,8 +74,8 @@ void CAutoReplyPage::OnAdd() msg.SetWindowText(NULL); respond.SetWindowText(NULL); protect.SetCheck(FALSE); - first.SetWindowText("1"); - count.SetWindowText("1"); + first.SetWindowText(TEXT("1")); + count.SetWindowText(TEXT("1")); list.EnableWindow(FALSE); } @@ -197,20 +197,20 @@ void CAutoReplyPage::UpdateDisplay() msg.SetWindowText(item->msg); respond.SetPasswordChar(*LPCTSTR(item->respond) == '+' ? '*' : 0); CString tmp = LPCTSTR(item->respond) + 1; - tmp.Replace("^M^J", "\r\n"); - tmp.Replace("^M", "\r\n"); + tmp.Replace(TEXT("^M^J"), TEXT("\r\n")); + tmp.Replace(TEXT("^M"), TEXT("\r\n")); respond.SetWindowText(tmp); protect.SetCheck(*LPCTSTR(item->respond) == '+'); - char sfirst[8]; - itoa(item->first, sfirst, 10); + TCHAR sfirst[8]; + _itot(item->first, sfirst, 10); first.SetWindowText(sfirst); - char scount[8]; + TCHAR scount[8]; if (item->count == 0) count.SetWindowText(NULL); else { - itoa(item->count, scount, 10); + _itot(item->count, scount, 10); count.SetWindowText(scount); } } @@ -247,21 +247,21 @@ void CAutoReplyPage::OnSave() item->msg = tmp; respond.GetWindowText(tmp); - tmp.Replace("\r\n", "^M"); + tmp.Replace(TEXT("\r\n"), TEXT("^M")); item->respond = protect.GetCheck() ? "+" : "-"; item->respond += tmp; - char sfirst[8]; + TCHAR sfirst[8]; first.GetWindowText(sfirst, 8); - item->first = atoi(sfirst); + item->first = _tstoi(sfirst); if (item->first < 1) item->first = 1; - char scount[8]; + TCHAR scount[8]; count.GetWindowText(scount, 8); if (!*scount) item->count = 0; else - item->count = atoi(scount); + item->count = _tstoi(scount); if (badd) //pGsW i = list.AddString(item->msg); diff --git a/Lite/AutoUpdate.cpp b/Lite/AutoUpdate.cpp index c875a9a..1e24f02 100644 --- a/Lite/AutoUpdate.cpp +++ b/Lite/AutoUpdate.cpp @@ -24,7 +24,7 @@ static char THIS_FILE[]=__FILE__; CAutoUpdater::CAutoUpdater() { // Initialize WinInet - hInternet = InternetOpen("AutoUpdateAgent", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0); + hInternet = InternetOpen(TEXT("AutoUpdateAgent"), INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0); } CAutoUpdater::~CAutoUpdater() @@ -144,7 +144,7 @@ CAutoUpdater::ErrorType CAutoUpdater::CheckForUpdate() // } MessageBox(AfxGetMainWnd()->m_hWnd, LoadString(IDS_INSTALL_UPDATE), LoadString(IDS_PCMAN_CLOSE), MB_ICONINFORMATION|MB_OK); - if (!::ShellExecute(AfxGetMainWnd()->m_hWnd, "open", updateFileLocation, NULL, NULL, + if (!::ShellExecute(AfxGetMainWnd()->m_hWnd, TEXT("open"), updateFileLocation, NULL, NULL, SW_SHOWNORMAL)) { return UpdateNotComplete; @@ -325,7 +325,7 @@ int CAutoUpdater::CompareVersions(CString ver1, CString ver2) } // Get version 1 to DWORDs - TCHAR *pToken = strtok(pVer1, _T(".")); + TCHAR *pToken = _tcstok(pVer1, _T(".")); if (pToken == NULL) { return -21; @@ -338,14 +338,14 @@ int CAutoUpdater::CompareVersions(CString ver1, CString ver2) { return -21; // Error in structure, too many parameters } - wVer1[i] = atoi(pToken); - pToken = strtok(NULL, _T(".")); + wVer1[i] = _tstoi(pToken); + pToken = _tcstok(NULL, _T(".")); i--; } ver1.ReleaseBuffer(); // Get version 2 to DWORDs - pToken = strtok(pVer2, _T(".")); + pToken = _tcstok(pVer2, _T(".")); if (pToken == NULL) { return -22; @@ -358,8 +358,8 @@ int CAutoUpdater::CompareVersions(CString ver1, CString ver2) { return -22; // Error in structure, too many parameters } - wVer2[i] = atoi(pToken); - pToken = strtok(NULL, _T(".")); + wVer2[i] = _tstoi(pToken); + pToken = _tcstok(NULL, _T(".")); i--; } ver2.ReleaseBuffer(); diff --git a/Lite/AutoUpdate.h b/Lite/AutoUpdate.h index dab26ec..37c5dfb 100644 --- a/Lite/AutoUpdate.h +++ b/Lite/AutoUpdate.h @@ -23,8 +23,8 @@ #endif #define LOCATION_UPDATE_FILE_CHECK _T(UPDATE_FILE) -static UINT NEAR WM_COMMIT_UPDATE = RegisterWindowMessage("COMMIT_UPDATE"); -static UINT NEAR WM_DOWNLOAD_UPDATE_COMPLETE = RegisterWindowMessage("DOWNLOAD_UPDATE_COMPLETE"); +static UINT NEAR WM_COMMIT_UPDATE = RegisterWindowMessage(TEXT("COMMIT_UPDATE")); +static UINT NEAR WM_DOWNLOAD_UPDATE_COMPLETE = RegisterWindowMessage(TEXT("DOWNLOAD_UPDATE_COMPLETE")); class CAutoUpdater { diff --git a/Lite/BBSHyperLink.cpp b/Lite/BBSHyperLink.cpp index c59e43a..ae5cab5 100644 --- a/Lite/BBSHyperLink.cpp +++ b/Lite/BBSHyperLink.cpp @@ -188,7 +188,7 @@ void CBBSHyperLink::OpenURL(LPCTSTR url) ((CMainFrame*)AfxGetApp()->m_pMainWnd)->view.ConnectWeb(CAddress(url), AppConfig.link_autoswitch); else #endif - ::ShellExecute(AfxGetMainWnd()->m_hWnd, "open", path, param, NULL, + ::ShellExecute(AfxGetMainWnd()->m_hWnd, TEXT("open"), path, param, NULL, AppConfig.link_autoswitch ? SW_SHOWMAXIMIZED : SW_SHOWMINIMIZED); } } diff --git a/Lite/Clipboard.h b/Lite/Clipboard.h index a1dbafc..0c06d7a 100644 --- a/Lite/Clipboard.h +++ b/Lite/Clipboard.h @@ -22,7 +22,7 @@ class CClipboard inline BOOL CClipboard::SetText(HWND owner, LPCTSTR str) { - return SetText(owner, str, strlen(str)); + return SetText(owner, str, _tcslen(str)); } inline BOOL CClipboard::SetTextW(HWND owner, const wchar_t* str) diff --git a/Lite/ColorConfigDlg.cpp b/Lite/ColorConfigDlg.cpp index 6b3b1e5..da4eed1 100644 --- a/Lite/ColorConfigDlg.cpp +++ b/Lite/ColorConfigDlg.cpp @@ -43,7 +43,7 @@ void CColorConfigDlg::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct) { COLORREF clr = colormap[nIDCtl-5]; CDC dc; - char txt[10]; + TCHAR txt[10]; dc.Attach(lpDrawItemStruct->hDC); CRect rc; ::GetClientRect(lpDrawItemStruct->hwndItem, &rc); diff --git a/Lite/ConfigFile.cpp b/Lite/ConfigFile.cpp index 16a8376..1aebe17 100644 --- a/Lite/ConfigFile.cpp +++ b/Lite/ConfigFile.cpp @@ -194,7 +194,7 @@ bool CConfigFile::DoSave(ConfigTable table) CString str, esc_str; for (; table->name; table++) { - str.Format("[%s]\r\n", table->name); + str.Format(TEXT("[%s]\r\n"), table->name); file.Write(LPCTSTR(str), str.GetLength()); if (table->type == VT_CUSTOM_SECT) @@ -209,7 +209,8 @@ bool CConfigFile::DoSave(ConfigTable table) else cur_sect = (ConfigEntry*)table->data; - char strval[64]; const char* pstrval; + char strval[64]; + const char* pstrval; for (; cur_sect->name; cur_sect++) { pstrval = strval; @@ -256,7 +257,7 @@ bool CConfigFile::DoSave(ConfigTable table) } break; } - str.Format("%s=%s\r\n", cur_sect->name, pstrval); + str.Format(TEXT("%s=%s\r\n"), cur_sect->name, pstrval); file.Write(LPCTSTR(str), str.GetLength()); } file.Write("\r\n", 2); diff --git a/Lite/ConnectPage.cpp b/Lite/ConnectPage.cpp index 88f8cd0..6bc3b47 100644 --- a/Lite/ConnectPage.cpp +++ b/Lite/ConnectPage.cpp @@ -39,7 +39,7 @@ void CConnectPage::InitWithAddress(const CString& addr) int pos = address.ReverseFind(':'); if (pos != -1) { - port = (unsigned short)atoi(address.Mid(pos + 1)); + port = (unsigned short)_tstoi(address.Mid(pos + 1)); address = address.Left(pos); } } @@ -53,7 +53,7 @@ CString CConnectPage::GetFormattedAddress() const if (port == 23 || port <= 0) return address; CString buf; - buf.Format("%s:%d", LPCTSTR(address), port); + buf.Format(TEXT("%s:%d"), LPCTSTR(address), port); return buf; } @@ -117,7 +117,7 @@ void CConnectPage::OnAddressChanged() if (addr.IsValid()) { CString port_text; - port_text.Format("%d", addr.Port()); + port_text.Format(TEXT("%d"), addr.Port()); port_field->SetWindowText(port_text); } -} \ No newline at end of file +} diff --git a/Lite/CtrlEdit.cpp b/Lite/CtrlEdit.cpp index 8ba6eb7..dc27f41 100644 --- a/Lite/CtrlEdit.cpp +++ b/Lite/CtrlEdit.cpp @@ -43,7 +43,7 @@ LRESULT CCtrlEdit::OnPaste(WPARAM w, LPARAM l) if (strstr(data, "\x1b[")) //pGtmX { CString tmp = data; - tmp.Replace("\x1b[", "^[["); + tmp.Replace(TEXT("\x1b["), TEXT("^[[")); ReplaceSel(tmp, FALSE); CStringDlg* pdlg = (CStringDlg*)GetParent(); if (pdlg) diff --git a/Lite/CustomTabCtrl.cpp b/Lite/CustomTabCtrl.cpp index 0bfe2d7..3aa6533 100644 --- a/Lite/CustomTabCtrl.cpp +++ b/Lite/CustomTabCtrl.cpp @@ -102,7 +102,7 @@ void CCustomTabCtrl::OnLButtonUp(UINT nFlags, CPoint point) */ CString txt = oldc->name; item.mask |= TCIF_TEXT; - item.pszText = (LPSTR)(LPCTSTR)txt; + item.pszText = (LPTSTR)(LPCTSTR)txt; InsertItem(newsel, &item); /* if(newsel>0) //pGJᤣOĤ@,e@ @@ -223,8 +223,8 @@ BOOL CCustomTabCtrl::InsertItem(int nItem, TCITEM* pTabCtrlItem) return CTabCtrl::InsertItem(nItem, pTabCtrlItem); CString name; - name.Format("%d.%s", nItem + 1, pTabCtrlItem->pszText); - pTabCtrlItem->pszText = (LPSTR)(LPCTSTR)name; + name.Format(TEXT("%d.%s"), nItem + 1, pTabCtrlItem->pszText); + pTabCtrlItem->pszText = (LPTSTR)(LPCTSTR)name; r = CTabCtrl::InsertItem(nItem, pTabCtrlItem); UpdateNumberFrom(nItem); @@ -242,7 +242,7 @@ BOOL CCustomTabCtrl::InsertItem(UINT nMask, int nItem, LPCTSTR lpszItem, int nIm { TCITEM item; item.mask = nMask; - item.pszText = (LPSTR)lpszItem; + item.pszText = (LPTSTR)lpszItem; item.iImage = nImage; item.lParam = lParam; nItem = InsertItem(nItem, &item); @@ -262,11 +262,11 @@ void CCustomTabCtrl::UpdateNumberFrom(int idx) CString name; if (addnum) { - name.Format("%d.%s", c, telnet->name); - item.pszText = (LPSTR)(LPCTSTR)name; + name.Format(TEXT("%d.%s"), c, telnet->name); + item.pszText = (LPTSTR)(LPCTSTR)name; } else - item.pszText = (LPSTR)(LPCTSTR)telnet->name; + item.pszText = (LPTSTR)(LPCTSTR)telnet->name; item.mask = TCIF_TEXT; SetItem(c - 1, &item); @@ -293,7 +293,8 @@ void CCustomTabCtrl::DrawItem(LPDRAWITEMSTRUCT lpds) DWORD style = GetStyle(); - TCITEM item; char text[100]; + TCITEM item; + TCHAR text[100]; item.mask = TCIF_IMAGE | TCIF_TEXT; item.pszText = text; item.cchTextMax = 100; GetItem(lpds->itemID, &item); @@ -360,14 +361,15 @@ void CCustomTabCtrl::DrawItem(LPDRAWITEMSTRUCT lpds) //#if defined(_COMBO_) // lpds->rcItem.right-=3; //#endif - dc.DrawText(text, strlen(text), &lpds->rcItem, DT_SINGLELINE | DT_END_ELLIPSIS); + dc.DrawText(text, _tcslen(text), &lpds->rcItem, DT_SINGLELINE | DT_END_ELLIPSIS); dc.Detach(); } CImageList* CCustomTabCtrl::CreateDragImage(int i) { - TCITEM item; char text[100]; + TCITEM item; + TCHAR text[100]; item.mask = TCIF_IMAGE | TCIF_TEXT; item.pszText = text; item.cchTextMax = 100; GetItem(i, &item); @@ -380,7 +382,7 @@ CImageList* CCustomTabCtrl::CreateDragImage(int i) // Begin Paint CRect rc; rc.top = rc.left = 0; - int l = strlen(item.pszText); + int l = _tcslen(item.pszText); DrawText(memdc, item.pszText, l, rc, DT_LEFT | DT_SINGLELINE | DT_CALCRECT); HBITMAP bmp = CreateCompatibleBitmap(hdc, rc.right + 20, rc.bottom); img->Create(rc.right + 20, rc.bottom, ILC_COLOR32 | ILC_MASK, 1, 0); @@ -416,9 +418,9 @@ void CCustomTabCtrl::SetItemText(int i, CString Text) { TCITEM item; item.mask = TCIF_TEXT; CString Title; if (AppConfig.tab_add_number) - Title.Format("%d.%.12s", i + 1, Text); + Title.Format(TEXT("%d.%.12s"), i + 1, Text); else Title = Text.Left(12); - item.pszText = (LPSTR)(LPCTSTR)Title; + item.pszText = (LPTSTR)(LPCTSTR)Title; SetItem(i, &item); } diff --git a/Lite/CustomToolBar.cpp b/Lite/CustomToolBar.cpp index 3c1d5aa..8f5d80c 100644 --- a/Lite/CustomToolBar.cpp +++ b/Lite/CustomToolBar.cpp @@ -51,7 +51,7 @@ void CCustomToolBar::OnToolBarGetButtonInfo(NMHDR *pnmhdr, LRESULT *r) memcpy(&nmt->tbButton, &inf->pbtns[nmt->iItem], sizeof(TBBUTTON)); CString str; str.LoadString(inf->pbtns[nmt->iItem].idCommand); - strncpy(nmt->pszText, LPCTSTR(str) + 1, nmt->cchText); + _tcsncpy(nmt->pszText, LPCTSTR(str) + 1, nmt->cchText); *r = TRUE; } diff --git a/Lite/CustomizeDlg.cpp b/Lite/CustomizeDlg.cpp index 5848c66..a242920 100644 --- a/Lite/CustomizeDlg.cpp +++ b/Lite/CustomizeDlg.cpp @@ -303,7 +303,7 @@ void CCustomizeDlg::OnSelChanged(NMHDR* pNMHDR, LRESULT* pResult) { CString text = tree.GetItemText(item); int p = text.Find('&'); - char a[] = {0, 0}; + TCHAR a[] = {0, 0}; if (p != -1) *a = text[p+1]; hkedit2.SetWindowText(a); if (data->type & CT_HAS_SUB) @@ -349,7 +349,7 @@ void CCustomizeDlg::OnSelChanged(NMHDR* pNMHDR, LRESULT* pResult) LRESULT CALLBACK CCustomizeDlg::HotkeyEdit2Proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { - char a[] = {0, 0}; + TCHAR a[] = {0, 0}; if (msg == WM_CHAR) { if (isalnum(wparam)) @@ -380,7 +380,7 @@ void CCustomizeDlg::UpdateItemDisplay(HTREEITEM item) int p; if ((p = text.Find('\t')) != -1) text = text.Left(p); - char a[] = " (&A)", _a[2]; + TCHAR a[] = TEXT(" (&A)"), _a[2]; hkedit2.GetWindowText(_a, 2); HotkeyData* hkitem = (HotkeyData*)tree.GetItemData(item); diff --git a/Lite/DragTreeCtrl.cpp b/Lite/DragTreeCtrl.cpp index abd7fd9..cf16362 100644 --- a/Lite/DragTreeCtrl.cpp +++ b/Lite/DragTreeCtrl.cpp @@ -240,15 +240,16 @@ void CDragTreeCtrl::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags) HTREEITEM CDragTreeCtrl::PathToItem(LPCTSTR path, HTREEITEM root, TCHAR separator) { - static char* path_buf = 0; + static TCHAR* path_buf = nullptr; if (!path_buf) { - int l = strlen(path) + 1; - path_buf = new char[l]; - memcpy(path_buf, path, l); + int l = _tcslen(path) + 1; + path_buf = new TCHAR[l]; + memcpy(path_buf, path, sizeof(path_buf)); path = path_buf; } + // Need Unicode Fix below HTREEITEM item; LPSTR pch; for (pch = LPSTR(path) ; *pch; pch = CharNextExA(CP_ACP, pch, 0)) { @@ -266,7 +267,7 @@ HTREEITEM CDragTreeCtrl::PathToItem(LPCTSTR path, HTREEITEM root, TCHAR separato return PathToItem(pch + 1, item, separator); delete []path_buf; - path_buf = NULL; + path_buf = nullptr; return item; } diff --git a/Lite/FavMenu.cpp b/Lite/FavMenu.cpp index be9bcb0..baa0af8 100644 --- a/Lite/FavMenu.cpp +++ b/Lite/FavMenu.cpp @@ -392,7 +392,7 @@ inline CStringArray& CFavMenu::GetData(HMENU menu, int& delta) int FavItemCompare(const void* item1, const void* item2) { - return strcmpi(*(CString*)item1, *(CString*)item2); + return _tcsicmp(*(CString*)item1, *(CString*)item2); } #if defined( _COMBO_ ) diff --git a/Lite/KeyMapDlg.cpp b/Lite/KeyMapDlg.cpp index 4527fcd..18033f9 100644 --- a/Lite/KeyMapDlg.cpp +++ b/Lite/KeyMapDlg.cpp @@ -103,7 +103,7 @@ void CKeyMapDlg::OnOK() DWORD inf = list.GetItemData(i); ent.key = LOWORD(inf); ent.fVirt = (BYTE)HIWORD(inf); - strncpy(ent.str, UnescapeControlChars(str), 12); + _tcsncpy(ent.str, UnescapeControlChars(str), 12); pmap->Add(ent); } pmap->FreeExtra(); @@ -241,7 +241,7 @@ void CKeyMapDlg::OnSavekey() MessageBox(LoadString(IDS_SPECIFIED_KEY_EXISTS) , LoadString(IDS_ERR), MB_ICONSTOP | MB_OK); return; } - sel = list.InsertItem(0, ""); + sel = list.InsertItem(0, TEXT("")); } else //Modify sel = (int)list.GetFirstSelectedItemPosition() - 1; diff --git a/Lite/ListDlg.cpp b/Lite/ListDlg.cpp index ce1d20d..a67abf3 100644 --- a/Lite/ListDlg.cpp +++ b/Lite/ListDlg.cpp @@ -114,7 +114,7 @@ void CListDlg::OnOK() view->parent->LoadWebFavorites(); #endif } - str.Replace(SEPARATOR, "\t"); + str.Replace(SEPARATOR, TEXT("\t")); view->ConnectStr('s' + str, dir); CDialog::OnOK(); } @@ -356,11 +356,11 @@ void CListDlg::OnEditSite() { CInputNameDlg dlg(this); dlg.name = sites.GetItemText(item); - dlg.name.Replace(SEPARATOR, "\t"); + dlg.name.Replace(SEPARATOR, TEXT("\t")); if (dlg.DoModal() == IDOK) { CString tmp = dlg.name; - tmp.Replace("\t", SEPARATOR); + tmp.Replace(TEXT("\t"), SEPARATOR); sites.SetItemText(item, dlg.name); sites.changed = TRUE; } diff --git a/Lite/MainFrm.cpp b/Lite/MainFrm.cpp index f2cf837..e6ae322 100644 --- a/Lite/MainFrm.cpp +++ b/Lite/MainFrm.cpp @@ -914,10 +914,10 @@ void CMainFrame::OnNewConnectionAds(LPCTSTR cmdline) else if (IsFileExist(cmdline)) { // Plain path. - int l = strlen(cmdline); + int l = _tcslen(cmdline); if (l > 4) { - if (0 == strnicmp(cmdline + (l - 4), ".ans", 4)) + if (0 == _tcsncicmp(cmdline + (l - 4), TEXT(".ans"), 4)) { if (view.OpenAnsFile(cmdline)) return; @@ -1042,7 +1042,7 @@ void CMainFrame::UpdateAddressBar() address_bar.SetWindowText(view.telnet->address.URL()); } else - address_bar.SetWindowText(""); + address_bar.SetWindowText(TEXT("")); #endif } @@ -1161,14 +1161,14 @@ void CMainFrame::OnSetDefaultProgram() if (MessageBox(LoadString(IDS_SET_DEFALT_TELNET), LoadString(IDS_CONFIRM), MB_YESNO | MB_ICONQUESTION) == IDYES) { - RegCreateKey(HKEY_CLASSES_ROOT, "telnet\\shell\\PCMan\\command", &hk); + RegCreateKey(HKEY_CLASSES_ROOT, TEXT("telnet\\shell\\PCMan\\command"), &hk); RegSetValue(hk, NULL, REG_SZ, (LPCTSTR)cmd, cmd.GetLength()); RegCloseKey(hk); - RegSetValue(HKEY_CLASSES_ROOT, "telnet\\shell", REG_SZ, "PCMan", 5); + RegSetValue(HKEY_CLASSES_ROOT, TEXT("telnet\\shell"), REG_SZ, TEXT("PCMan"), 5); } else { - RegSetValue(HKEY_CLASSES_ROOT, "telnet\\shell", REG_SZ, "open", 4); + RegSetValue(HKEY_CLASSES_ROOT, TEXT("telnet\\shell"), REG_SZ, TEXT("open"), 4); } #ifdef _COMBO_ @@ -1214,20 +1214,20 @@ void CMainFrame::OnSetDefaultProgram() if (MessageBox(LoadString(IDS_SET_TO_DEFAULT_ANS), LoadString(IDS_CONFIRM), MB_YESNO | MB_ICONQUESTION) == IDYES) { - RegCreateKey(HKEY_CLASSES_ROOT, ".ans", &hk); - RegSetValue(hk, NULL, REG_SZ, "ansfile", 7); + RegCreateKey(HKEY_CLASSES_ROOT, TEXT(".ans"), &hk); + RegSetValue(hk, NULL, REG_SZ, TEXT("ansfile"), 7); RegCloseKey(hk); - RegCreateKey(HKEY_CLASSES_ROOT, "ansfile\\DefaultIcon", &hk); - RegSetValue(hk, NULL, REG_SZ, (LPCTSTR)(tmp + ",1"), tmp.GetLength() + 2); + RegCreateKey(HKEY_CLASSES_ROOT, TEXT("ansfile\\DefaultIcon"), &hk); + RegSetValue(hk, NULL, REG_SZ, (LPCTSTR)(tmp + TEXT(",1")), tmp.GetLength() + 2); RegCloseKey(hk); - RegCreateKey(HKEY_CLASSES_ROOT, "ansfile\\Shell\\Open\\Command", &hk); - RegSetValue(hk, NULL, REG_SZ, (LPCTSTR)(tmp + " %1"), tmp.GetLength() + 3); + RegCreateKey(HKEY_CLASSES_ROOT, TEXT("ansfile\\Shell\\Open\\Command"), &hk); + RegSetValue(hk, NULL, REG_SZ, (LPCTSTR)(tmp + TEXT(" %1")), tmp.GetLength() + 3); RegCloseKey(hk); } else { - RegDeleteKey(HKEY_CLASSES_ROOT, ".ans"); - RegDeleteKey(HKEY_CLASSES_ROOT, "ansfile"); + RegDeleteKey(HKEY_CLASSES_ROOT, TEXT(".ans")); + RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("ansfile")); } SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST | SHCNF_FLUSHNOWAIT, NULL, NULL); @@ -2821,7 +2821,7 @@ void CMainFrame::AddToHistory(CString address) void CMainFrame::LoadBBSFavorites() { - char title[64]; + TCHAR title[64]; GetMenuString(main_menu, 3, title, 32, MF_BYPOSITION); AppConfig.favorites.LoadFavorites(bbs_fav_menu, 's'); ModifyMenu(main_menu, 3, MF_BYPOSITION | MF_STRING | MF_POPUP, (UINT)bbs_fav_menu, title); @@ -3532,7 +3532,7 @@ void CMainFrame::OnNciku() #if defined _COMBO_ ((CMainFrame*)AfxGetApp()->m_pMainWnd)->view.ConnectWeb(tmp, TRUE); #else - ShellExecute(m_hWnd, "open", tmp.URL(), NULL, NULL, SW_SHOWMAXIMIZED); + ShellExecute(m_hWnd, TEXT("open"), tmp.URL(), NULL, NULL, SW_SHOWMAXIMIZED); #endif } @@ -3555,7 +3555,7 @@ void CMainFrame::OnWikipedia() #if defined _COMBO_ ((CMainFrame*)AfxGetApp()->m_pMainWnd)->view.ConnectWeb(tmp, TRUE); #else - ShellExecute(m_hWnd, "open", tmp.URL(), NULL, NULL, SW_SHOWMAXIMIZED); + ShellExecute(m_hWnd, TEXT("open"), tmp.URL(), NULL, NULL, SW_SHOWMAXIMIZED); #endif } @@ -3766,7 +3766,7 @@ void CMainFrame::OnHelp() view.ConnectWeb(CAddress("http://pcman.ptt.cc/pcman_help.html"), TRUE); #else // if((long)ShellExecute(m_hWnd,"open",AppPath+"pcman.html",NULL,NULL,SW_SHOWMAXIMIZED)<=32) - ShellExecute(m_hWnd, "open", "http://pcman.ptt.cc/pcman_help.html", NULL, NULL, SW_SHOWMAXIMIZED); + ShellExecute(m_hWnd, TEXT("open"), TEXT("http://pcman.ptt.cc/pcman_help.html"), NULL, NULL, SW_SHOWMAXIMIZED); #endif } @@ -4013,7 +4013,7 @@ LRESULT CMainFrame::OnDownloadPage(WPARAM, LPARAM) #ifdef _COMBO_ ((CMainFrame*)AfxGetApp()->GetMainWnd())->view.ConnectWeb(url, TRUE); #else - ShellExecute(m_hWnd, "open", url.URL(), NULL, NULL, SW_SHOW); + ShellExecute(m_hWnd, TEXT("open"), url.URL(), NULL, NULL, SW_SHOW); #endif return 0; } @@ -4026,7 +4026,7 @@ void CMainFrame::OnInitMenuPopup(CMenu* pMenu,UINT nIndex,BOOL bSysMenu) int c = pMenu->GetMenuItemCount(); CString text,result; pMenu->GetMenuString(1,text,MF_BYPOSITION); - if(strlen(text)==0||text[0] != '-') + if(text.GetLength()==0 || text[0] != '-') return; pMenu->GetMenuString(0,text,MF_BYPOSITION); @@ -4056,4 +4056,4 @@ void CMainFrame::OnCheckUpdate() { CWinThread * controlThread = AfxBeginThread(BackgroundAutoUpdate,NULL,THREAD_PRIORITY_NORMAL); //TODO: Ssܤ|T -} \ No newline at end of file +} diff --git a/Lite/MemIniFile.cpp b/Lite/MemIniFile.cpp index 0363f46..9a243d6 100644 --- a/Lite/MemIniFile.cpp +++ b/Lite/MemIniFile.cpp @@ -18,7 +18,7 @@ static char THIS_FILE[] = __FILE__; void SaveString(CFile& file, LPCTSTR str) { - DWORD len = strlen(str) + 1; + DWORD len = _tcslen(str) + 1; file.Write(&len, sizeof(DWORD)); file.Write(str, len); } diff --git a/Lite/OtherPage.cpp b/Lite/OtherPage.cpp index c9d4060..d8ab2d6 100644 --- a/Lite/OtherPage.cpp +++ b/Lite/OtherPage.cpp @@ -65,7 +65,7 @@ void COtherPage::OnOK() void COtherPage::OnSetWave() { - CFileDialog dlg(TRUE, ".wav", NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, LoadString(IDS_WAV_FILTER)); + CFileDialog dlg(TRUE, TEXT(".wav"), NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, LoadString(IDS_WAV_FILTER)); if (dlg.DoModal() == IDOK) GetDlgItem(IDC_WAVEPATH)->SetWindowText(dlg.GetPathName()); } diff --git a/Lite/PCMan.cpp b/Lite/PCMan.cpp index 7cfcdbe..634ab2f 100644 --- a/Lite/PCMan.cpp +++ b/Lite/PCMan.cpp @@ -67,7 +67,7 @@ BOOL CApp::InitInstance() { if (*m_lpCmdLine) { - int l = strlen(m_lpCmdLine) + 1; + int l = _tcslen(m_lpCmdLine) + 1; COPYDATASTRUCT d; d.lpData = m_lpCmdLine; d.cbData = l; @@ -268,7 +268,7 @@ void CAboutDlg::OnReport() #ifdef _COMBO_ ((CMainFrame*)AfxGetApp()->m_pMainWnd)->view.ConnectWeb(tracker, TRUE); #else - ShellExecute(m_hWnd, "open", tracker.URL(), NULL, NULL, SW_SHOW); + ShellExecute(m_hWnd, TEXT("open"), tracker.URL(), NULL, NULL, SW_SHOW); #endif } @@ -278,7 +278,7 @@ void CAboutDlg::OnWeb() #ifdef _COMBO_ ((CMainFrame*)AfxGetApp()->m_pMainWnd)->view.ConnectWeb(CAddress(web), TRUE); #else - ShellExecute(m_hWnd, "open", web, NULL, NULL, SW_SHOW); + ShellExecute(m_hWnd, TEXT("open"), web, NULL, NULL, SW_SHOW); #endif web[20] = 'p'; } @@ -289,7 +289,7 @@ void CAboutDlg::OnWeb2() #ifdef _COMBO_ ((CMainFrame*)AfxGetApp()->m_pMainWnd)->view.ConnectWeb(url, TRUE); #else - ShellExecute(m_hWnd, "open", url.URL(), NULL, NULL, SW_SHOW); + ShellExecute(m_hWnd, TEXT("open"), url.URL(), NULL, NULL, SW_SHOW); #endif } @@ -298,8 +298,8 @@ void CAboutDlg::OnHelp() #ifdef _COMBO_ ((CMainFrame*)AfxGetApp()->m_pMainWnd)->view.ConnectWeb(CAddress(web), TRUE); #else - if ((long)ShellExecute(m_hWnd, "open", AppPath + "pcman.html", NULL, NULL, SW_SHOWMAXIMIZED) <= 32) - ShellExecute(m_hWnd, "open", web, NULL, NULL, SW_SHOWMAXIMIZED); + if ((long)ShellExecute(m_hWnd, TEXT("open"), AppPath + "pcman.html", NULL, NULL, SW_SHOWMAXIMIZED) <= 32) + ShellExecute(m_hWnd, TEXT("open"), web, NULL, NULL, SW_SHOWMAXIMIZED); #endif } @@ -331,9 +331,9 @@ BOOL CAboutDlg::OnInitDialog() CDialog::OnInitDialog(); std::string buffer; - ReadFileAppend(AppPath + "story.txt", &buffer); + ReadFileAppend(AppPath + TEXT("story.txt"), &buffer); buffer += _T("\r\n"); - ReadFileAppend(AppPath + "OpenSourceLicenses.txt", &buffer); + ReadFileAppend(AppPath + TEXT("OpenSourceLicenses.txt"), &buffer); buffer += _T("\r\n"); GetDlgItem(IDC_EDIT)->SetWindowText(buffer.c_str()); diff --git a/Lite/ReBarState.h b/Lite/ReBarState.h index dacc61d..3d08281 100644 --- a/Lite/ReBarState.h +++ b/Lite/ReBarState.h @@ -26,7 +26,7 @@ class CReBarBandPos : public CConfigFile::ConfigHandler } void Save(CString& value) { - value.Format("%d,%d,%d", wID, fStyle, cx); + value.Format(TEXT("%d,%d,%d"), wID, fStyle, cx); } }; diff --git a/Lite/SearchPlugin.cpp b/Lite/SearchPlugin.cpp index 74c9341..d55601a 100644 --- a/Lite/SearchPlugin.cpp +++ b/Lite/SearchPlugin.cpp @@ -16,8 +16,8 @@ static char THIS_FILE[]=__FILE__; #define new DEBUG_NEW #endif -#define AGENT_NAME "CodeguruBrowser1.0" -#define NCIKU "http://www.nciku.com.tw" +#define AGENT_NAME TEXT("CodeguruBrowser1.0") +#define NCIKU TEXT("http://www.nciku.com.tw") CSearchPluginCollection SearchPluginCollection; @@ -89,7 +89,7 @@ CString CSearchPlugin::ProcessContent(CString theContent){ CString returnStr = ""; CString tmpStr = ""; int counter = 0; - if (theContent.Find("") > 0) + if (theContent.Find(TEXT("")) > 0) { int startPos, endPos, deletePos, rightLength; CString startStr = "

"; @@ -97,7 +97,7 @@ CString CSearchPlugin::ProcessContent(CString theContent){ startPos = theContent.Find(startStr) + startStr.GetLength(); endPos = theContent.Find(endStr); - deletePos = theContent.Find("."); + deletePos = theContent.Find(TEXT(".")); returnStr = theContent.Left(endPos); returnStr.TrimRight(); @@ -115,7 +115,7 @@ CString CSearchPlugin::ProcessContent(CString theContent){ int splitPos = theContent.Find(tagging); CString leftStr = theContent.Left(splitPos); - splitPos = leftStr.Find("    "); + splitPos = leftStr.Find(TEXT("    ")); leftStr = theContent.Left(splitPos); returnStr += findHead(leftStr) + _T(" ; "); @@ -176,7 +176,7 @@ CString CSearchPlugin::GetWebPage(const CString& theUrl) { //dataStore.WriteString(somecode); - if (somecode.Find("") > 0 && ReadCounter == 0) + if (somecode.Find(TEXT("")) > 0 && ReadCounter == 0) { ReturnContent = somecode; ReadCounter++; @@ -184,7 +184,7 @@ CString CSearchPlugin::GetWebPage(const CString& theUrl) break; } - else if (somecode.Find("    ") > 0 && ReadCounter == 0) + else if (somecode.Find(TEXT("    ")) > 0 && ReadCounter == 0) { ReturnContent = somecode; ReadCounter++; @@ -341,7 +341,7 @@ CString CSearchPluginCollection::UrlForSearch(int index, CString searchTerm, boo if (utf8) delete []utf8Str; } - url.Replace("{searchTerms}", encodedTerm); + url.Replace(TEXT("{searchTerms}"), encodedTerm); TestString = encodedTerm; return url; @@ -351,7 +351,7 @@ CString CSearchPluginCollection::UrlForTranslate(CString searchTerm, bool utf8) { CString url = "http://www.nciku.com.tw/search/all/{searchTerms}"; - url.Replace("{searchTerms}", searchTerm); + url.Replace(TEXT("{searchTerms}"), searchTerm); return url; return url; @@ -387,6 +387,7 @@ char* CSearchPluginCollection::GetField(int index, EField f) return ((CSearchPlugin*)plugins[index])->Method; break; } + // bug? should be nullptr? return _T(""); } @@ -590,7 +591,7 @@ HMENU CSearchPluginCollection::CreateTranMenu(CString TextContent) tran_menu = CreatePopupMenu(); AppendMenu(tran_menu, MF_STRING, ID_TRANSLATION, TextContent); - AppendMenu(tran_menu, MF_STRING, 0, "-"); + AppendMenu(tran_menu, MF_STRING, 0, TEXT("-")); return tran_menu; } diff --git a/Lite/SiteListCtrl.cpp b/Lite/SiteListCtrl.cpp index 9c2d569..4e77992 100644 --- a/Lite/SiteListCtrl.cpp +++ b/Lite/SiteListCtrl.cpp @@ -17,8 +17,8 @@ static char THIS_FILE[] = __FILE__; // Construction/Destruction ////////////////////////////////////////////////////////////////////// -const char SEPARATOR[] = " "; -const int SEPARATOR_LEN = 8; +const TCHAR SEPARATOR[] = TEXT(" "); +const int SEPARATOR_LEN = sizeof(SEPARATOR) / sizeof(*SEPARATOR); CSiteListCtrl::CSiteListCtrl() { diff --git a/Lite/SiteSettings.h b/Lite/SiteSettings.h index c80edfb..d85305e 100644 --- a/Lite/SiteSettings.h +++ b/Lite/SiteSettings.h @@ -68,7 +68,7 @@ class CSiteSettings esc_convert == ss.esc_convert && text_output_conv == ss.text_output_conv && text_input_conv == ss.text_input_conv && - !strncmp(key_map_name, ss.key_map_name, 10); + !_tcsnccmp(key_map_name, ss.key_map_name, 10); } inline bool operator !=(CSiteSettings &ss) diff --git a/Lite/StrUtils.cpp b/Lite/StrUtils.cpp index fabddc5..5fd32c8 100644 --- a/Lite/StrUtils.cpp +++ b/Lite/StrUtils.cpp @@ -45,7 +45,7 @@ char* strnstri(const char* str, const char* sub, int len) int sl = strlen(sub); for (pstr = str; pstr <= pend - sl; pstr++) { - if (!strnicmp(pstr, sub, sl)) + if (!_tcsncicmp(pstr, sub, sl)) return (char*)pstr; } return NULL; diff --git a/Lite/StringDlg.cpp b/Lite/StringDlg.cpp index 3314afd..f0f8543 100644 --- a/Lite/StringDlg.cpp +++ b/Lite/StringDlg.cpp @@ -418,7 +418,7 @@ void CStringDlg::OnListGetDispInfo(NMHDR* pNMHDR, LRESULT* pResult) LV_DISPINFO* pdi = (LV_DISPINFO*)pNMHDR; pdi->item.mask = LVIF_TEXT; if (pdi->item.iSubItem == 0 && stra) - pdi->item.pszText = LPSTR(LPCTSTR(stra->ElementAt(pdi->item.iItem))); + pdi->item.pszText = LPTSTR(LPCTSTR(stra->ElementAt(pdi->item.iItem))); else if (pdi->item.iSubItem == 1) { DWORD dwinf = stra->inf.ElementAt(pdi->item.iItem); @@ -483,7 +483,7 @@ void CStringDlg::OnRenamePage() CInputNameDlg dlg; int i = tab.GetCurSel(); TCITEM item; - char buf[64]; + TCHAR buf[64]; item.mask = TCIF_TEXT; item.pszText = buf; item.cchTextMax = 64; @@ -491,7 +491,7 @@ void CStringDlg::OnRenamePage() dlg.name = buf; if (dlg.DoModal() == IDOK) { - item.pszText = (LPSTR)(LPCTSTR)dlg.name; + item.pszText = (LPTSTR)(LPCTSTR)dlg.name; tab.SetItem(i, &item); data_changed = TRUE; @@ -530,7 +530,7 @@ void CStringDlg::OnDeltaPosPageSpin(NMHDR* pNMHDR, LRESULT* pResult) if (i2 >= tab.GetItemCount() || i2 < 0) return; TCITEM item, item2; - char buf[64], buf2[64]; + TCHAR buf[64], buf2[64]; item.mask = item2.mask = TCIF_TEXT | TCIF_PARAM; item.pszText = buf; item2.pszText = buf2; @@ -621,7 +621,7 @@ void CStringDlg::LoadList() for (int p = 0;p < tc;p++) { CString tmp = LoadString(f); - item.pszText = (LPSTR)(LPCTSTR)tmp; //Add Page + item.pszText = (LPTSTR)(LPCTSTR)tmp; //Add Page stra = new MyStringArray; item.lParam = (LPARAM)stra; tab.InsertItem(p, &item); diff --git a/Lite/TelnetConn.cpp b/Lite/TelnetConn.cpp index 0af46b6..241c5dc 100644 --- a/Lite/TelnetConn.cpp +++ b/Lite/TelnetConn.cpp @@ -590,7 +590,7 @@ void CTelnetConn::OnText() if(stamp == 2) { downloaded_article += GetLineWithAnsi(last_line - 2); - downloaded_article.TrimRight(" "); + downloaded_article.TrimRight(TEXT(" ")); downloaded_article += "\r\n"; } downloaded_article += GetLineWithAnsi(last_line - 1); @@ -600,12 +600,12 @@ void CTelnetConn::OnText() if(stamp == 2) { downloaded_article += screen[ last_line - 2 ]; - downloaded_article.TrimRight(" "); + downloaded_article.TrimRight(TEXT(" ")); downloaded_article += "\r\n"; } downloaded_article += screen[ last_line - 1 ]; } - downloaded_article.TrimRight(" "); + downloaded_article.TrimRight(TEXT(" ")); downloaded_article += "\r\n"; if (IsEndOfArticleReached()) diff --git a/Lite/TermView.cpp b/Lite/TermView.cpp index 05e45ea..1c99019 100644 --- a/Lite/TermView.cpp +++ b/Lite/TermView.cpp @@ -133,7 +133,7 @@ CFont fnt; CAddress AnsiAddressFromPath(const CString& path) { CString url; - url.Format("file://%s", path); + url.Format(TEXT("file://%s"), path); return CAddress(url); } @@ -3398,4 +3398,4 @@ void CTermView::SetCursorPos(int text_x, int text_y) ImmSetCompositionWindow(hImc, &comp); ImmReleaseContext(m_hWnd, hImc); } -} \ No newline at end of file +} diff --git a/Lite/Websocket.cpp b/Lite/Websocket.cpp index 7c90700..fcb4c10 100644 --- a/Lite/Websocket.cpp +++ b/Lite/Websocket.cpp @@ -110,7 +110,7 @@ void CWebsocketManager::RemoveConn() void CWebsocketManager::ServiceLoop() { - OutputDebugString("CWebsocketManager: service loop started\n"); + OutputDebugString(TEXT("CWebsocketManager: service loop started\n")); while (true) { lws_service(context, 10000); @@ -122,7 +122,7 @@ void CWebsocketManager::ServiceLoop() } } } - OutputDebugString("CWebsocketManager: service loop ended\n"); + OutputDebugString(TEXT("CWebsocketManager: service loop ended\n")); } class CWebsocket @@ -195,10 +195,11 @@ int HandlerCallbackFunc( switch (reason) { case LWS_CALLBACK_OPENSSL_LOAD_EXTRA_CLIENT_VERIFY_CERTS: lwsl_notice("dumb: LWS_CALLBACK_OPENSSL_LOAD_EXTRA_CLIENT_VERIFY_CERTS\n"); - TCHAR module_path[MAX_PATH], buf[MAX_PATH]; - if (GetModuleFileName(nullptr, module_path, sizeof(module_path) / sizeof(TCHAR)) > 0 && - PathRemoveFileSpec(module_path) && - PathCombine(buf, module_path, "cacert.pem")) { + // ANSI hack, Ϊܦnnۤvload pemAӳ·СAuOpath঳DansirvTj + char module_path[MAX_PATH], buf[MAX_PATH]; + if (GetModuleFileNameA(nullptr, module_path, sizeof(module_path) / sizeof(char)) > 0 && + PathRemoveFileSpecA(module_path) && + PathCombineA(buf, module_path, "cacert.pem")) { if (!SSL_CTX_load_verify_locations((SSL_CTX *)user, buf, nullptr)) { lwsl_err("SSL_CTX_load_verify_locations error\n"); } @@ -363,4 +364,4 @@ void CWebsocket::Shutdown() void CWebsocket::Close() { Shutdown(); -} \ No newline at end of file +} diff --git a/Lite/WindowState.h b/Lite/WindowState.h index 3a82acd..debb30d 100644 --- a/Lite/WindowState.h +++ b/Lite/WindowState.h @@ -29,7 +29,7 @@ class CWindowState : public CConfigFile::ConfigHandler } void Save(CString& value) { - value.Format("%d,%d,%d,%d,%d", + value.Format(TEXT("%d,%d,%d,%d,%d"), rect.left, rect.top, rect.right,