I am having some trouble here. My code will work fine using rich edit 3.0 but when I try and go with 4.1 the edit control won't be created. Here is the general idea of my code:
Code:
WORD GetRichEditVersion(void) {
static WORD wRichVersion = NO_RICH;
// this will keep the program from opening multipile instances
// of the correct rich edit dll.
if(!wRichVersion) {
if(!LoadLibrary(TEXT("Msftedit.dll"))) {
if(!LoadLibrary(TEXT("Riched20.dll"))) {
if(LoadLibrary(TEXT("Riched32.dll")))
wRichVersion = RICH_1_0;
} else
wRichVersion = RICH_2_0;
} else
wRichVersion = RICH_4_1;
}
return wRichVersion;
}
/* Meanwhile, elsewhere in my program (in WM_CREATE to be exact) */
WORD wRichEditVersion = GetRichEditVersion();
if(wRichEditVersion)
if(wRichEditVersion) == RICH_1_0)
hwndEdit = CreateWindowEx(WS_EX_CLIENTEDGE,
TEXT("RichEdit"), TEXT(""),
WS_VISIBLE | WS_CHILD | WS_BORDER | ES_MULTILINE,
half, area.top, half, area.bottom,
hwndParent, (HMENU)(ID_REDIT), hInst, NULL);
else
hwndEdit = CreateWindow(
RICHEDIT_CLASS, TEXT(""),
WS_VISIBLE | WS_CHILD | WS_BORDER | ES_MULTILINE,
half, area.top, half, area.bottom,
hwndParent, (HMENU)(ID_REDIT), hInst, NULL);
else
hwndEdit = CreateWindowEx(WS_EX_CLIENTEDGE,
WC_EDIT, TEXT(""),
WS_VISIBLE | WS_CHILD | WS_BORDER | ES_MULTILINE,
half, area.top, half, area.bottom,
hwndParent, (HMENU)(ID_REDIT), hInst, NULL);
/* more code...*/
Okay, GetRichEditVersion() determines the version as anyone can plainly see. If I don't attempt to load msftedit.dll I can get a rich edit 3.0 control up and running, however, when I do use msftedit.dll I won't get an edit control. Can anyone set me straight here?