Re: subclassing edit control and preventing copy paste clipboard

"domehead100" <[email protected]>
Newsgroups gmane.comp.windows.wtl
Message-ID <[email protected]>
--- In [email protected], "amante1il" <is.aviv@...> wrote:
>
> Hi Guys,
> 
> I have an Edit Control in my dialog. I want to prevent the user from copying text with Ctrl+C and Clipboard functions with right click.
> 
> I tried Subclassing the Edit control with a CEdit class - but it dosen't have a SubClass function.
> 
> I tried catching the WM_COPY, WM_CUT etc' messages in the dialog, but it dosen't catch the Edit Control messages. Only on the dialog.
> 
> Any ideas how to do it?
> 
> Thanks in Advanced,
> Don
>

Use something like:

class CMyEdit : public CWindowImpl<CMyEdit, CEdit>
{
...
DECLARE_MSG_MAP(CMyEdit)
   MSG_WM_COPY(OnCopy)
   MSG_WM_PASTE(OnPaste)
END_MSG_MAP()
...

}

This is how you subclass a window in WTL.  CWindowImpl-derived classes do have a SubclassWindow function.

I would recommend going to www.codeproject.com and locating and reading the articles in the WTL for MFC Programmers series.  They are a very good introduction to WTL, subclassing controls, etc.

~Mike



------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/wtl/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/wtl/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[email protected] 
    mailto:[email protected]

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.