c++visual-studio-2010mfcrichedit

How to insert text into my Rich Edit Control in VS2010?


I've already gone to this question: How to insert text to rich edit control in Win32 while preserving any previous formatting

And I tried to do what he did, but I got met with the error that my SendMessage didn't take the same number of parameters.

And after looking at this: https://msdn.microsoft.com/en-us/library/t64sseb3(v=vs.100).aspx, I figured that not all [SendMessage]s are created equal - that is that SendMessage in VS2010 doesn't take a hWnd parameter.

So... I'm stuck... Please help >_<

EDIT: I did do my research... I'm afraid I just was looking in the wrong places or do not know how to. I've been at this since yesterday...


Solution

  • So, I learned today exactly how they were different. Special thanks to IInspectable.

    Scope.

    The SendMessage that i was using was the MFC version which used 3 parameters.

    SendMessage(message, wParam, lParam);
    

    But I needed the one with 4 parameters - which was the WINAPI version.

    ..beat..

    So that I'll be able to use the WINAPI one, i had to prepend my function call with the scope resolution operator (::). See below:

    ::SendMessage(rchWnd, EM_REPLACESEL, 0, (LPARAM)stringtoappend);
    

    After that, I was happily able to append text to my Rich Edit Control (Yey!). So... I hope that this question will help someone out there.

    Peace... out ^^v