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. Pls help to store values in a safearray nd retrive it back again...

Pls help to store values in a safearray nd retrive it back again...

Scheduled Pinned Locked Moved C / C++ / MFC
cssdata-structureshelptutorialquestion
4 Posts 2 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.
  • T Offline
    T Offline
    toogud
    wrote on last edited by
    #1

    Hi Can any one help me in storing integer values(3-4 values) which i get from a grid control in a Safearray....nd i need to use them again after storing.... This is the code which i wrote is this OK.. SAFEARRAY *intPixels; SAFEARRAYBOUND rgsabound[1]; rgsabound[0].lLbound = 0; rgsabound[0].cElements = 3; intPixels = SafeArrayCreate(VT_I4,1,rgsabound); int tempint_j = 0,tempint_p = 0; for(int i = 0;i < 3;i = i+1) { CString tempStr; //Getting Values from Grid tempStr = m_Grid.GetTextArray(i); //convert values from String to int //as they are from grid int tempint_a = atoi(tempStr); SafeArrayPutElement(intPixels,(long *)&tempint_j,(void *)&tempint_a); tempint_j= tempint_j + 1; } Will the above code stores the values obtained from the Grid control(m_Grid) in the Safe Array.... if this stores the integer values in SafeArray pls tell me how to get them back to Use them.....? Thanks

    H 1 Reply Last reply
    0
    • T toogud

      Hi Can any one help me in storing integer values(3-4 values) which i get from a grid control in a Safearray....nd i need to use them again after storing.... This is the code which i wrote is this OK.. SAFEARRAY *intPixels; SAFEARRAYBOUND rgsabound[1]; rgsabound[0].lLbound = 0; rgsabound[0].cElements = 3; intPixels = SafeArrayCreate(VT_I4,1,rgsabound); int tempint_j = 0,tempint_p = 0; for(int i = 0;i < 3;i = i+1) { CString tempStr; //Getting Values from Grid tempStr = m_Grid.GetTextArray(i); //convert values from String to int //as they are from grid int tempint_a = atoi(tempStr); SafeArrayPutElement(intPixels,(long *)&tempint_j,(void *)&tempint_a); tempint_j= tempint_j + 1; } Will the above code stores the values obtained from the Grid control(m_Grid) in the Safe Array.... if this stores the integer values in SafeArray pls tell me how to get them back to Use them.....? Thanks

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

      Do you need to SafeArrayGetElement

      _**


      **_

      WhiteSky


      T 1 Reply Last reply
      0
      • H Hamid Taebi

        Do you need to SafeArrayGetElement

        _**


        **_

        WhiteSky


        T Offline
        T Offline
        toogud
        wrote on last edited by
        #3

        I need to get the Values which i stored in the SafeArray Back.....by the by is the above code correct in storing the values in the safearray..

        H 1 Reply Last reply
        0
        • T toogud

          I need to get the Values which i stored in the SafeArray Back.....by the by is the above code correct in storing the values in the safearray..

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

          See here[^]maybe it is some helpful to you

          _**


          **_

          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