// 64bit 整数のためのフォーマット文字列を置換する char *ReplaceFormatStringFor64(char *fmt) { char *tmp; char *ret; UINT tmp_size; // 引数チェック if (fmt == NULL) { return NULL; } tmp_size = StrSize(fmt) * 2; tmp = ZeroMalloc(tmp_size); #ifdef OS_WIN32 ReplaceStrEx(tmp, tmp_size, fmt, "%ll", "%I64", false); #else // OS_WIN32 ReplaceStrEx(tmp, tmp_size, fmt, "%I64", "%ll", false); #endif // OS_WIN32 ret = CopyStr(tmp); Free(tmp); return ret; }
// Shift treatment of text input void EmLicenseAddDlgShiftTextItem(HWND hWnd, UINT id1, UINT id2, UINT *next_focus) { char *s; // Validate arguments if (hWnd == NULL || next_focus == NULL) { return; } s = GetTextA(hWnd, id1); if (StrLen(s) >= 6) { char *s2 = CopyStr(s); char tmp[MAX_SIZE]; s2[6] = 0; SetTextA(hWnd, id1, s2); Free(s2); if (id2 != 0) { GetTxtA(hWnd, id2, tmp, sizeof(tmp)); StrCat(tmp, sizeof(tmp), s + 6); ReplaceStrEx(tmp, sizeof(tmp), tmp, "-", "", false); SetTextA(hWnd, id2, tmp); *next_focus = id2; } else { *next_focus = IDOK; } } Free(s); }
// String replaceing (case sensitive) UINT ReplaceStr(char *dst, UINT size, char *string, char *old_keyword, char *new_keyword) { return ReplaceStrEx(dst, size, string, old_keyword, new_keyword, true); }