c++ how can i in win32 static text control enable to copy text ?
im writing simple win32 application that is window and static text , now i want to enable the user to copy the text with his right click (mark and copy ) how can i do that ?
Code:
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG1 DIALOG 0, 0, 369, 318
STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU
CAPTION "Win32 demo"
FONT 8, "Ms Shell Dlg"
{
LTEXT "Questions to [email protected]", IDC_STATIC, 96, 87, 150, 8, SS_LEFT
}
Re: c++ how can i in win32 static text control enable to copy text ?
If using a (read-only) Edit control is a very easy task: just have to select the Edit control contents then send a WM_COPY message:
Code:
HWND hWndEdit = ::GetDlgItem(hWndDlg, IDC_EDIT1);
::SendMessage(hWndEdit, EM_SETSEL, (WPARAM)0, (LPARAM)-1);
::SendMessage(hWndEdit, WM_COPY, 0, 0);
Unfortunatelly, that is not possibile in case of Static control and have to deal yourself with clipboard functions.
See Clipboard topics in MSDN.
Re: c++ how can i in win32 static text control enable to copy text ?
Thanks for the reply , im using ResEdit , so its selectble already .
but when i select the text all the edit text background become painted in white how can i cancel that ?
one more question , if i use Edit Text control , can i make some text inside it be clicked as a link?
Re: c++ how can i in win32 static text control enable to copy text ?
What is "ResEdit "?
Did you consider using something like CHtmlCtrl?
1 Attachment(s)
Re: c++ how can i in win32 static text control enable to copy text ?
Quote:
Originally Posted by
umen
if i use Edit Text control , can i make some text inside it be clicked as a link?
Of course you can. Also you can get rid of default behavior of selecting text.
Attached here is a little Win32 Application which has an Edit control behaving as a hyperlink and having copy to clipboard feature.
Re: c++ how can i in win32 static text control enable to copy text ?
Thanks for the example and help