// register extension key // ex) HKEY_CLASSES_ROOT // * // Shell // Watched // command - "d:\Development\project\FileMarker\Debug\FileMarker.exe" "-p [watched]" "-r [watched]" "%1" bool CRegisterMenu::RegisterExtKey(const tstring& strExt, const tstring& strMenu, const tstring& strMenuDisplay, const tstring& strCommand ) { LPCTSTR strSubKeys[] = { strExt.c_str(), _T("shell"), strMenu.c_str(), _T("command") }; LPCTSTR strValues[] = { _T(""), _T(""), strMenuDisplay.c_str(), strCommand.c_str() }; tstring strSubKey; tstring strValue; for (int i = 0; i < _countof(strSubKeys); ++i) { strSubKey += strSubKeys[i]; strSubKey += _T("\\"); strValue = strValues[i]; if (!RegisterMenu(strSubKey, strValue)) return false; } return true; }
void ofxClickDownMenu::RegisterMenu(string Menu){ if ((menus.size() > 0)&&(menus[menus.size()-1].message == " X Cancel")){ menus.pop_back(); } ofxCDMButton bt; bt.message = Menu; bt.isBranch = false; bt.isFader = false; menus.push_back(bt); if (menus[menus.size()-1].message != " X Cancel") RegisterMenu(" X Cancel"); window_size.y = menus.size()*20; window_size.x = MAX(bt.message.length()*9,window_size.x); }
// HKEY_CLASSES_ROOT // FileMarker.AVI - AVI - Windows 기본 비디오 파일 // shell // Mark - Daum 팟플레이어의 재생목록(&I)에 추가하기 // command - "C:\Program Files (x86)\DAUM\PotPlayer\PotPlayer.exe" "%1" /ADD bool CRegisterMenu::Register(const tstring& strAppName, tstring strExt, tstring strMenu, tstring strMenuDisplay, tstring strCommand, tstring strDesc) { if (strAppName.empty() || strExt.empty() || strDesc.empty() || strMenu.empty() || strMenuDisplay.empty() || strCommand.empty()) return false; if (!RegisterExtKey(strExt, strMenu, strMenuDisplay, strCommand)) return false; // remove '.' strExt.erase(std::remove(strExt.begin(), strExt.end(), _T('.')), strExt.end()); // Uppercase extension CStringUtil::MakeUpper(strExt); tstring strAppExt = strAppName + _T(".") + strExt; LPCTSTR strSubKeys[] = { strAppExt.c_str(), _T("shell"), strMenu.c_str(), _T("command") }; LPCTSTR strValues[] = { strDesc.c_str(), _T(""), strMenuDisplay.c_str(), strCommand.c_str() }; tstring strSubKey; tstring strValue; for (int i = 0; i < _countof(strSubKeys); ++i) { strSubKey += strSubKeys[i]; strSubKey += _T("\\"); strValue = strValues[i]; if (!RegisterMenu(strSubKey, strValue)) return false; } // SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_FLUSH, NULL, NULL); return true; }
void ofxClickDownMenu::RegisterBranch(string Menu, vector<string> *Menus){ if ((menus.size() > 0)&&(menus[menus.size()-1].message == " X Cancel")){ menus.pop_back(); } ofxCDMButton bt; bt.message = Menu; bt.isBranch = true; bt.isFader = false; for (int i = 0;i < Menus->size();i++){ bt.branchmenu.push_back((*Menus)[i]); } bt.branchmenu.push_back("<< Back"); menus.push_back(bt); if (menus[menus.size()-1].message != " X Cancel") RegisterMenu(" X Cancel"); window_size.y = menus.size()*20; window_size.x = MAX(bt.message.length()*9,window_size.x); }
MenuManager::MenuManager(const void* appId) :mAppId(appId) { RegisterMenu(); }