Code:
case WM_CREATE:
GetClientRect(hwnd, &rect);
swnd.CmdLine = CreateWindow("EDIT", "", WS_CHILD | WS_VISIBLE | WS_BORDER | ES_AUTOHSCROLL, rect.left - 1, rect.bottom - 17, rect.right + 2 - rect.left, 18, hwnd, NULL, NULL, NULL);
if( swnd.CmdLine == NULL ) {
err = GetLastError();
sprintf(buffer, "Couldn't create CMDLINE for status window. (%d)", err);
MessageBox(NULL, buffer, "Creation Error", MB_ICONERROR);
}
else {
swnd.Display = CreateWindowEx(WS_EX_CLIENTEDGE, chCntrlName, "RichEdit Test", WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL, rect.left + 15, rect.top + 15, rect.left - rect.right - 30, rect.bottom - rect.top - 30, hwnd, (HMENU)IDC_MYRICHEDIT, NULL, NULL);
// swnd.Display = CreateWindowEx(WS_EX_CLIENTEDGE, chCntrlName, "", WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL, rect.left - 1, rect.top - 1, rect.left - rect.right + 2, rect.bottom - 17 - rect.top , hwnd, (HMENU)IDC_MYRICHEDIT, NULL, NULL);
if( swnd.Display == NULL ) {
err = GetLastError();
sprintf(buffer, "Couldn't create DISPLAY for status window. (%d)", err);
MessageBox(NULL, buffer, "Creation Error", MB_ICONERROR);
}
else {
ShowWindow(swnd.Display, SW_SHOW);
StatusReady = TRUE;
MessageBox(NULL, TEXT("RichEdit Control for Status Window created."), TEXT("Creation Success!"), MB_OK);
AppendText(swnd.hWnd, COLOR_DK_GREEN, "Testing!");
// SetWindowText(swnd.Display, "Testing!");
// SetWindowText(swnd.Display, "Testing a second time.");
}
}
break;
The above code is the WM_CREATE message of the window the RichEdit is being created in. (This is an MDI interface, btw.) The DLL is already properly loaded (riched20.dll) which doesn't return any errors upon started and so it should be loaded properly. I do end up receiving the "RichEdit Control for Status Window created." message everytime the program starts and so I don't know how it shouldn't be there. If you can help me out with this one I would be greatly appreciative!