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. loading dll second time giving error "A required resource was unavailable"

loading dll second time giving error "A required resource was unavailable"

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++announcementlearning
27 Posts 4 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.
  • J Jochen Arndt

    I'll reply again to this message. You have added too much unformatted code to your other posts (therefore somebody has donevoted them).

    1. You should use the 'code' button on top of the CP message input window to format the selection as C++ code.
    2. You should limit the amount of code. Nobody here will step through too many lines.

    Regarding the CView deletion: Why do you use a CView derived class within a CDialog? Using a CWnd derived class as user control should solve your problem. CView classes are used with the document view model and expect to have a frame window as parent.

    A Offline
    A Offline
    appollosputnik
    wrote on last edited by
    #14

    your answer is not a solution. try to solve the problem.

    L J 2 Replies Last reply
    0
    • A appollosputnik

      your answer is not a solution. try to solve the problem.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #15

      sujandasmahapatra wrote:

      your answer is not a solution

      Being rude is not a solution either.

      Why is common sense not common? Never argue with an idiot. They will drag you down to their level where they are an expert. Sometimes it takes a lot of work to be lazy Individuality is fine, as long as we do it together - F. Burns

      1 Reply Last reply
      0
      • A appollosputnik

        your answer is not a solution. try to solve the problem.

        J Offline
        J Offline
        Jochen Arndt
        wrote on last edited by
        #16

        sujandasmahapatra wrote:

        your answer is not a solution

        The solution is to not use a CView derived class as a client window of a dialog.

        sujandasmahapatra wrote:

        try to solve the problem

        No. You must solve the problem. It's not my job. The only thing I can do, is to help you.

        L A C 3 Replies Last reply
        0
        • J Jochen Arndt

          sujandasmahapatra wrote:

          your answer is not a solution

          The solution is to not use a CView derived class as a client window of a dialog.

          sujandasmahapatra wrote:

          try to solve the problem

          No. You must solve the problem. It's not my job. The only thing I can do, is to help you.

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #17

          5 for your patience.

          Why is common sense not common? Never argue with an idiot. They will drag you down to their level where they are an expert. Sometimes it takes a lot of work to be lazy Individuality is fine, as long as we do it together - F. Burns

          1 Reply Last reply
          0
          • J Jochen Arndt

            sujandasmahapatra wrote:

            your answer is not a solution

            The solution is to not use a CView derived class as a client window of a dialog.

            sujandasmahapatra wrote:

            try to solve the problem

            No. You must solve the problem. It's not my job. The only thing I can do, is to help you.

            A Offline
            A Offline
            appollosputnik
            wrote on last edited by
            #18

            i wanted a view on the dialog. so i derived from cview and created the view in the dialog. 1st time everything is coming fine. but without closing the client application if i try to launch again the dialog then it's giving error. Please give me some suggestion how can i get rid of it. Thanks

            J 1 Reply Last reply
            0
            • A appollosputnik

              i wanted a view on the dialog. so i derived from cview and created the view in the dialog. 1st time everything is coming fine. but without closing the client application if i try to launch again the dialog then it's giving error. Please give me some suggestion how can i get rid of it. Thanks

              J Offline
              J Offline
              Jochen Arndt
              wrote on last edited by
              #19

              The problem is that the view is not properly closed. But even if you would close it properly, there will be other problems. A CView is not designed to be a child view of a dialog. It must be a child of a CFrameWnd derived class. Change your CView class to be based on a CWnd.

              1 Reply Last reply
              0
              • J Jochen Arndt

                sujandasmahapatra wrote:

                your answer is not a solution

                The solution is to not use a CView derived class as a client window of a dialog.

                sujandasmahapatra wrote:

                try to solve the problem

                No. You must solve the problem. It's not my job. The only thing I can do, is to help you.

                C Offline
                C Offline
                Chris Meech
                wrote on last edited by
                #20

                And demonstrating a great deal of restraint as well. Good for you. :)

                Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra] posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]

                A 1 Reply Last reply
                0
                • C Chris Meech

                  And demonstrating a great deal of restraint as well. Good for you. :)

                  Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra] posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]

                  A Offline
                  A Offline
                  appollosputnik
                  wrote on last edited by
                  #21

                  wherever i used GetDc() i have done ReleaseDC...Still the error is coming, "A required resource was unavailable". Please help me to resolve this. why 2nd time my application is not launching.? please tell whatelse I need to do ? Thanks

                  L 1 Reply Last reply
                  0
                  • J Jochen Arndt

                    The error is very probably in your DLL showing a dialog. Common sources are forgetting to release DCs and GDI objects.

                    A Offline
                    A Offline
                    appollosputnik
                    wrote on last edited by
                    #22

                    Can u give me your mail id so that I can send you the project. Can u help me ?

                    J 1 Reply Last reply
                    0
                    • A appollosputnik

                      wherever i used GetDc() i have done ReleaseDC...Still the error is coming, "A required resource was unavailable". Please help me to resolve this. why 2nd time my application is not launching.? please tell whatelse I need to do ? Thanks

                      L Offline
                      L Offline
                      Lost User
                      wrote on last edited by
                      #23

                      sujandasmahapatra wrote:

                      please tell whatelse I need to do ?

                      You probably need to do some serious debugging, firstly to find out why and where this message is produced.

                      Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman

                      A 1 Reply Last reply
                      0
                      • A appollosputnik

                        Can u give me your mail id so that I can send you the project. Can u help me ?

                        J Offline
                        J Offline
                        Jochen Arndt
                        wrote on last edited by
                        #24

                        Sorry, but I don't want to write your code. I - and most others here - just enjoy helping. The design of your application is definitely broken. That is your problem. Tampering with the existing code is the wrong way. Reconsider the design. Read about dialogs hosting user controls.

                        1 Reply Last reply
                        0
                        • L Lost User

                          sujandasmahapatra wrote:

                          please tell whatelse I need to do ?

                          You probably need to do some serious debugging, firstly to find out why and where this message is produced.

                          Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman

                          A Offline
                          A Offline
                          appollosputnik
                          wrote on last edited by
                          #25

                          it's giving this error First-chance exception at 0x7c812afb in TestRev.exe: Microsoft C++ exception: CResourceException at memory location 0x0012ed28.. Crashing in wincore.cpp -- AfxRegisterClass(WNDCLASS* lpWndClass)

                          L 1 Reply Last reply
                          0
                          • A appollosputnik

                            it's giving this error First-chance exception at 0x7c812afb in TestRev.exe: Microsoft C++ exception: CResourceException at memory location 0x0012ed28.. Crashing in wincore.cpp -- AfxRegisterClass(WNDCLASS* lpWndClass)

                            L Offline
                            L Offline
                            Lost User
                            wrote on last edited by
                            #26

                            And what does that tell us? Pretty much nothing. You need to look at your code where this error occurs and find out what your program is doing, or trying to do: that is where the error lies.

                            Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman

                            1 Reply Last reply
                            0
                            • J Jochen Arndt

                              The error is very probably in your DLL showing a dialog. Common sources are forgetting to release DCs and GDI objects.

                              A Offline
                              A Offline
                              appollosputnik
                              wrote on last edited by
                              #27

                              I have got the problem I have implemented the PrecreateWindow for my view class. just check this code. [code] BOOL CMyView::PreCreateWindow(CREATESTRUCT& cs) { cs.lpszClass = ::AfxRegisterWndClass(CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_OWNDC,::LoadCursor(NULL, IDC_ARROW), NULL, NULL); cs.style |= WS_CLIPSIBLINGS | WS_CLIPCHILDREN; cs.dwExStyle = WS_EX_CLIENTEDGE; return CView::PreCreateWindow(cs); } [/code] If I remove the first line, i.e cs.lpszClass = ::AfxRegisterWndClass(CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_OWNDC,::LoadCursor(NULL, IDC_ARROW), NULL, NULL); then my dll window is coming all the times from the client call. But it's flickering . So now please help me what can I do to resolve this. I think some of you must have understood the problem, please help me. Thanks a lot.

                              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