strange behavior of richedit controll, text is written horizontally like in old japanese

StackOverflow https://stackoverflow.com/questions/14382536

  •  16-01-2022
  •  | 
  •  

문제

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 );
  }
}
도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top