I'm developing a SDI project with MFC 2010 using the 'new' MFC feature pack to add some stuffs.
The template added me the Calendar bar and Tree bar, pretty unuseful to my application. I removed some of them and replaced one with a CDialogEx derived class and everything works fine.
Now, I want to definitely remove all of old template panel and use mines, but as soon as I remove the code commenting it, the whole control will not show anymore.
Worst part, if I decomment the control still not show. Sometimes, removing the registry key associated will let the control show for just one run.
I'll paste code:
///////////////////////////////////////////> .H File
class CMainFrame : public CFrameWndEx
{
DECLARE_DYNCREATE(CMainFrame)
DECLARE_MESSAGE_MAP()
protected:
CCalendarBar m_wndCalendar; //> Old pane
CEliCUTP140PannelloDlg* m_pPannelloDlg; //> Derived from CDialogEx
CMFCMenuBar m_wndMenuBar;
CMFCOutlookBar m_wndBarraPannelli; //> Outlook bar
CMFCOutlookBarPane* m_pCurrOutlookPage; //> Dunno what's for
CMFCOutlookBarTabCtrl* m_pCurrOutlookWnd; //> Same as above
CMFCShellTreeCtrl m_wndTree; //> Old pane
CMFCStatusBar m_wndStatusBar;
CMFCToolBar m_wndToolBar;
CMFCToolBarImages m_UserImages;
//////////////////////////////////////////> .CPP file.
m_wndBarraPannelli.SetMode2003();
if (strTemp.LoadString(theApp.m_hRisorse, IDS_SHORTCUTS) == FALSE)
{
m_Log.AddString(_T("CMainFrame::CreateOutlookBar - Impossibile caricare la stringa IDS_SHORTCUTS."));
throw CGUIException(E_GE_IMP_CAR_STR);
}
dwOpzioni = WS_CHILD | WS_VISIBLE | CBRS_LEFT;
if (m_wndBarraPannelli.Create(strTemp, this, CRect(0, 0, nInitialWidth, 32000), uiID, dwOpzioni, AFX_CBRS_OUTLOOK_TABS) == FALSE)
return FALSE;
dwStyle = AFX_CBRS_FLOAT | AFX_CBRS_AUTOHIDE | AFX_CBRS_RESIZE;
dwOpzioni = CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC;
m_wndBarraPannelli.SetPaneStyle(m_wndBarraPannelli.GetPaneStyle() | dwOpzioni);
m_wndBarraPannelli.SetButtonsFont(&afxGlobalData.fontBold);
pOutlookBar = (CMFCOutlookBarTabCtrl *)m_wndBarraPannelli.GetUnderlyingWindow();
if (pOutlookBar == NULL)
return FALSE;
pOutlookBar->EnableInPlaceEdit(FALSE);
pOutlookBar->EnableAnimation(TRUE);
pOutlookBar->EnableScrollButtons();
pOutlookBar->SetBorderSize(1);
pOutlookBar->SetPageButtonTextAlign(TA_LEFT);
/* the last panel which I'm trying to remove
const DWORD dwTreeStyle = WS_CHILD | WS_VISIBLE | TVS_HASLINES | TVS_LINESATROOT | TVS_HASBUTTONS;
tree.Create(dwTreeStyle, rectDummy, pOutlookBar, 1200);
if (strTemp.LoadString(theApp.m_hRisorse, IDS_FOLDERS) == FALSE)
{
m_Log.AddString(_T("CMainFrame::CreateOutlookBar - Impossibile caricare la stringa IDS_FOLDERS."));
throw CGUIException(E_GE_IMP_CAR_STR);
}
pOutlookBar->AddControl(&tree, strTemp, 2, TRUE, dwStyle);**/
if (m_pPannelloDlg == NULL)
m_pPannelloDlg = new CEliCUTP140PannelloDlg();
m_pPannelloDlg->m_pSuperParent = this;
bNameValid = m_pPannelloDlg->Create(IDD_ELICUTP140PANNELLODLG, &m_wndBarraPannelli);
m_pPannelloDlg->ShowWindow(SW_SHOW);
if (strTemp.LoadString(theApp.m_hRisorse, IDS_PAN_MOV) == FALSE)
{
m_Log.AddString(_T("CMainFrame::CreateOutlookBar - Impossibile caricare la stringa IDS_PAN_MOV."));
throw CGUIException(E_GE_IMP_CAR_STR);
}
pOutlookBar->AddControl(m_pPannelloDlg, strTemp, 0, TRUE, dwStyle);
m_wndBarraPannelli.ShowWindow(SW_SHOW);
pOutlookBar->SetImageList(theApp.m_bHiColorIcons ? IDB_PAGES_HC : IDB_PAGES, 24);
pOutlookBar->SetToolbarImageList(theApp.m_bHiColorIcons ? IDB_PAGES_SMALL_HC : IDB_PAGES_SMALL, 16);
pOutlookBar->RecalcLayout();
bAnimation = theApp.GetInt(_T("OutlookAnimation"), TRUE);
CMFCOutlookBarTabCtrl::EnableAnimation(bAnimation);
If I should paste extra code let me know.
Any help appreciated.
For those interested in this problem:
SOCIAL MSDN
It's the link to Microsoft's forum with the answer. Moderators can close this topic.
Related
The MFC Wizard created a project with a CWorkSpaceBar which in my case is actually based on CBCGPDockingControlBar, the MFC equivalent is CDockablePane. The wizard also created a m_wndTree based on CBCGPTreeCtrl (CTreeCtrl). It created it in its OnCreate() like this:
CRect rectDummy;
rectDummy.SetRectEmpty();
// Create tree control:
const DWORD dwViewStyle = WS_CHILD | WS_VISIBLE | TVS_HASLINES | TVS_LINESATROOT | TVS_HASBUTTONS | TVS_SHOWSELALWAYS;
if (!m_wndTree.Create(dwViewStyle, rectDummy, this, 1))
{
TRACE0("Failed to create workspace view\n");
return -1; // fail to create
}
Now I would like to handle some of the TreeView notifications so I added these to the CWorkSpaceBar message map:
ON_NOTIFY_REFLECT(TVN_ITEMEXPANDING, &CWorkSpaceBar::OnTvnItemExpanding)
ON_NOTIFY_REFLECT(TVN_GETDISPINFO, &CWorkSpaceBar::OnTvnGetDispInfo)
However, I'm not getting the notification messages? Is there something else I need to do to make it work?
You appear to be confusing the ON_NOTIFY_REFLECT and ON_NOTIFY handlers; or rather, the windows for which those handlers should be defined.
From what you have described, your CWorkSpaceBar class/object is the parent of the tree-view (CTreeCtrl) object; so, when an item is expanded in that tree-view, that parent pane receives a WM_NOTIFY message and the relevant ON_NOTIFY handler (if defined in the message-map) is called. The ON_NOTIFY_REFLECT handler allows the actual tree-view itself to intercept/receive the notification.
In my projects, I have a similar situation, and the class(es) derived from CDockablePane (such as my UserPane) have message map entries like the following, which work as expected:
ON_NOTIFY(TVN_ITEMEXPANDING, IDR_USRTV, &UserPane::OnItemExpand)
Note: The IDR_USRTV is the ID value that I give to the tree-view, in its Create function, as shown below; in your example code, you have used the value of 1 (which may or may not be advisable).
int UserPane::OnCreate(CREATESTRUCT *pCreateStruct)
{
CRect rc; rc.SetRectEmpty();
const DWORD trvstyle = WS_CHILD | WS_VISIBLE |
TVS_HASLINES | TVS_LINESATROOT | TVS_HASBUTTONS | TVS_SHOWSELALWAYS | TVS_EDITLABELS;
if (CDockablePane::OnCreate(pCreateStruct) == -1) return -1;
if (!m_wndTView.Create(trvstyle, rc, this, IDR_USRTV)) return -1;
//...
A basic outline for the OnItemExpand member function is as follows:
void UserPane::OnItemExpand(NMHDR *pNotifyStruct, LRESULT *result)
{
*result = 0;
NMTREEVIEW *pTV = reinterpret_cast<NMTREEVIEW *>(pNotifyStruct);
HTREEITEM hItem = pTV->itemNew.hItem;
uintptr_t itemData = m_wndTView.GetItemData(hItem);
if (pTV->action == TVE_EXPAND) {
//...
}
else if (pTV->action == TVE_COLLAPSE) {
//...
}
return;
}
I have created a SDL2 application, and would like it to minimize to the system tray, rather than appearing in the task bar.
SDL_MinimizeWindow doesn't do what I want, it leaves the task bar icon. Is there a way to achieve this with SDL?
There is no purely SDL2 way to do this, as Cody said, Shell_NotifyIcon is the function needed to create a notification area (system tray) icon.
The code I used to get the icon is
SDL_Window *window = SDL_CreateWindow("Test", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 200, 200, SDL_WINDOW_HIDDEN);
SDL_SysWMinfo info;
SDL_VERSION(&info.version);
NOTIFYICONDATA icon;
if (SDL_GetWindowWMInfo(window, &info))
{
icon.uCallbackMessage = WM_USER + 1;
icon.uFlags = NIF_ICON | NIF_TIP | NIF_MESSAGE;
icon.hIcon = LoadIcon(NULL, IDI_INFORMATION);
icon.cbSize = sizeof(icon);
icon.hWnd = info.info.win.window;
strcpy_s(icon.szTip, "Test tip");
bool success = Shell_NotifyIcon(NIM_ADD, &icon);
}
This creates a hidden window, and an icon (using the default information icon).
To interact with this from SDL, you need to enable platform specific window management events, this is done as follows SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE);
After this, in the main event loop you must test for SDL_SYSWMEVENT, which contains information about how the user has interacted with the notification area icon. This also looks for the minimize event and hides the window which removes it from the task bar. This is achieved in the following snippet
SDL_Event e;
while (SDL_PollEvent(&e) != 0)
{
switch (e.type)
{
case SDL_SYSWMEVENT:
if (e.syswm.msg->msg.win.msg == WM_USER + 1)
{
if (LOWORD(e.syswm.msg->msg.win.lParam) == WM_LBUTTONDBLCLK)
{
SDL_ShowWindow(window);
SDL_RestoreWindow(window);
}
}
break;
case SDL_QUIT:
running = false;
break;
case SDL_WINDOWEVENT:
if (e.window.event == SDL_WINDOWEVENT_MINIMIZED)
SDL_HideWindow(window);
break;
}
}
Latest update:
Well, I found a culprit of some sort. I changed the control to RichEdit20W from the 50W and it displays the Hangul (Korean) now. I did not have to change any other code except for the init, added AfxInitRichEdit2(), and commented out the LoadLibrary(L"MsftEdit.dll"). The AfxInitRichEdit5() is not available for VS2010. All things being equal and Rich Edit 4.1 has been available since VS2005, it should have worked. I can't upgrade to VS2015 right now so I'm stuck. I'm going to offer a bounty though for anybody who can make the Hangul work with 50W and VS2010.
I have a dilemma that I can't seem to solve.
I have an mfc Unicode app that uses CEdit and CRicheditCtrl.
The Rich Edit is 50W loaded from MsftEdit.dll and verified with Spy++
that the class name is RICHEDIT50W.
My problem:
I'm using the same Font Courier New for both the CEdit and CRichEditCtrl.
As a test, I used some of the Hangul symbols to see the output for both
controls.
CEdit outputs ᄀᄁᄂᄃᄄᄅᄆᄇᄈ
while the
CRichEditCtrl outputs a box for each character, like there is no glyph for it.
If they are using the same font, shouldn't I see the same output characters?
I think that font-binding is not a problem, both have the same default font.
Can anybody solve this riddle ?
Thanks in advance!
Note that this happens with some other character sets as well, not just Hangul
Update
I looked at the VS2010 WordPad example, it uses CRichEditView but it
provides wrappers to access the embedded CRichEditCtrl.
I thought I could glean some info but I can't see how they are doing the
Rich Edit control calls.
This is how I am generating the font's for both controls.
But, I'm showing specifically the Rich Edit part.
The doc's say that Font binding should handle switching from the default
font to the font at the current insertion point.
I am doing insertion mostly at the end using
ctrl.SetSel(-1,-1);
ctrl.ReplaceSel( str );
And, according to the doc's, this should change to the correct font as needed,
if other than the default font.
In the WordPad sample, if I paste in the Hangul text, the font switches to
Gulim.
Here is my code:
LOGFONT lf;
int pitch = 10;
memset(&lf, 0, sizeof(LOGFONT));
HDC hdc = ::GetDC(NULL);
lf.lfHeight = -MulDiv( pitch, GetDeviceCaps(hdc, LOGPIXELSY), 72);
lf.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
lstrcpy(lf.lfFaceName, _T("Courier New") );
lf.lfWeight = FW_NORMAL;
lf.lfCharSet = ANSI_CHARSET; // English, but use DEFAULT_CHARSET if not
lf.lfQuality = DEFAULT_QUALITY;
if ( !m_Font.CreateFontIndirect(&lf) )
{ // Ours didn't work, create a system default fixed font
// ( Ignore, example for post only. Never gets called though )
//memset(&lf, 0, sizeof(LOGFONT));
//::GetObject(GetStockObject(ANSI_FIXED_FONT), sizeof(LOGFONT), &lf);
//m_Font.CreateFontIndirect(&lf);
}
// Save the generated Font LOGFONT
m_lf = lf;
// Set the default Font CHARFORMAT2
memset( &m_cfDefaultFont, 0, sizeof(m_cfDefaultFont) );
m_cfDefaultFont.cbSize = sizeof(m_cfDefaultFont);
m_cfDefaultFont.dwMask = CFM_CHARSET | CFM_FACE | CFM_WEIGHT ;
m_cfDefaultFont.bCharSet = m_lf.lfCharSet;
lstrcpy( m_cfDefaultFont.szFaceName, m_lf.lfFaceName );
m_cfDefaultFont.wWeight = m_lf.lfWeight;
// Finally set the font in the controls
m_RichEdit.SetFont( &m_Font );
// Same effect as m_RichEdit.SetFont()
//m_RichEdit.SendMessage(EM_SETCHARFORMAT, SCF_ALL, &m_cfDefaultFont);
// This displays nothing but 'box' glyphs
m_RichEdit.SetWindowTextW(_T("ᄃᄄᄅᄆᄇᄈᄉᄊᄋᄌᄍᄎ"));
Update 2
This is how I initialize the Rich Edit in the app.
And shows the usage of 50W in a dialog control.
-- winapp.cpp
BOOL CMyApp::InitInstance()
{
// ...... //
CString strRichEdit = _T("Msftedit.dll");
m_hMsfteditDll = AfxLoadLibrary( strRichEdit );
if ( m_hMsfteditDll == NULL )
{
CString str;
str.Format(_T("Error: Cannot find Rich Edit component %s"), strRichEdit );
AfxMessageBox(str);
return FALSE;
}
return TRUE;
}
int CRegexFormatApp::ExitInstance()
{
if ( m_hMsfteditDll != NULL )
AfxFreeLibrary( m_hMsfteditDll );
return CWinAppEx::ExitInstance();
}
// =========================
-- .rc
CONTROL "",IDC_RICH_EDIT,"RICHEDIT50W",WS_VSCROLL | WS_HSCROLL,40,15,148,28
-- Dlg.h
CRichEditCtrl m_RichEdit;
-- Dlg.cpp
void Dlg::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
DDX_Control(pDX, IDC_RICH_EDIT, m_RichEdit); // Use .rc setting to Create/Attach
}
BOOL Dlg::OnInitDialog()
{
CDialogEx::OnInitDialog();
CreateAndSetRichFont(); // Code shown above
m_RichEdit.SetWindowTextW( ... );
}
This code should work in a Unicode project:
BOOL CMyApp::InitInstance()
{
CWinApp::InitInstance();
LoadLibrary(L"MsftEdit.dll");
...
}
BOOL CMyDialog::OnInitDialog()
{
CDialog::OnInitDialog();
static CRichEditCtrl redit;
CWnd *wnd = &redit;
wnd->Create(MSFTEDIT_CLASS, L"ᄃᄄᄅᄆᄇᄈᄉᄊᄋᄌᄍᄎ",
WS_CHILD | WS_VISIBLE, CRect(0,0,300,300), this, 1001, 0);
...
//redit is not to be mixed up with controls created in dialog editor.
}
Edit ----------------
NONCLIENTMETRICS info = { sizeof(info) };
SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(info), &info, 0);
LOGFONT logfont = info.lfMessageFont;
//CClientDC has automatic cleanup, use it instead of GetDC
CClientDC dc(this);
logfont.lfHeight = -MulDiv(abs(logfont.lfHeight), dc.GetDeviceCaps(LOGPIXELSY), 76);
CFont font;
font.CreateFontIndirect(&logfont);
m_RichEdit.SetFont(&font);
m_RichEdit.SetWindowText(L"ᄃᄄᄅᄆᄇᄈᄉᄊᄋᄌᄍᄎ");
m_RichEdit.SetSel(1, 1);
CString test = L"(Test, ελληνικά)";
//Test to make sure we can see Unicode text
AfxMessageBox(test);
m_RichEdit.ReplaceSel(test);
//optional:
//get default CHARFORMAT
CHARFORMAT2 charFormat;
//m_RichEdit.GetSelectionCharFormat(charFormat);
m_RichEdit.GetDefaultCharFormat(charFormat);
I am developing a visual c++ applicatio(x64). what actually i am trying to do is that suppose we have a html file in window explorer(i mean file with file extension ".html"). when we single click on it we get its preview on preview pane(so we don't need to open this file we can see the file in preview pane on a single click to a file).
I have developed a similar type of application but in my case when i click on the "html file" i just get the code of that html file in preview pane(the code which you can see if you open that html file in notepad). which is not expected to happen but I want to have the preview of that "html file" not the code of that html file.
I think i need to host some browser control which will transform my html code in preview pane to the display of html file(If i am correct ???) How to do that ??
Here is my code for that-
IHTMLDocument2 * pDoc=NULL;
HRESULT hr2 = CoCreateInstance(CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER, IID_IHTMLDocument2, (LPVOID *) &pDoc);
if (pDoc)
{
IPersistStreamInit *pPersist = NULL;
pDoc->QueryInterface(IID_IPersistStreamInit,(LPVOID *) &pPersist);
if (pPersist)
{
IMarkupServices *pMS = NULL;
pPersist->InitNew();
pPersist->Release();
pDoc->QueryInterface(IID_IMarkupServices,(LPVOID *) &pMS);
if (pMS)
{
IMarkupContainer *pMC = NULL;
IMarkupPointer *pMkStart = NULL;
IMarkupPointer *pMkFinish = NULL;
pMS->CreateMarkupPointer(&pMkStart);
pMS->CreateMarkupPointer(&pMkFinish);
pMS->ParseString(HtmlFileContents,0,&pMC,pMkStart,pMkFinish);
//this HtmlFileContents is actually a buffer of olechar type which contains the code of html file (the code which you see when you open the html file in notepad)
if (pMC)
{
IHTMLDocument2 *pNewDoc = NULL;
pMC->QueryInterface(IID_IHTMLDocument,(LPVOID *) &pNewDoc);
if (pNewDoc)
{
IHTMLElement *pBody;
pNewDoc->get_body(&pBody);
if (pBody)
{
BSTR strText;
pBody->get_innerText(&strText);
hr = instance->CreatePreviewWindowForHtml(strText); // this function is responsible for displaying the html file in window. you can see its definition below after this code.
SysFreeString(strText);
pBody->Release();
}
pNewDoc->Release();
}
pMC->Release();
}
if (pMkStart)
pMkStart->Release();
if (pMkFinish)
pMkFinish->Release();
pMS->Release();
pMS->Release();
}
}
pDoc->Release();
}
return true;
and the function defintion of CreatePreviewWindowForHtml() is as below-
CreatePreviewWindowForHtml(PCWSTR pszRtfWide)
{
assert(m_hwndPreview3 == NULL);
HRESULT hr = E_FAIL;
if (m_hwndPreview3 == NULL)
{
HRESULT hr5 = HRESULT_FROM_WIN32(GetLastError());
}
if (m_hinstEditLibrary == NULL)
{
// MSFTEDIT_CLASS used below comes from this binary
m_hinstEditLibrary = LoadLibraryW(L"msftedit.dll");
}
if (m_hinstEditLibrary == NULL)
{
hr = HRESULT_FROM_WIN32(GetLastError());
}
else
{
// Create the preview window
HWND pr = m_hwndPreview3 = CreateWindowExW(0, MSFTEDIT_CLASS, NULL,
WS_CHILD | WS_VSCROLL | WS_VISIBLE | ES_MULTILINE | ES_READONLY, // Always create read-only
m_rcParent.left, m_rcParent.top, RECTWIDTH(m_rcParent), RECTHEIGHT(m_rcParent),
m_hwndPreview, NULL, NULL,NULL);
if (m_hwndPreview3 == NULL)
{
MessageBoxA(m_hwndPreview3,strerror(hr),"BTN WND2", MB_ICONINFORMATION);
}
else
{
int const cchRtf = 1 + wcslen(pszRtfWide);
PSTR pszRtf = (PSTR)CoTaskMemAlloc(cchRtf);
if (pszRtf)
{
WideCharToMultiByte(CP_ACP, 0, pszRtfWide, cchRtf, pszRtf, cchRtf, NULL, NULL);
SETTEXTEX st = { ST_DEFAULT, CP_ACP };
LRESULT hr4=SendMessage(m_hwndPreview3, EM_SETTEXTEX, (WPARAM) &st, (LPARAM) pszRtfWide);
if (SUCCEEDED(hr4))
{
hr = AdjustDialogPositionAndSize();
SendMessage(m_hwndPreview3, EM_SETTEXTEX, (WPARAM) &st, (LPARAM) pszRtfWide);
}
CoTaskMemFree(pszRtf);
hr = S_OK;
}
else
{
hr = E_OUTOFMEMORY;
}
}
}
return hr;
}
Any ideas why i have the html code in my window ?? What to do in the code in order to get the preview of html file in my window rather then html code ??
Please tell me if any doubts in understanding me ??
You have the html code in your window because you choose a richedit as the text renderer and your text did not start with "{\rtf".
If you want html display, you need an html renderer instead of a rich edit, something like MFC's CHtmlEditCtrl. If you don't want to use MFC you can write an ActiveX container to host the webbrowser control directly.
The code below should show a custom context menu item when the user right clicks on a "Project" and a different custom context menu item when the user clicks on a "Folder" in Visual Studio 2010 Solution Explorer.
The first part is working just fine - hello new Menu Item yey! - the second part when the user right clicks on Folder - isn't - it always displays the standard old context menu without the new menu item.
Any idea where I'm going wrong? It's ok to create two Command objects, right?
public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
_applicationObject = (DTE2)application;
_addInInstance = (AddIn)addInInst;
if(connectMode == ext_ConnectMode.ext_cm_UISetup)
{
object []contextGUIDS = new object[] { };
Commands2 commands = (Commands2)_applicationObject.Commands;
CommandBars cBars = (CommandBars)_applicationObject.CommandBars;
try
{
Command commandProjectSettings = commands.AddNamedCommand2(_addInInstance, "DavecProjectSchemaSettings", "Davec Project Settings", "Manages Database Project Settings", false, 1, ref contextGUIDS, (int)vsCommandStatus.vsCommandStatusSupported+(int)vsCommandStatus.vsCommandStatusEnabled, (int)vsCommandStyle.vsCommandStylePictAndText, vsCommandControlType.vsCommandControlTypeButton);
Command commandAddSchemaUpdate = commands.AddNamedCommand2(_addInInstance, "DavecProjectUpdate", "Davec Update", "Updates Database Schema", false, 2, ref contextGUIDS, (int)vsCommandStatus.vsCommandStatusSupported + (int)vsCommandStatus.vsCommandStatusEnabled, (int)vsCommandStyle.vsCommandStylePictAndText, vsCommandControlType.vsCommandControlTypeButton);
CommandBar vsBarProject = cBars["Project"];
CommandBar vsBarFolder = cBars["Folder"];
commandProjectSettings.AddControl(vsBarProject, 1);
commandAddSchemaUpdate.AddControl(vsBarFolder, 1);
}
catch(System.ArgumentException)
{
//ignore
}
_solutionEvents = _applicationObject.Events.SolutionEvents;
_solutionEvents.Opened += new _dispSolutionEvents_OpenedEventHandler(SolutionEvents_Opened);
_documentEvents = _applicationObject.Events.DocumentEvents;
_documentEvents.DocumentSaved += new _dispDocumentEvents_DocumentSavedEventHandler(_documentEvents_DocumentSaved);
}
}
I needed to include new command in the QueryStatus method, which is called when the command's availability is updated i.e.
public void QueryStatus(string commandName, vsCommandStatusTextWanted neededText, ref vsCommandStatus status, ref object commandText)
{
if(neededText == vsCommandStatusTextWanted.vsCommandStatusTextWantedNone)
{
if (commandName == "Sappha.Davec.VSAddIn.Connect.DavecProjectSchemaSettings")
{
status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported|vsCommandStatus.vsCommandStatusEnabled;
return;
}
if (commandName == "Sappha.Davec.VSAddIn.Connect.DavecProjectUpdate")
{
status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled;
return;
}
}
}