c++winapi

In win32 C++ how can i enable static text control to copy text?


I am writing a simple win32 application that has a 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?

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 dddd@gmail.com", IDC_STATIC, 96, 87, 150, 8, SS_LEFT
}

Solution

  • You can't do this with static text. In particular you can't highlight text. Instead you should use a read only edit control.