Getting the correct shell verb text for an action

I was looking through the following VB code:

http://www.codeproject.com/KB/vb/toggleNetworkConn.aspx

If you look in the Methods section, you can see that it does a test to see if the verb of the wrapper element is "En & able" or "Disa & ble" - it looks pretty obvious that these are the same text strings, which are listed on the right-click context menu under Network Connections. The obvious problem with this approach (as someone pointed out in the comments on CodeProject) is that it depends on English; depending on the language the OS is running in, it will use different words. The programmers' answer was to potentially use the verb index, but this is arguably worse than the original solution, since then you would be performing some arbitrary operation if it was not the correct command (and I don't believethat it is guaranteed to be in a specific order in the verb list).

So my question is, is it possible to get from the system (via some call or registry) OS language text to enable and disable? I have searched the registry for both strings without any success, but I thought that someone with more experience in multiple languages ​​might have an answer. Also, I am not using VB (I will be using C ++), so don’t worry about doing this in any particular language - API calls or pseudo code is fine. I also need a solution to work with both XP and Vista (and hopefully Windows 7). Thanks!

+1


a source to share


2 answers


The closest thing I've found is part of IShellFolder, specifically GetCommandString (), which returns a generic string describing the action - in which case it literally returns "enable" or "disable". The problem with this particular API is that it works, it doesn't actually return anything on XP - apparently, while available on older OSs, it's only really useful for Vista or more.



0


a source


It looks like the text for verbs can be processed using Registry Line Redirection . You will need to identify the CLSID for the connections component. I poked, but didn't find any verbs registered for the CLSID of the network connections I ran into, though ...



0


a source







All Articles