This is for the status bar and things like that:
| 1656 | |
| 1657 | // This is for the status bar and things like that: |
| 1658 | STDMETHODIMP CShellExt::GetCommandString(UINT_PTR idCmd, UINT uFlags, UINT FAR * /*reserved*/, LPSTR pszName, UINT cchMax) |
| 1659 | { |
| 1660 | PreserveChdir preserveChdir; |
| 1661 | //do we know the id? |
| 1662 | std::map<UINT_PTR, TGitShellCommand>::const_iterator id_it = myIDMap.lower_bound(idCmd); |
| 1663 | if (id_it == myIDMap.end() || id_it->first != idCmd) |
| 1664 | { |
| 1665 | return E_INVALIDARG; //no, we don't |
| 1666 | } |
| 1667 | |
| 1668 | LoadLangDll(); |
| 1669 | HRESULT hr = E_INVALIDARG; |
| 1670 | |
| 1671 | MAKESTRING(IDS_MENUDESCDEFAULT); |
| 1672 | for (auto& menuItem : GetTGitMenuInfo()) |
| 1673 | { |
| 1674 | if (menuItem.command == static_cast<TGitShellCommand>(id_it->second)) |
| 1675 | { |
| 1676 | MAKESTRING(menuItem.menuDescID); |
| 1677 | break; |
| 1678 | } |
| 1679 | } |
| 1680 | |
| 1681 | const wchar_t* desc = stringtablebuffer; |
| 1682 | switch(uFlags) |
| 1683 | { |
| 1684 | case GCS_HELPTEXTA: |
| 1685 | { |
| 1686 | std::string help = WideToMultibyte(desc); |
| 1687 | lstrcpynA(pszName, help.c_str(), cchMax - 1); |
| 1688 | hr = S_OK; |
| 1689 | break; |
| 1690 | } |
| 1691 | case GCS_HELPTEXTW: |
| 1692 | { |
| 1693 | std::wstring help = desc; |
| 1694 | lstrcpynW(reinterpret_cast<LPWSTR>(pszName), help.c_str(), cchMax - 1); |
| 1695 | hr = S_OK; |
| 1696 | break; |
| 1697 | } |
| 1698 | case GCS_VERBA: |
| 1699 | { |
| 1700 | const auto verb_id_it = myVerbsIDMap.lower_bound(idCmd); |
| 1701 | if (verb_id_it != myVerbsIDMap.end() && verb_id_it->first == idCmd) |
| 1702 | { |
| 1703 | std::string help = WideToMultibyte(verb_id_it->second); |
| 1704 | lstrcpynA(pszName, help.c_str(), cchMax - 1); |
| 1705 | hr = S_OK; |
| 1706 | } |
| 1707 | } |
| 1708 | break; |
| 1709 | case GCS_VERBW: |
| 1710 | { |
| 1711 | const auto verb_id_it = myVerbsIDMap.lower_bound(idCmd); |
| 1712 | if (verb_id_it != myVerbsIDMap.end() && verb_id_it->first == idCmd) |
| 1713 | { |
| 1714 | std::wstring help = verb_id_it->second; |
| 1715 | CTraceToOutputDebugString::Instance()(__FUNCTION__ ": verb : %ws\n", help.c_str()); |
nothing calls this directly
no test coverage detected