Advertisement Jump to content
Sign in to follow this  
SelethD

Im having RichEdit trouble

This topic is 4971 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Im trying to get a RichEdit 2.0 control box working. I tried making it myself with the CreateWindowEx function, but it always fails with error number 1400. So then I tried using the Resource editor in Visual Studio, to make a dialog box with a rich edit control. The dialog fails to create with the rich edit control, but works without the rich edit control. So what am I doing wrong? Im using VC++ .net on Win XP Thanks I forgot to add I have the InitCommonControls() as the first command in WinMain Is this perhaps in the wrong place?

Share this post


Link to post
Share on other sites
Advertisement
Richedits are different from the other common controls because you have to call LoadLibrary() to actually use them. To initialize a Richedit 2.0 control you need to load Riched20.dll. For example:


// To use other common controls
InitCommonControls();

HANDLE hriched = LoadLibrary("Riched20.dll");

if (hriched == 0) {
// Error! Do something!
}

HWND hwnd = CreateWindow(RICHEDIT_CLASS, ...);

...

// At the end of your program you might as well free the Riched20.dll
FreeLibrary(hriched);

Share this post


Link to post
Share on other sites
Wow! Thanks a million.

I have searched all day and nothing ever mentioned loading the library.

Your a code saver!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!