Skip to main content
gamedev.net
🔒 Locked

riched lib/dll problems......

Started by levjs Apr 26, 2006 at 11:01 PM 4 replies 1.6k views
Original Post
levjs
levjs
Hi, I am trying to create an richedit box. I insert one onto my resource dialog box, and when I run the program, it just quits, won't load the box. The last line in the debug log says(I don't know if this means anything) The program '[1340] Fathers Day.exe: Native' has exited with code -1 (0xffffffff). I've linked to riched20.lib. I've also tried creating a richedit box when I init my dialog box using CreateWindow. However, this returns the error 1407(Cannot find class name). In other words, it doesn't thing RICHEDIT_CLASS means anything. I've also tried RichEdit20A, as well as many other things for the class variable. Can anyone help me as to what's going on?? Thanks alot, Levi (Alternatively, can anyone tell me how to limit the number of characters the user can enter in a NORMAL(not rich) edit box just using the API, not MFC.)
rmsimpson
rmsimpson
If you merely link with the riched20.lib, and don't make any richedit-exported functions, then the linker will optimize the library out of your build.

You need to call LoadLibrary() and deliberately load the version you want in order for it to work properly.

You can use the EM_LIMITTEXT message to limit the number of characters a user can enter into a textbox. It should work with regular textboxes as well as rich textboxes.

Robert
Evil Steve
Evil Steve
As rmsimpson said, you need to do LoadLibrary("RICHED20.DLL"); (I think that's the right DLL anyway) somewhere in your app before you try to create a RichEdit control. Loading the library registers the RichEdit class.
levjs
levjs
Quote:
Original post by rmsimpson
If you merely link with the riched20.lib, and don't make any richedit-exported functions, then the linker will optimize the library out of your build.

You need to call LoadLibrary() and deliberately load the version you want in order for it to work properly.

You can use the EM_LIMITTEXT message to limit the number of characters a user can enter into a textbox. It should work with regular textboxes as well as rich textboxes.

Robert


Thanks soooo much both of you.

It works! The only things is, it still won't load the dialog box with the richedit on it, only when I build it with CreateWindow(and I have to load the dll right before, in the same function). But that's okay with me. [smile]

I've been LOOOKING for a message like that, but all I could find was the CB_LIMITTEXT message for comboboxes. Thanks so much to all of you.

I have one more question you might be able to help with, then I'm all set.

I have set a dropdown combobox as readonly. The only thing is, I don't want it to be gray like the system automatically sets it. How can I change the color of the background in the combobox. I've tried quite a few things, none of them working.

Thanks so much.
Levi
rmsimpson
rmsimpson
Ok the only reason you'd need to make a combobox readonly is if you have to have an editable combobox (with an edit box). Ordinarily you can just configure the combobox to be a drop-list (CBS_DROPDOWNLIST style), and then the user can't edit it.

However, if you need to be able to display a default entry that doesn't appear in the drop-list, and you need it to be readonly, you can send a CB_GETCOMBOBOXINFO message to the combo, which returns a COMBOBOXINFO struct which includes the HWND of the edit box for the combo. You can then send an EM_SETREADONLY messsage to the edit box and now the user can see but not edit the contents.

Robert
levjs
levjs
No, I just needed to make it a drop-list. : ) Now I feel stupid.

I had figured out how to send the readonly message, it just wasn't what I had wanted.

*bangs head against wall* [smile]

Thanks so much.
Levi

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.