-
RichEdit Not Working!
Ok. I was working with RICHEDIT_CLASS when I found a problem. I do InitCommonControls(); but when I try to do something like:
CreateWindowEx(
0,
RICHEDIT_CLASS,
"",
WS_CHILD | WS_VISIBLE,
10, 10,
400, 150,
hwnd,
(HMENU)1,
hInst,
NULL
);
It says RICHEDIT_CLASS undeclared...first use this function. How do I use RICHEDIT_CLASS?
-
include richedit.h
#include <richedit.h>
-
and don't forget to put:
LoadLibrary("RichEd32.dll");
in your code, or else it won't work.
-
Still not working...
I tried both and got these:
17 c:/my documents/desk_hack.cpp
warning: `IDCLOSE' redefined
642 c:\dev-c_~1\include\winuser.h
warning: this is the location of the previous definition
6 c:/my documents/desk_hack.cpp
ANSI C++ forbids declaration `LoadLibraryA' with no type
6 c:/my documents/desk_hack.cpp
`int LoadLibraryA' redeclared as different kind of symbol
1324 c:\dev-c_~1\include\winbase.h
previous declaration of `struct HINSTANCE__ * LoadLibraryA(const CHAR *)'
6 c:/my documents/desk_hack.cpp
initialization to `int' from `const char *' lacks a cast
780 c:/my documents/desk_hack.cpp
warning: converting NULL to non-pointer type
819 c:/my documents/desk_hack.cpp
`RICHEDIT_CLASS' undeclared (first use this function)
819 c:/my documents/desk_hack.cpp
(Each undeclared identifier is reported only once
819 c:/my documents/desk_hack.cpp
for each function it appears in.)
-
Code:
hwndEdit = CreateWindow ("richedit", NULL,
WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL |
WS_BORDER | ES_LEFT | ES_MULTILINE |
ES_AUTOHSCROLL | ES_AUTOVSCROLL,
0, 0, 90, 90, hwnd, (HMENU) ID_VIEW,
hInst, NULL);
I always find using the #defines are more annoying than just typing in the string yourself :rolleyes:
And I don't know wether you need LoadLibrary in DJGPP, but you do in MSVC. and now you don't need to include the extra header file.