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. Did somebody see something like this?

Did somebody see something like this?

Scheduled Pinned Locked Moved The Lounge
question
10 Posts 7 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.
  • C Offline
    C Offline
    Carlos Antollini
    wrote on last edited by
    #1

    I was making some modifications in a code of another programmer writed, And I saw something like This.

    CString str;
    int i = 0;

    plbl.GetWinddowText(str);
    for(i; i < str.GetLength(); i++)
    {
    str.SetAt(i, ' ');
    }

    pbl.SetWindowText(str);

    Oh my God!!! X| Did SomeBody see something like this? Please I want to see more code like this. Cheers!!!! :-D Happy Friday for All... Carlos Antollini.

    L S J 3 Replies Last reply
    0
    • C Carlos Antollini

      I was making some modifications in a code of another programmer writed, And I saw something like This.

      CString str;
      int i = 0;

      plbl.GetWinddowText(str);
      for(i; i < str.GetLength(); i++)
      {
      str.SetAt(i, ' ');
      }

      pbl.SetWindowText(str);

      Oh my God!!! X| Did SomeBody see something like this? Please I want to see more code like this. Cheers!!!! :-D Happy Friday for All... Carlos Antollini.

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

      Great programming! What is this programmer doing now? Sure gets his work done, in a roundabout way though.:-D -Thomas

      1 Reply Last reply
      0
      • C Carlos Antollini

        I was making some modifications in a code of another programmer writed, And I saw something like This.

        CString str;
        int i = 0;

        plbl.GetWinddowText(str);
        for(i; i < str.GetLength(); i++)
        {
        str.SetAt(i, ' ');
        }

        pbl.SetWindowText(str);

        Oh my God!!! X| Did SomeBody see something like this? Please I want to see more code like this. Cheers!!!! :-D Happy Friday for All... Carlos Antollini.

        S Offline
        S Offline
        Sam C
        wrote on last edited by
        #3

        Maybe he's just making sure :-) Or, he comes from the days of old "C" dynamic memory allocation, where you always had to make sure. Reminds me of the CArray class for MFC (I think) where you have to call the member function (Get At) through the whole array, and finally RemoveAll, because RemoveAll doesn't de-allocate the objects in the heap.

        int i = 0;
        while (i < myArray.GetSize() )
        {
        delete myArray.GetAt( i++ );
        }

        myArray.RemoveAll();

        I don't know much of allocations/deallocating since I come from a C++ world, but why doesn't RemoveAll clear the array and deallocate all objects associated with the array? Sam C ---- MIS Director Hospitality Marketing Associates

        C L C Y 4 Replies Last reply
        0
        • S Sam C

          Maybe he's just making sure :-) Or, he comes from the days of old "C" dynamic memory allocation, where you always had to make sure. Reminds me of the CArray class for MFC (I think) where you have to call the member function (Get At) through the whole array, and finally RemoveAll, because RemoveAll doesn't de-allocate the objects in the heap.

          int i = 0;
          while (i < myArray.GetSize() )
          {
          delete myArray.GetAt( i++ );
          }

          myArray.RemoveAll();

          I don't know much of allocations/deallocating since I come from a C++ world, but why doesn't RemoveAll clear the array and deallocate all objects associated with the array? Sam C ---- MIS Director Hospitality Marketing Associates

          C Offline
          C Offline
          Carlos Antollini
          wrote on last edited by
          #4

          Hey, Sam is Nice to have news of you!!!! Nice Weekend. Carlos Antollini.

          S 1 Reply Last reply
          0
          • S Sam C

            Maybe he's just making sure :-) Or, he comes from the days of old "C" dynamic memory allocation, where you always had to make sure. Reminds me of the CArray class for MFC (I think) where you have to call the member function (Get At) through the whole array, and finally RemoveAll, because RemoveAll doesn't de-allocate the objects in the heap.

            int i = 0;
            while (i < myArray.GetSize() )
            {
            delete myArray.GetAt( i++ );
            }

            myArray.RemoveAll();

            I don't know much of allocations/deallocating since I come from a C++ world, but why doesn't RemoveAll clear the array and deallocate all objects associated with the array? Sam C ---- MIS Director Hospitality Marketing Associates

            L Offline
            L Offline
            loket
            wrote on last edited by
            #5

            You dont have to do that, you can write your own 'DeleteItem()' (or whatever it is called, forgot that) and it will be called when you remove elements from the array.

            L 1 Reply Last reply
            0
            • C Carlos Antollini

              Hey, Sam is Nice to have news of you!!!! Nice Weekend. Carlos Antollini.

              S Offline
              S Offline
              Sam C
              wrote on last edited by
              #6

              Carlos, how's it going? If you read my other post what happened is that for 3 weeks my home computer has been down, because I did an update to WinXP RC2 with a CD made from a bad ISO I downloaded, the install probably had nothing to do with what happened next and that was total hard disk failure, or so I thought, but after replacing my drive, my computer was still not resonding. To make a long story short I had to replace my mboard, CPU, and memory. But now I'm back online (couldn't log on from work :-) ) and it is great to hear from everybody and that everyone is doing well. Sam C ---- MIS Director Hospitality Marketing Associates

              1 Reply Last reply
              0
              • S Sam C

                Maybe he's just making sure :-) Or, he comes from the days of old "C" dynamic memory allocation, where you always had to make sure. Reminds me of the CArray class for MFC (I think) where you have to call the member function (Get At) through the whole array, and finally RemoveAll, because RemoveAll doesn't de-allocate the objects in the heap.

                int i = 0;
                while (i < myArray.GetSize() )
                {
                delete myArray.GetAt( i++ );
                }

                myArray.RemoveAll();

                I don't know much of allocations/deallocating since I come from a C++ world, but why doesn't RemoveAll clear the array and deallocate all objects associated with the array? Sam C ---- MIS Director Hospitality Marketing Associates

                C Offline
                C Offline
                Chris Maunder
                wrote on last edited by
                #7

                RemoveAll will remove the elements in the array, but it won't cleanup those elements. If the elements are pointers then you'll need to deallocate those pointers before your remove them from the array. cheers, Chris Maunder (CodeProject)

                1 Reply Last reply
                0
                • L loket

                  You dont have to do that, you can write your own 'DeleteItem()' (or whatever it is called, forgot that) and it will be called when you remove elements from the array.

                  L Offline
                  L Offline
                  loket
                  wrote on last edited by
                  #8

                  DestructElements() it is. It is a template function that can be used with CArray, CList and CMap. (if anyone still is using those that is.. :) )

                  1 Reply Last reply
                  0
                  • S Sam C

                    Maybe he's just making sure :-) Or, he comes from the days of old "C" dynamic memory allocation, where you always had to make sure. Reminds me of the CArray class for MFC (I think) where you have to call the member function (Get At) through the whole array, and finally RemoveAll, because RemoveAll doesn't de-allocate the objects in the heap.

                    int i = 0;
                    while (i < myArray.GetSize() )
                    {
                    delete myArray.GetAt( i++ );
                    }

                    myArray.RemoveAll();

                    I don't know much of allocations/deallocating since I come from a C++ world, but why doesn't RemoveAll clear the array and deallocate all objects associated with the array? Sam C ---- MIS Director Hospitality Marketing Associates

                    Y Offline
                    Y Offline
                    Yuri Gershanov
                    wrote on last edited by
                    #9

                    Otherwise you could not store anything but pointers to dynamically created objects in the CArray. :rose:

                    1 Reply Last reply
                    0
                    • C Carlos Antollini

                      I was making some modifications in a code of another programmer writed, And I saw something like This.

                      CString str;
                      int i = 0;

                      plbl.GetWinddowText(str);
                      for(i; i < str.GetLength(); i++)
                      {
                      str.SetAt(i, ' ');
                      }

                      pbl.SetWindowText(str);

                      Oh my God!!! X| Did SomeBody see something like this? Please I want to see more code like this. Cheers!!!! :-D Happy Friday for All... Carlos Antollini.

                      J Offline
                      J Offline
                      Jarek G
                      wrote on last edited by
                      #10

                      Hmm how about this? CString str; CString original; Original = str; int i = 0; plbl.GetWinddowText(str); for(i; i < str.GetLength(); i++) { str.SetAt(i, '*'); } pbl.SetWindowText(str); :)

                      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