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. The Lounge
  3. Bug in CCheckListBox...

Bug in CCheckListBox...

Scheduled Pinned Locked Moved The Lounge
announcementc++debugginghelplearning
12 Posts 5 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.
  • M Mario M

    There is a bug in CCheckListBox, when loading a DLL with the dialog and ListBox control (derived from CCheckListBox), the Checklist is always empty, no matter how many AddStrings do you use. This always happends in the latest version of "MFC Static Release". In debug mode it works and in Shared MFC Release works again. There were no conflicts between compiler settings from the EXEcutable and DLL file with the dialogs containing the controls. And also there were no conflicts between resource IDs or any programmer mistake. After changing the CCheckListBox derived control to CListBox it worked with no problems. Thanks M$ for your geniune bugs :eek: :eek: :eek: :mad: :mad: :mad: :mad:

    A Offline
    A Offline
    AlexMarbus
    wrote on last edited by
    #2

    And also there were no conflicts between resource IDs or any programmer mistake. How can you be so sure that it's not a programmer's mistake? (Just curious) -- Alex Marbus www.marbus.net But then again, I could be wrong.

    M 1 Reply Last reply
    0
    • M Mario M

      There is a bug in CCheckListBox, when loading a DLL with the dialog and ListBox control (derived from CCheckListBox), the Checklist is always empty, no matter how many AddStrings do you use. This always happends in the latest version of "MFC Static Release". In debug mode it works and in Shared MFC Release works again. There were no conflicts between compiler settings from the EXEcutable and DLL file with the dialogs containing the controls. And also there were no conflicts between resource IDs or any programmer mistake. After changing the CCheckListBox derived control to CListBox it worked with no problems. Thanks M$ for your geniune bugs :eek: :eek: :eek: :mad: :mad: :mad: :mad:

      T Offline
      T Offline
      Tim Smith
      wrote on last edited by
      #3

      Heh, works in debug and not in release. I have had those bugs before. Build your release mode application with debug information and step into the AddString routine (it is very important that you still have your optimizations enabled). My bet is you have some strange stack problem or an unitialized variable. Tim Smith Descartes Systems Sciences, Inc.

      R M 2 Replies Last reply
      0
      • T Tim Smith

        Heh, works in debug and not in release. I have had those bugs before. Build your release mode application with debug information and step into the AddString routine (it is very important that you still have your optimizations enabled). My bet is you have some strange stack problem or an unitialized variable. Tim Smith Descartes Systems Sciences, Inc.

        R Offline
        R Offline
        Ray Hayes
        wrote on last edited by
        #4

        Or if you're adding members using a structure, make sure you ZeroMemory the structure first, some of the members you imagine are not used can lead to a failure. Regards, Ray

        1 Reply Last reply
        0
        • A AlexMarbus

          And also there were no conflicts between resource IDs or any programmer mistake. How can you be so sure that it's not a programmer's mistake? (Just curious) -- Alex Marbus www.marbus.net But then again, I could be wrong.

          M Offline
          M Offline
          Mario M
          wrote on last edited by
          #5

          It can be a programmer mistake, but not mine, maybe microsoft... I have created an entire new application just with a CCheckListBox and I have added the string AddString(_T("Test")); and it happends the same. We have a separate resource DLL file which is loaded at startup. All other controls works well except this. Even AddString works when we derive the listbox from CListBox not CCheckListBox. After almost 8 hours of debugging and compiling with all sorts of settings and modifications, I found that if we compile the executable/application with MFC Shared it works and when it's compiled with MFC Static it does not work. The DLL was compiled using the same settings as the application/exe. I know sounds strange, but I'm sure there is something with MFC CCheckListBox code. X|

          1 Reply Last reply
          0
          • T Tim Smith

            Heh, works in debug and not in release. I have had those bugs before. Build your release mode application with debug information and step into the AddString routine (it is very important that you still have your optimizations enabled). My bet is you have some strange stack problem or an unitialized variable. Tim Smith Descartes Systems Sciences, Inc.

            M Offline
            M Offline
            Mario M
            wrote on last edited by
            #6

            I have created an entire new application just with a CCheckListBox and I have added the string AddString(_T("Test")); and it happends the same. We have a separate resource DLL file which is loaded at startup. All other controls works well except this. Even AddString works when we derive the listbox from CListBox not CCheckListBox. After almost 8 hours of debugging and compiling with all sorts of settings and modifications, I found that if we compile the executable/application with MFC Shared it works and when it's compiled with MFC Static it does not work. The DLL was compiled using the same settings as the application/exe. I know sounds strange, but I'm sure there is something with MFC CCheckListBox code. X|

            T M 2 Replies Last reply
            0
            • M Mario M

              I have created an entire new application just with a CCheckListBox and I have added the string AddString(_T("Test")); and it happends the same. We have a separate resource DLL file which is loaded at startup. All other controls works well except this. Even AddString works when we derive the listbox from CListBox not CCheckListBox. After almost 8 hours of debugging and compiling with all sorts of settings and modifications, I found that if we compile the executable/application with MFC Shared it works and when it's compiled with MFC Static it does not work. The DLL was compiled using the same settings as the application/exe. I know sounds strange, but I'm sure there is something with MFC CCheckListBox code. X|

              T Offline
              T Offline
              Tim Smith
              wrote on last edited by
              #7

              Hmm, I am going to have to try it when I get into work tomorrow. Tim Smith Descartes Systems Sciences, Inc.

              1 Reply Last reply
              0
              • M Mario M

                I have created an entire new application just with a CCheckListBox and I have added the string AddString(_T("Test")); and it happends the same. We have a separate resource DLL file which is loaded at startup. All other controls works well except this. Even AddString works when we derive the listbox from CListBox not CCheckListBox. After almost 8 hours of debugging and compiling with all sorts of settings and modifications, I found that if we compile the executable/application with MFC Shared it works and when it's compiled with MFC Static it does not work. The DLL was compiled using the same settings as the application/exe. I know sounds strange, but I'm sure there is something with MFC CCheckListBox code. X|

                M Offline
                M Offline
                Martin Richter rMVP C
                wrote on last edited by
                #8

                Did you put AFXRES.RC into your RC include list? Martin

                M 1 Reply Last reply
                0
                • M Martin Richter rMVP C

                  Did you put AFXRES.RC into your RC include list? Martin

                  M Offline
                  M Offline
                  Mario M
                  wrote on last edited by
                  #9

                  I have included afxres.h Now I have included afxres.rc in the DLL file and it works. :-O I thought that afxres.rc is already included in MFC static library. How come that other controls worked without including the afxres.rc file ? (checkboxes, listbox, and all other controls) Thanks a lot !! :cool: :cool: :suss: :)

                  T M 2 Replies Last reply
                  0
                  • M Mario M

                    I have included afxres.h Now I have included afxres.rc in the DLL file and it works. :-O I thought that afxres.rc is already included in MFC static library. How come that other controls worked without including the afxres.rc file ? (checkboxes, listbox, and all other controls) Thanks a lot !! :cool: :cool: :suss: :)

                    T Offline
                    T Offline
                    Tim Smith
                    wrote on last edited by
                    #10

                    The control is an MFC add-on. It isn't part of COMCTRL32. Thus, it requires extra resources for the bitmaps and such. Tim Smith Descartes Systems Sciences, Inc.

                    M 1 Reply Last reply
                    0
                    • T Tim Smith

                      The control is an MFC add-on. It isn't part of COMCTRL32. Thus, it requires extra resources for the bitmaps and such. Tim Smith Descartes Systems Sciences, Inc.

                      M Offline
                      M Offline
                      Mario M
                      wrote on last edited by
                      #11

                      Are there other controls than CCheckListBox which are affected if I have not inculded afxres.rc ? Thanks.

                      1 Reply Last reply
                      0
                      • M Mario M

                        I have included afxres.h Now I have included afxres.rc in the DLL file and it works. :-O I thought that afxres.rc is already included in MFC static library. How come that other controls worked without including the afxres.rc file ? (checkboxes, listbox, and all other controls) Thanks a lot !! :cool: :cool: :suss: :)

                        M Offline
                        M Offline
                        Martin Richter rMVP C
                        wrote on last edited by
                        #12

                        NO! Remember, that resource references can't be resolved by the linker. That ist very very vary sad, but we have to live with this. Martin

                        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