It is an advanced task, but the famous Michael Dunn wrote an excellent article about
Writing Shell Extensions.
And also on MSDN I found
Windows Shell context menu handler.
One tip in front: for some actions only run if the process is admin or UAC is disabled - installing and sometimes debugging.
Be prepared of cryptic error messages - "Welcome in DLL-Hell" :-O