Click here to Skip to main content
15,890,527 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi Guys,

I am attempting to write the following code in .net 3.5. The code is trying to loop through verbs (i.e. Pin to Start, Open, Create Shortcut, etc)

This code does this in 4.5.

What I have tried:

string path = Path.GetDirectoryName(filePath);
    string fileName = Path.GetFileName(filePath);

    // create the shell application object
    dynamic shellApplication = Activator.CreateInstance(Type.GetTypeFromProgID("Shell.Application"));
    dynamic directory = shellApplication.NameSpace(path);
    dynamic link = directory.ParseName(fileName);
    dynamic verbs = link.Verbs();



    for (int i = 0; i < verbs.Count(); i++)
    {
        dynamic verb = verbs.Item(i);
        var name = verb.Name;
        if (verb.Name.Equals(localizedVerb))
        {
            verb.DoIt();
            return true;
        }
    }


This works well kinda..It finds verbs, but for some reason, the verb is not in after "Pin to Start".

How can I translate the 4.5 code above into 3.5 so it finds all the verbs for a win10.

I find something here but I didn't get.

Can anyone please help me.



Thanks
Posted
Updated 10-Oct-18 2:39am
v3
Comments
OriginalGriff 10-Oct-18 11:51am    
Don't "bump" your question: it's rude, arrogant, unnecessary, and doesn't help you get a faster answer. By all means add info, but just editing it to get it back to the top of the "unanswered" list is just saying "I'm more important than anyone else, so deal with *MY* question and ignore the rest".
And so is everybody else, and everybody else's questions. If everyone was this thoughtless and rude, you'd never get an answer to anything, because all we'd be able to see would be 100 pages of idiots bumping all the real questions to page 100+
All you do is annoy people, and get them to deliberately not even look at your question, much less answer it.
Richard MacCutchan 10-Oct-18 13:59pm    
but for some reason, the verb is not in after "Pin to Start".
Please explain exactly what that means.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900