2

All this compiles ok, with no errors, but the cursor is vertical and shows on top-right corner of the window, and the text flow is like japanese top to bottom in characters, right to left in lines. The characters are invisible, but copyable. I have english windows XP SP3 with no asian software on board.

#include <windows.h>
#include <richedit.h>

int main() {
  LoadLibrary("Msftedit.dll");
  HINSTANCE hInstance = (HINSTANCE)GetModuleHandle(0);
  HWND richeditWindow = CreateWindowExW (
    WS_EX_TOPMOST,
    L"RichEdit50W",
    L"window text",
    WS_OVERLAPPEDWINDOW | ES_MULTILINE | WS_VISIBLE,
    0, 0, 500, 500,
    NULL, NULL, hInstance, NULL
  );

  MSG msg;
  while( GetMessageW( &msg, richeditWindow, 0, 0 ) ) {
    TranslateMessage( &msg );
    DispatchMessageW( &msg );
  }
}
rsk82
  • 28,217
  • 50
  • 150
  • 240
  • 1
    The documented name is `MSFTEDIT_CLASS`, not `L"RichEdit50W"`. Depending on your SDK, this `#define` may or may not be equal. – MSalters Jan 17 '13 at 15:42

1 Answers1

4

The problem is your use of the WS_OVERLAPPEDWINDOW style. Rich edit controls are designed to be used as child windows and do not support WS_OVERLAPPEDWINDOW.

WS_OVERLAPPEDWINDOW compiles as 0x00CF0000. This overlaps several rich edit styles, namely:

ES_VERTICAL         0x00400000
ES_NOIME            0x00080000
ES_SELFIME          0x00040000

So applying the WS_OVERLAPPEDWINDOW macro to your control is the same as applying those styles.

Peter Ruderman
  • 12,241
  • 1
  • 36
  • 58