C
chetan
Can anybody help me solve following problem? Please try
I have added sub menu in File menu. It is getting added at the botto
of the list. I want to set proper position say to positon 3. How can
set proper position?
I have written code in VC++. Following is code how I am adding menu
//////////////////////////
vtParam.vt = VT_BSTR;
vtParam.bstrVal = ::SysAllocString(L"File");
hr = CallMethod(vtCmdBars.pdispVal, L"Item", &vtCmdBar, 1, &vtParam);
VariantClear(&vtParam);
m_pOurCmdBar = vtCmdBar.pdispVal;
m_pOurCmdBar->AddRef();
hr = GetProperty(m_pOurCmdBar, L"Controls", &vtCtrls);
vtParam.vt = VT_BSTR; vtParam.bstrVal = ::SysAllocString(L"My Menu");
hr = CallMethod(vtCtrls.pdispVal, L"Item", &vtButton, 1, &vtParam);
VariantClear(&vtParam);
// If we can't find it, make a new button...
if(FAILED(hr)){
vtParam.vt = VT_I4; vtParam.lVal = 1;
hr = CallMethod(vtCtrls.pdispVal, L"Add", &vtButton, 1
&vtParam);
if (FAILED(hr)) goto cleanup;
....
}
///////////////////////
I have added sub menu in File menu. It is getting added at the botto
of the list. I want to set proper position say to positon 3. How can
set proper position?
I have written code in VC++. Following is code how I am adding menu
//////////////////////////
vtParam.vt = VT_BSTR;
vtParam.bstrVal = ::SysAllocString(L"File");
hr = CallMethod(vtCmdBars.pdispVal, L"Item", &vtCmdBar, 1, &vtParam);
VariantClear(&vtParam);
m_pOurCmdBar = vtCmdBar.pdispVal;
m_pOurCmdBar->AddRef();
hr = GetProperty(m_pOurCmdBar, L"Controls", &vtCtrls);
vtParam.vt = VT_BSTR; vtParam.bstrVal = ::SysAllocString(L"My Menu");
hr = CallMethod(vtCtrls.pdispVal, L"Item", &vtButton, 1, &vtParam);
VariantClear(&vtParam);
// If we can't find it, make a new button...
if(FAILED(hr)){
vtParam.vt = VT_I4; vtParam.lVal = 1;
hr = CallMethod(vtCtrls.pdispVal, L"Add", &vtButton, 1
&vtParam);
if (FAILED(hr)) goto cleanup;
....
}
///////////////////////