Skip to main content
gamedev.net
🔒 Locked

Win32 - RichEdit

Started by Alura 15 replies 4.7k views
Original Post
Alura
Alura
Well, i've setupped it using dialogs with the following code:
// The global vars

HINSTANCE hinst_RE32Dll;
HWND h_RE;

// This is inside WinMain

hinst_RE32Dll = LoadLibrary("Msftedit.dll");

// And this is inside the DialogProc function

	case WM_INITDIALOG: 
		Main = hWnd;
		RE = CreateWindowEx(0, RICHEDIT_CLASS, 0, WS_VISIBLE | ES_SUNKEN |
			WS_CHILDWINDOW | WS_CLIPSIBLINGS | ES_MULTILINE | WS_CHILD |
		    ES_NOHIDESEL  |  WS_VSCROLL | ES_AUTOVSCROLL | ES_AUTOHSCROLL | WS_HSCROLL ,
			0, 0, 0, 0, hWnd, (HMENU) NULL, (HINSTANCE)GetWindowLong(Main,GWL_HINSTANCE), NULL);
		break; 
Now, the problem is that when i start my program, i don't see any richedit control. Was wondering if anyone would have any idea why this happens and how to fix this. [edited by - Alura on January 27, 2004 5:29:02 PM] [edited by - Alura on January 27, 2004 5:29:32 PM] [edited by - Alura on January 28, 2004 1:45:55 PM]
felisandria
felisandria
In order to use a RichEditCtrl, you must at some point before attempting to display it call AfxInitRichEdit. If you don''t it won''t show up and/or will crash your app. So, try that.

-fel
~ The opinions stated by this individual are the opinions of this individual and not the opinions of her company, any organization she might be part of, her parrot, or anyone else. ~
DukeAtreides076
DukeAtreides076
quote:
Original post by Anonymous Poster

Are you sure that is the right DLL? The MFC source loads RICHED32.DLL.



It depends on the version of the Rich Edit control youre trying to load.
Colin Jeanne
Colin Jeanne
AfxInitRichEdit() is an MFC macro. If you do not wish to use it, InitCommonControlsEx() is there to help you.


Colin Jeanne | Invader''s Realm
wasd
wasd
He''s not using MFC. I don''t think it likes a size of 0, 0. Try giving it a specific size. Also, the library is:

riched20.dll

---------------------------------------

Let''s struggle for our dream of Game!

http://andrewporritt.4t.com
mindundi
mindundi
Hello Alura, I''ve the same problem with MSFTEDIT. Could you post which value do you assign to the dwICC member of the INITCOMMONCONTROLSEX structure? Thank you really
mindundi
mindundi
Sorry I didn''t know. It''s only that when I try to create a window with the RICHEDIT_CLASS class name, if I load the Msftedit.dll library instead of Riched20.dll, CreateWindow (or CreateWindowEX) fails and GetLastError reports Class name not found, I think that Msftedit requires another class name, but user Alura says he/she got it with InitCommonControlsEx. I''ve tried with some dwICC member values, but I got nothing. Thank you very much.
Colin Jeanne
Colin Jeanne
Double check that LoadLibrary() does not fail. Remember that Msftedit.dll only exists on machines with WinXP SP1.


Thanks Salsa!Colin Jeanne | Invader''s Realm
"I forgot I had the Scroll Lock key until a few weeks ago when some asshole program used it. It even used it right" - Conner McCloud
mindundi
mindundi
Yes, I have XP with SP1, and LoadLibrary does not return NULL. What do you mean with "double" check?
Colin Jeanne
Colin Jeanne
quote:
Original post by mindundi
Yes, I have XP with SP1, and LoadLibrary does not return NULL. What do you mean with "double" check?

I meant make sure that LoadLibrary() does not return NULL.

Can you post the code you use to create the rich edit using Msftedit.dll?


Thanks Salsa!Colin Jeanne | Invader''s Realm
"I forgot I had the Scroll Lock key until a few weeks ago when some asshole program used it. It even used it right" - Conner McCloud
mindundi
mindundi
Sorry, I forgot to use my password in the former post. It was me.
Evil Steve
Evil Steve
If you use MSFTEDIT.dll, your code will only work on windows XP. Whats wrong with RICHED20.dll ?

Edit: on my compiler RICHEDIT_CLASS expands to "RichEdit20A"...

[edited by - Evil Steve on April 22, 2004 1:46:15 PM]

Topic Locked

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

Sign in to reply to this topic.