扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:IUNKNOW 来源:vchelp 2007年10月21日
关键字:
HRESULT CCopyright::OnConnection(IApplication* pApp, VARIANT_BOOL bFirstTime, long dwAddInID, VARIANT_BOOL* bOnConnection) { HRESULT hr = S_OK; m_spApplication = pApp; m_dwAddInID = dwAddInID; // Connect up to application event sink AtlAdvise(pApp, GetUnknown(), IID_IApplicationEvents, &m_dwAppEvents); hr = pApp->SetAddInInfo((long)_Module.GetModuleInstance(), static_cast<ICopyright*>(this), IDB_TOOLBAR_MEDIUM_COPYRIGHT, IDB_TOOLBAR_LARGE_COPYRIGHT, dwAddInID); // LPCTSTR szCommand = _T("ShowInfoDlg"); VARIANT_BOOL bRet; if (SUCCEEDED(hr)) { hr = pApp->AddCommand(CComBSTR(_T("ShowInfoDlgÏÔʾ ÐÞ¸ÄÓûµÄ æȨÐÅÏ¢ Ð޸İæÈ ÐÅÏ¢")),CComBSTR(_T("ShowInfoDlg")), 0, dwAddInID, &bRet); hr = pApp->AddCommand(CComBSTR(_T("MiniWindow\nËõС \n×îС»¯ËÓеĴ ¿ÚîС»¯´°¿Ú")), CComBSTR(_T("MiniWindow")), 1, dwAddInID, &bRet); hr = pApp->AddCommand(CComBSTR(_T("MaxWindow\n·Å´ î´»¯ËÓеĴ ¿Úî´»¯´ ¿Ú")),CComBSTR(_T("MaxWindow")), 2, dwAddInID, &bRet); hr = pApp->AddCommand(CComBSTR(_T("Test\nTest\nTest\nTest")),CComBSTR(_T("Test")), 3, dwAddInID, &bRet); } // Add toolbar buttons only if this is the first time the add-in // is being loaded. Toolbar buttons are automatically remembered // by Developer Studio from session to session, so we should only // add the toolbar buttons once. if (bFirstTime) { if (SUCCEEDED(hr)) { hr = pApp->AddCommandBarButton(dsGlyph, CComBSTR(_T("ShowInfoDlg")), dwAddInID); hr = pApp->AddCommandBarButton(dsGlyph, CComBSTR(_T("MiniWindow")), dwAddInID); hr = pApp->AddCommandBarButton(dsGlyph, CComBSTR(_T("MaxWindow")), dwAddInID); hr = pApp->AddCommandBarButton(dsGlyph, CComBSTR(_T("Test")), dwAddInID); } } // CRegKey reg; TCHAR strName[256]; DWORD dwSize = 256,dwRet = 0; reg.Create(HKEY_CURRENT_USER,_T("Software\\Evesoft\\Addins")); dwRet = reg.QueryValue(strName,_T("NAME"),&dwSize); if(dwRet != ERROR_SUCCESS || lstrlen(strName) == 0) m_bstrName = _T("Evelan"); else m_bstrName = strName; dwSize = 100; dwRet = reg.QueryValue(strName,_T("EMAIL"),&dwSize); if(dwRet != ERROR_SUCCESS || lstrlen(strName) == 0) m_bstrEmail = _T("dbw.evelan@263.net"); else m_bstrEmail = strName; // *bOnConnection = SUCCEEDED(hr) ? VARIANT_TRUE :VARIANT_FALSE; return hr; } HRESULT CCopyright::OnDisconnection(VARIANT_BOOL bLastTime) { AtlUnadvise(m_spApplication, IID_IApplicationEvents, m_dwAppEvents); return S_OK; } |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者