Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to add rich edit control ??

How to add rich edit control ??

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
10 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Suresh H
    wrote on last edited by
    #1

    Hello All, I added a Rich Edit Box to my dialog and executed the dialog now the problem is dialog is not getting displayed & no action is performed or any error is displaed. Guys can u please tell me hw to add a Rich Edit Control to my Dialog using Win32 App. ??? Thanking you, Suresh HC

    P 1 Reply Last reply
    0
    • S Suresh H

      Hello All, I added a Rich Edit Box to my dialog and executed the dialog now the problem is dialog is not getting displayed & no action is performed or any error is displaed. Guys can u please tell me hw to add a Rich Edit Control to my Dialog using Win32 App. ??? Thanking you, Suresh HC

      P Offline
      P Offline
      prasad_som
      wrote on last edited by
      #2

      You need to call AfxInitRichEdit to initialize rich edit control for app. Call this function in your application.

      Prasad Notifier using ATL | Operator new[],delete[][^]

      S 1 Reply Last reply
      0
      • P prasad_som

        You need to call AfxInitRichEdit to initialize rich edit control for app. Call this function in your application.

        Prasad Notifier using ATL | Operator new[],delete[][^]

        S Offline
        S Offline
        Suresh H
        wrote on last edited by
        #3

        Hi Prasad, Thansk for the responce. I called AfxInitRichEdit(); in my Dialog, I am getting error C2065: 'AfxInitRichEdit' : undeclared identifier Dialog which I have created is from win32 Application and not from MFC. Can u please tell me hw use rich edit box in win 32 application.

        P 1 Reply Last reply
        0
        • S Suresh H

          Hi Prasad, Thansk for the responce. I called AfxInitRichEdit(); in my Dialog, I am getting error C2065: 'AfxInitRichEdit' : undeclared identifier Dialog which I have created is from win32 Application and not from MFC. Can u please tell me hw use rich edit box in win 32 application.

          P Offline
          P Offline
          prasad_som
          wrote on last edited by
          #4

          Use LoadLibrary for initializing rich edit control. You main window procedure would look like this,

          LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
          {
          switch(Message)
          {
          case WM_CREATE:
          hLib = LoadLibrary("RICHED32.DLL");
          break;
          case WM_CLOSE:
          DestroyWindow(hwnd);
          FreeLibrary(hLib);
          break;
          ..

          }

          Prasad Notifier using ATL | Operator new[],delete[][^]

          S 1 Reply Last reply
          0
          • P prasad_som

            Use LoadLibrary for initializing rich edit control. You main window procedure would look like this,

            LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
            {
            switch(Message)
            {
            case WM_CREATE:
            hLib = LoadLibrary("RICHED32.DLL");
            break;
            case WM_CLOSE:
            DestroyWindow(hwnd);
            FreeLibrary(hLib);
            break;
            ..

            }

            Prasad Notifier using ATL | Operator new[],delete[][^]

            S Offline
            S Offline
            Suresh H
            wrote on last edited by
            #5

            Hi Prasad, what shd be the hlib variable type ??? and where we have to declare that variable?? error C2065: 'hLib' : undeclared identifier

            P 1 Reply Last reply
            0
            • S Suresh H

              Hi Prasad, what shd be the hlib variable type ??? and where we have to declare that variable?? error C2065: 'hLib' : undeclared identifier

              P Offline
              P Offline
              prasad_som
              wrote on last edited by
              #6

              Its HMODULE. You can declare it as

              HMODULE hLib;//of course you can decide how you want to manage it

              I've just given example. Only thing important, you need to load dll before invoking dialog.

              Prasad Notifier using ATL | Operator new[],delete[][^]

              S 1 Reply Last reply
              0
              • P prasad_som

                Its HMODULE. You can declare it as

                HMODULE hLib;//of course you can decide how you want to manage it

                I've just given example. Only thing important, you need to load dll before invoking dialog.

                Prasad Notifier using ATL | Operator new[],delete[][^]

                S Offline
                S Offline
                Suresh H
                wrote on last edited by
                #7

                Hi Prasad, I did changes as u have mentioned. But still no changes , still the dialog is not getting displayed which contains rich edit box.If i remove the Rich edit control Dialog is getting displayed. I have 3 dialogs one main another sub dialogs , in the sub dialog I have the rich edit control. The main MainDlgProc BOOL CALLBACK MainDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) { HMODULE hLib; switch(Message) { case WM_CREATE: hLib = LoadLibrary("RICHED32.DLL"); break; and the sub dialog DlgProc BOOL CALLBACK SearchDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) { HMODULE hLib; switch(Message) { case WM_CREATE: hLib = LoadLibrary("RICHED32.DLL"); break; I am using windows 2000 OS with VC6.

                P 1 Reply Last reply
                0
                • S Suresh H

                  Hi Prasad, I did changes as u have mentioned. But still no changes , still the dialog is not getting displayed which contains rich edit box.If i remove the Rich edit control Dialog is getting displayed. I have 3 dialogs one main another sub dialogs , in the sub dialog I have the rich edit control. The main MainDlgProc BOOL CALLBACK MainDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) { HMODULE hLib; switch(Message) { case WM_CREATE: hLib = LoadLibrary("RICHED32.DLL"); break; and the sub dialog DlgProc BOOL CALLBACK SearchDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) { HMODULE hLib; switch(Message) { case WM_CREATE: hLib = LoadLibrary("RICHED32.DLL"); break; I am using windows 2000 OS with VC6.

                  P Offline
                  P Offline
                  prasad_som
                  wrote on last edited by
                  #8

                  Dear ! dear ! I mentioned in earlier reply, you need to load library before invoking dilaog. I'd assumed , you main application window is not dialog window in question, and window procedure I mentioned is of main window. So use given procedure with main window. You should get idea from this snippet,

                  hLib = LoadLibrary("RICHED32.DLL");
                  ret = DialogBox(GetModuleHandle(NULL),
                  MAKEINTRESOURCE(IDD_MYDLG), hwnd, MyDlgProc);
                  if(ret == -1)
                  {
                  MessageBox(hwnd, "Dialog failed!", "Error",
                  MB_OK | MB_ICONINFORMATION);
                  }
                  FreeLibrary(hLib );

                  Prasad Notifier using ATL | Operator new[],delete[][^]

                  S 1 Reply Last reply
                  0
                  • P prasad_som

                    Dear ! dear ! I mentioned in earlier reply, you need to load library before invoking dilaog. I'd assumed , you main application window is not dialog window in question, and window procedure I mentioned is of main window. So use given procedure with main window. You should get idea from this snippet,

                    hLib = LoadLibrary("RICHED32.DLL");
                    ret = DialogBox(GetModuleHandle(NULL),
                    MAKEINTRESOURCE(IDD_MYDLG), hwnd, MyDlgProc);
                    if(ret == -1)
                    {
                    MessageBox(hwnd, "Dialog failed!", "Error",
                    MB_OK | MB_ICONINFORMATION);
                    }
                    FreeLibrary(hLib );

                    Prasad Notifier using ATL | Operator new[],delete[][^]

                    S Offline
                    S Offline
                    Suresh H
                    wrote on last edited by
                    #9

                    At last ………Its working …… Thanks a lot Prasad …. I actually adding the dll file load in DlgProc after dialog load that my mistake which I did … now I have added in the WinMain ..now the dialog is getting displayed with the rich control. Thanks a lot Prasad once again …

                    H 1 Reply Last reply
                    0
                    • S Suresh H

                      At last ………Its working …… Thanks a lot Prasad …. I actually adding the dll file load in DlgProc after dialog load that my mistake which I did … now I have added in the WinMain ..now the dialog is getting displayed with the rich control. Thanks a lot Prasad once again …

                      H Offline
                      H Offline
                      Hamid Taebi
                      wrote on last edited by
                      #10

                      If you want to use of functions on a dll you need first to load it dll and then use of functions


                      WhiteSky


                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups