473,396 Members | 2,011 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

shell extension

I used function:

BOOL InsertMenuItem( HMENU hMenu,
UINT uItem,
BOOL fByPosition,
LPCMENUITEMINFO lpmii
);

to add consecutive menu elements in QueryContextMenu() shell interface.
After adding all of them only first one i displyed. I added MF_STRING type
menues.

I checked through debugger, they all are present there in menu.
If i try adding consecutive popup menues it works fine and can add as many
as I want.
Only MF_STRING type menus wont work. Only first inserted menu item is
shown. :-(

Thanks for help, Rajko.

Nov 17 '05 #1
5 1182
>to add consecutive menu elements in QueryContextMenu() shell interface.
After adding all of them only first one i displyed.


Have you returned the correct value - indicating that you've added
multiple menu items?

Dave
Nov 17 '05 #2
I found out what was wrong.
Interface function GetCommandString(..) needed different values for each
inserted menu item.
I case all items have the same help string only first item is displayed.
"Rajko" <ra***@fly.srk.fer.hr> wrote in message
news:c5**********@bagan.srce.hr...
I used function:

BOOL InsertMenuItem( HMENU hMenu,
UINT uItem,
BOOL fByPosition,
LPCMENUITEMINFO lpmii
);

to add consecutive menu elements in QueryContextMenu() shell interface.
After adding all of them only first one i displyed. I added MF_STRING type
menues.

I checked through debugger, they all are present there in menu.
If i try adding consecutive popup menues it works fine and can add as many
as I want.
Only MF_STRING type menus wont work. Only first inserted menu item is
shown. :-(

Thanks for help, Rajko.

Nov 17 '05 #3
Thx David.
I included HRESULT(SEVERITY_SUCCESS, 0, idCmd - uidCmdFirst);
With idCmd incremented on each menuInsertItem().
"David Lowndes" <da****@example.invalid> wrote in message
news:h9********************************@4ax.com...
to add consecutive menu elements in QueryContextMenu() shell interface.
After adding all of them only first one i displyed.


Have you returned the correct value - indicating that you've added
multiple menu items?

Dave

Nov 17 '05 #4
>I included HRESULT(SEVERITY_SUCCESS, 0, idCmd - uidCmdFirst);
With idCmd incremented on each menuInsertItem().


That sounds like you're doing the right thing there then.

Can you show a short example that illustrates what you have - perhaps
someone can spot something.

Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq
Nov 17 '05 #5
Thx for all. Now it's working ok.
Solution was to add different CommandString for each menu item I inserted.

If anyone else have such problem here is what I did.
I have two menues(1st plain menu item and 2nd popup menu).
1st have index m_InsertedCmdIndex and 2nd = InsertedCMCmdIndex.
HRESULT CShellExtension::GetCommandString(UINT idCmd, UINT uFlags, UINT*
pwReserved, LPSTR pszName, UINT cchMax ) {
#ifdef DEBUG_ALL
// MessageBox(NULL,_T("GetCommandString"),_T(""),MB_O K);
#endif
USES_CONVERSION; // create space for temp variables needed for ATL
T2.. macro

if (uFlags & GCS_HELPTEXT) {
CString helpString;
helpString.Format(_T("GCS => idCmd=%d"), idCmd);
if (idCmd == m_InsertedCmdIndex) helpString =
CM_ITEM_DESCRIPTION;
if (idCmd == m_InsertedCMCmdIndex) helpString =
QUICK_CM_ITEM_DESCRIPTION;
if (idCmd > m_InsertedCmdIndex && idCmd < m_InsertedCMCmdIndex)
{
UINT posCM = idCmd - m_InsertedCmdIndex - 1;
CMRenameRegistry CMReg;
CMItem cmItem;
CMReg.GetCM(posCM, &cmItem);
helpString.Format(QUICK_CM_ITEM_NAME, cmItem.Name);
helpString.AppendFormat(QUICK_CM_ITEM_ACTION_NAME,
cmItem.Action1Select, cmItem.Action1Rename);
helpString.AppendFormat(QUICK_CM_ITEM_ACTION_NAME,
cmItem.Action2Select, cmItem.Action2Rename);
helpString.AppendFormat(QUICK_CM_ITEM_ACTION_NAME,
cmItem.Action3Select, cmItem.Action3Rename);
}
// MessageBox(NULL, _T("GCS"), _T(""), MB_OK);
StringCchCopyN((TCHAR *)pszName, cchMax, helpString,
helpString.GetLength());
if (uFlags & GCS_UNICODE) {
} else {
}
}

#ifdef DEBUG_ALL
// MessageBox(NULL,_T("GetCommandString END"),_T(""),MB_OK);
#endif
return NOERROR;
}


Nov 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Tiziano Bettio | last post by:
Hi there I'm looking for a simple solution of a win32 shell extension (virtual drive). It should make available a new drive with letter, which will be read-only. Instead of a network drive or...
2
by: Sin | last post by:
Hello everyone, I'm totally stumped at how little info I can find in MSDN or on the web concerning this. It's almost as if only microsoft personel hold the key to these secrets or something!!! ...
4
by: yxq | last post by:
Hello Can anyone tell me Context Menu shell extension? It is better that provide some samples or links. Thanks
1
by: Luhar | last post by:
Greetings, I'd like to write a shell extension so that a user can right-click on any file, regardless of its extension, and my extension will appear as one of the choices on the context menu...
5
by: gjuro kladaric | last post by:
it was not possible to make a shell extension from within VB2003, I believe has anything changed since then, can I (easily) write a VB code that would function as a shell extension thank you ...
6
by: Pieter | last post by:
Hi, I'm trying to use the Edanmo Shell Extension Library (http://www.mvps.org/emorcillo/en/code/shell/shellextensions.shtml) to make a Context Menu in the Windows Explorer with VB.NET 2005. It...
1
by: James Maeding | last post by:
I was looking for the easiest way to add an item to explorer's right click menus, and I found what looks to be a goldmine. There is a vb.net project available on:...
3
by: Shafiq | last post by:
Hi, I am trying to insert a new toolbar button to the windows explorer menu. I an able to locate the correct ToolbarWindow32, and inserted a button using the code snippet shown below. However...
2
by: Jeff Gaines | last post by:
I am in the process of upgrading to XP 64. VS2008 is running fine but one of my apps, which adds functionality to the Explorer context menu, just won't work under XP 64. Googling resulted in my...
5
by: AGP | last post by:
I have been looking far and wide for an easy to implement shell extension. My needs are basic...for two file extensions .YYY and .ZZZ I would like the context menu in explorer to simply show my app...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.