Q: How do I enable zooming in the Win32 Rich Edit control? I'm having trouble getting my Rich Edit control to accept the zoom ratio I specify when sending it the EM_SETZOOM message.  I create the control using the following line of code:
editWrap = CreateWindowEx(0, MSFTEDIT_CLASS, nullptr, ES_EX_ZOOMABLE | ES_MULTILINE |
    WS_VISIBLE | WS_CHILD | WS_VSCROLL | ES_AUTOVSCROLL | ES_DISABLENOSCROLL, 0, 0, 0, 0,
    hwnd, nullptr, appInstance, nullptr);

Whenever I try to send it the EM_SETZOOM message the return value is always FALSE no matter what I specify as the WPARAM and LPARAM.  I also tried putting ES_EX_ZOOMABLE as the first parameter of the CreateWindowEx call with the same results.
Zooming with the mouse works as expected.  That's not the issue here.  I'm trying to set the zoom programmatically.
I'm using the following code to send the message:
SendMessage(getCurrentEditor(), EM_SETZOOM, MAKEWPARAM(64, 0), MAKELPARAM(1, 0));


A: You are passing in the ES_EX_ZOOMABLE in the wrong parameter of CreateWindowEx().  You are passing it in the dwStyle parameter, but it is an extended window style so it needs to be passed in the dwExStyle parameter instead, eg:
editWrap = CreateWindowEx(ES_EX_ZOOMABLE, MSFTEDIT_CLASS, nullptr, ES_MULTILINE |
    WS_VISIBLE | WS_CHILD | WS_VSCROLL | ES_AUTOVSCROLL | ES_DISABLENOSCROLL, 0, 0, 0, 0,
    hwnd, nullptr, appInstance, nullptr);

Note that the EM_SETZOOM message is only supported on Windows Vista and later, in RichEdit 3.0 and later (you are using 4.1).  You didn't indicate which Windows version you are using, or what your ratio values are set to.  So it is hard to diagnose why exactly EM_SETZOOM returns FALSE. All that means is that the ratio wasn't accepted, but not WHY it wasn't accepted.  Are you able to zoom the RichEdit with the mouse using Ctrl+MouseWheel? That will tell you whether ES_EX_ZOOMABLE is taking effect or not.
On a separate note: you are creating your RichEdit with a width and height of 0! Are you sure that is what you really want?

A: It turns out that the control won't accept a zoom factor of 64/1.  I found that out by reading the Windows Forms documentation on the RichTextBox control.  The Win32 API documentation just said the zoom factor had to be a number between 1/64 and 64.  The Windows Forms documentation says it has to be "between 1/64 and 64.0, not inclusive".  When I changed my test code to send 63/1 to the control, it worked as expected.
