My team's application has been using the MFClasses as a basis for
years, and among the many things which MFC just "did" for us was the
enabling/disabling of the Copy/Cut/Paste buttons on the toolbar (think
generic, MS Word-ish toolbar). Our Edit menu referenced the toolbar to
see whether MFC thought we should be able to cut/copy/paste, and acted
accordingly.
We have switched to dynamically created toolbars/menus, so MFC no
longer has enough knowledge about our toolbar to do this for us.
I have been tasked with finding out how the application can decide
whether those buttons/menu items should be enabled. As I see it, there
is probably some sort of underlying Win API message that is being sent
whenever text is selected (or when the cursor has been placed in a
location suitable for Pasting); however, I cannot find any reference
material that will help me with this. I'm hoping someone else has had
this issue and will be able to tell me what I need to do.
The more detailed a description you can give, the better, as I'm pretty
new to the Windows API itself. Thanks in advance!
- Peter G.
For the Paste part you could hook into the clipboard chain, see:
http://windowssdk.msdn.microsoft.com/en-us/library/ms649019.aspx
That way you are notified when the content of the clipboard has
been changed, and you can find out if the content of the clipboard
is in a format you can handle.
The copy and cut part is a bit harder to find a general solution for.
If your application has a rech-edit you can catch EN_SELCHANGE for that
and enable the buttons depending on that. But for a multi contol
application I don't have a solution.
--
Absolutely not the best homepage on the net:
http://home20.inet.tele.dk/midgaard
But it's mine - Bertel