why i can't change the caret cursor on rich edit control?

i'm trying change the caret cursor on rich edit control, but don't let me. the standard caret is showed :(
but if i return 0, the caret isn't showed.
(in these case, the letter 'H' is used for be the HBITMAP....
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
case WM_SETFOCUS:
            {
                image imgtext(10,10);
                pen pnCaret(0,2,RGB(255,0,0));
                imgtext.TextColor(RGB(255,0,0));
                imgtext.DrawText("H");
                if(::DestroyCaret())
                    DebugText("error: not destroyed");
                if(::CreateCaret (richedit->consoleedit, imgtext, 10, 10)==FALSE)
                    DebugText("error: not created");
                if(::ShowCaret(richedit->consoleedit))
                    DebugText("error: not showed");
                DebugText(to_string(GetCaretBlinkTime()));
                //return 0;
            }
            break;

can anyone advice me, please?

The problem is probably that the richedit get the focus event later and uses CreateCaret(...) as well.
but how can i fix it?
imagine these: if i press the insert key(for subtituite the letters), the caret isn't changed too. why? i don't know maybe it's my code without know it :(
heres how i create the richedit:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
consolewindow(string strTitle="")
    {
        static int i=0;
        i=i+1;
        if(strTitle=="")
           strTitle="Console " + to_string(i);
        frmconsolewindow.Text=strTitle;
        LoadLibrary(TEXT("Msftedit.dll"));
        consoleedit = CreateWindowEx(0,"RICHEDIT50W", TEXT("hello editor "),
                   WS_CHILD | WS_VISIBLE | ES_WANTRETURN | ES_MULTILINE | ES_AUTOHSCROLL|ES_AUTOVSCROLL| WS_VSCROLL | WS_HSCROLL, 0, 0,
                   frmconsolewindow.width-16, frmconsolewindow.height -38 , frmconsolewindow, 0, GetModuleHandle(0), 0 ) ;
        wpOrigRichEditProc=(WNDPROC)SetWindowLong(consoleedit,GWL_WNDPROC,(LONG_PTR)consolewindow::RichEditProc);
        SetWindowLongPtr(consoleedit,GWLP_USERDATA,(LONG) this);
        SendMessage( consoleedit, EM_SETBKGNDCOLOR, 0, RGB( 0,0,0 ) );
        CHARFORMAT2 cf;
        cf.dwEffects =0;
        cf.dwMask = CFM_COLOR;
        cf.crTextColor =RGB(255,255,255);
        cf.cbSize = sizeof(CHARFORMAT2);
        SendMessageA(consoleedit, EM_SETCHARFORMAT, SCF_DEFAULT, (LPARAM)&cf );

        frmconsolewindow.GetFocus=[&]()
        {
            SetFocus(consoleedit);
        };
        frmconsolewindow.Resize=[&]()
        {
            SetWindowPos(consoleedit,0,0,0,frmconsolewindow.width-16, frmconsolewindow.height -38 ,SWP_NOMOVE|SWP_NOREPOSITION|SWP_NOZORDER);
        };
        frmconsolewindow.Close=[&]()
        {
            blnread=false;
        };
        pthread_mutex_init(&myMutex,NULL);
    }

frmconsolewindow it's my form class object\instance
Topic archived. No new replies allowed.