I'm addressing the second part of your question, and you won't get any guidance without providing code first. But I can provide some direction with respect to what you're trying to achieve.
Ultimately you need to gather the selected sub-components somehow, and based on the type of sub-components, provide different functionality for each scenario; a function for faces, a function for edges, and a function for points/verts.
One approach (and probably the simplest) is when the user presses a button or enters a shortcut, detect whether the user is in a mesh sub-component mode, and if so, collect the current sub-component selection and pass that to the corresponding function.