Windows provides MAPI (Messaging Application Program Interface) for this. Start at the
MAPI Programming Overview[
^] in the MSDN. You may also search the net for some examples using the keywords 'mapi c++ examples'.
When using MFC, you can use
CDocument::OnFileSendMail()
to send the active document as mail attachment. The source code of this function may be also used as base for your own function.