int IsCaseMixed(const char *Str) { while (*Str && !IsCharAlpha(*Str)) Str++; int Case=IsCharLower(*Str); while (*(Str++)) if (IsCharAlpha(*Str) && IsCharLower(*Str)!=Case) return TRUE; return FALSE; }
int main() { char buffer[261]; // Buffert fцr inmatad text DWORD count; DWORD dw; HANDLE hIn = GetStdHandle(STD_INPUT_HANDLE); HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE); for (;;) { // Lеt anv skriva in text if (!ReadFile(hIn, buffer, sizeof(buffer)-1, &count, NULL)) break; if (count == 0) break; buffer[count] = 0; // Vandra genom strдngen sе lдnge tecknet vi дr pе // inte дr ascii 0. for (count=0; buffer[count]; ++count) // Kolla tecknet vi дr pе. Fцr varje едц≈ƒ÷ skrivs // dess motsvarighet, annars tecknet i strдngen. // Hдnsyn tas till om nдsta tecken дr lowercase. I // sе fall blir ≈ Aa istдllet fцr AA. switch (buffer[count]) { case 'Ж': lputs(hOut, "aa"); break; case 'Д': lputs(hOut, "ae"); break; case 'Ф': lputs(hOut, "oe"); break; case 'П': lputs(hOut, IsCharLower(buffer[count+1]) ? "Aa" : "AA"); break; case 'О': lputs(hOut, IsCharLower(buffer[count+1]) ? "Ae" : "AE"); break; case 'Щ': lputs(hOut, IsCharLower(buffer[count+1]) ? "Oe" : "OE"); break; default: WriteFile(hOut, buffer+count, 1, &dw, NULL); } } ExitProcess(0); }
// Funções Internas //=========================================================================== void TapePegaTitulo(char *NomeImagem) { BOOL found = 0; int loop = 0; char imagetitle[128]; char* startpos = NomeImagem; if (strrchr(startpos,'\\')) startpos = strrchr(startpos,'\\')+1; strncpy(imagetitle, startpos, 127); imagetitle[127] = 0; while (imagetitle[loop] && !found) if (IsCharLower(imagetitle[loop])) found = 1; else loop++; if ((!found) && (loop > 2)) CharLowerBuff(imagetitle+1, strlen(imagetitle+1)); strncpy(NomeTitulo, imagetitle, 127); NomeTitulo[127] = 0; if (imagetitle[0]) { char *dot = imagetitle; if (strrchr(dot,'.')) dot = strrchr(dot,'.'); if (dot > imagetitle) *dot = 0; } strncpy(NomeTitulo, imagetitle, 30); NomeTitulo[30] = 0; }
void Invert(TCHAR *str) { while (*str) { if (IsCharUpper(*str)) *str = (TCHAR)CharLower((LPTSTR)*str); else if (IsCharLower(*str)) *str = (TCHAR)CharUpper((LPTSTR)*str); str++; } keybd_event(VK_CAPITAL, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0); keybd_event(VK_CAPITAL, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0); }
//****************************************************************** void CBCGPKeyHelper::AddVirtKeyStr (CString& str, UINT uiVirtKey, BOOL bLast) const { CString strKey; if (uiVirtKey == VK_PAUSE) { strKey = _T("Pause"); } else { #define BUFFER_LEN 50 TCHAR szBuffer [BUFFER_LEN + 1]; ZeroMemory (szBuffer, sizeof (szBuffer)); UINT nScanCode = ::MapVirtualKeyEx (uiVirtKey, 0, ::GetKeyboardLayout (0)) <<16 | 0x1; if (uiVirtKey >= VK_PRIOR && uiVirtKey <= VK_HELP) { nScanCode |= 0x01000000; } ::GetKeyNameText (nScanCode, szBuffer, BUFFER_LEN); strKey = szBuffer; } strKey.MakeLower(); //-------------------------------------- // The first letter should be uppercase: //-------------------------------------- for (int nCount = 0; nCount < strKey.GetLength(); nCount++) { TCHAR c = strKey[nCount]; if (IsCharLower (c)) { c = (TCHAR) toupper (c); // Convert single character JY 4-Dec-99 strKey.SetAt (nCount, c); break; } } str += strKey; if (!bLast) { str += '+'; } }
//****************************************************************** void CBCGKeyHelper::AddVirtKeyStr (CStringW& str, UINT uiVirtKey, BOOL bLast) const { // // This file was modified by Sven Ritter // #define BUFFER_LEN 50 TCHAR szBuffer [BUFFER_LEN + 1]; TRACE("KeyboardLayout: 0x%x\n", ::GetKeyboardLayout (0)); UINT nScanCode = ::MapVirtualKeyEx (uiVirtKey, 0, ::GetKeyboardLayout (0)) <<16 | 0x1; if (uiVirtKey >= VK_PRIOR && uiVirtKey <= VK_HELP) { nScanCode |= 0x01000000; } ::GetKeyNameText (nScanCode, szBuffer, BUFFER_LEN); CStringW strKey(szBuffer); strKey.MakeLower(); //-------------------------------------- // The first letter should be uppercase: //-------------------------------------- for (int nCount = 0; nCount < strKey.GetLength(); nCount++) { TCHAR c = strKey[nCount]; if (IsCharLower (c)) { c = (TCHAR) toupper (c); // Convert single character JY 4-Dec-99 strKey.SetAt (nCount, c); break; } } str += strKey; if (!bLast) { str += '+'; } }
TCHAR * AutoReplaceMap::autoReplace(const TCHAR * word) { scoped_free<TCHAR> from = _tcslwr(_tcsdup(word)); if (replacements.find(from.get()) == replacements.end()) return NULL; AutoReplacement &ar = replacements[from.get()]; TCHAR *to; if (ar.useVariables) to = variables_parsedup((TCHAR *) ar.replace.c_str(), (TCHAR *) word, NULL); else to = _tcsdup(ar.replace.c_str()); // Wich case to use? size_t len = lstrlen(word); size_t i; for (i = 0; i < len; i++) if (IsCharLower(word[i])) break; if (i <= 0) { // All lower return to; } else if (i >= len) { // All upper return CharUpper(to); } else { // First upper TCHAR tmp[2]; tmp[0] = to[0]; tmp[1] = _T('\0'); CharUpper(tmp); to[0] = tmp[0]; return to; } }
static void GetImageTitle(LPCTSTR imagefilename, Disk_t* fptr) { TCHAR imagetitle[ MAX_DISK_FULL_NAME+1 ]; LPCTSTR startpos = imagefilename; // imagetitle = <FILENAME.EXT> if (_tcsrchr(startpos,TEXT('\\'))) startpos = _tcsrchr(startpos,TEXT('\\'))+1; _tcsncpy(imagetitle,startpos,MAX_DISK_FULL_NAME); imagetitle[MAX_DISK_FULL_NAME] = 0; // if imagetitle contains a lowercase char, then found=1 (why?) BOOL found = 0; int loop = 0; while (imagetitle[loop] && !found) { if (IsCharLower(imagetitle[loop])) found = 1; else loop++; } if ((!found) && (loop > 2)) CharLowerBuff(imagetitle+1,_tcslen(imagetitle+1)); // fptr->fullname = <FILENAME.EXT> _tcsncpy( fptr->fullname, imagetitle, MAX_DISK_FULL_NAME ); fptr->fullname[ MAX_DISK_FULL_NAME ] = 0; if (imagetitle[0]) { LPTSTR dot = imagetitle; if (_tcsrchr(dot,TEXT('.'))) dot = _tcsrchr(dot,TEXT('.')); if (dot > imagetitle) *dot = 0; } // fptr->imagename = <FILENAME> (ie. no extension) _tcsncpy( fptr->imagename, imagetitle, MAX_DISK_IMAGE_NAME ); fptr->imagename[ MAX_DISK_IMAGE_NAME ] = 0; }
static void GetImageTitle (LPCTSTR imagefilename, PHDD pHardDrive) { TCHAR imagetitle[128]; LPCTSTR startpos = imagefilename; // imagetitle = <FILENAME.EXT> if (_tcsrchr(startpos,FILE_SEPARATOR)) startpos = _tcsrchr(startpos,FILE_SEPARATOR)+1; _tcsncpy(imagetitle,startpos,127); imagetitle[127] = 0; // if imagetitle contains a lowercase char, then found=1 (why?) BOOL found = 0; int loop = 0; while (imagetitle[loop] && !found) { if (IsCharLower(imagetitle[loop])) found = 1; else loop++; } // commented by me, bb! ^_^ // if ((!found) && (loop > 2)) // CharLowerBuff(imagetitle+1,_tcslen(imagetitle+1)); // fptr->fullname = <FILENAME.EXT> _tcsncpy(pHardDrive->hd_fullname,imagetitle,127); pHardDrive->hd_fullname[127] = 0; if (imagetitle[0]) { LPTSTR dot = imagetitle; if (_tcsrchr(dot,TEXT('.'))) dot = _tcsrchr(dot,TEXT('.')); if (dot > imagetitle) *dot = 0; } // fptr->imagename = <FILENAME> (ie. no extension) _tcsncpy(pHardDrive->hd_imagename,imagetitle,15); pHardDrive->hd_imagename[15] = 0; }
__declspec(dllexport) LRESULT CALLBACK procCharMsg(int nCode, WPARAM wParam, LPARAM lParam){ MSG *msg; char charCode; if (nCode >= 0 && nCode == HC_ACTION){ msg = (MSG *)lParam; //lParam contains pointer to MSG structure. //we handle only WM_CHAR messages if (msg->message == WM_CHAR){ charCode = msg->wParam; //For WM_CHAR message, wParam is the character code of the key pressed //we check if the character pressed is a small letter if (IsCharLower(charCode)){ charCode -= 32; //if so, make it to capital letter msg->wParam = (WPARAM)charCode; //overwrite the msg structure's wparam } } } return CallNextHookEx(hkKey, nCode, wParam, lParam); }
bool is_lower(wchar_t Char) { return IsCharLower(Char) != FALSE; }
int LIsLower (unsigned Ch) { unsigned char c = Ch; OemToCharBuff ((char *) &c, (char *) &c, 1); return IsCharLower (c); }
inline int IsLower(wchar_t Ch) { return IsCharLower(Ch); }
inline int __cdecl IsLower(wchar_t Ch) { return IsCharLower(Ch); }