How get the IEdge* from ILoop2* whith C++ or C++/Cli

I am a beginner with SolidWorks and its API. I am developing using usually “ordinary simple C++” .

My Visual Studio Project (V2008) is an ”application console CLR project”

I want to traverse a part and access to faces, loops, edges and so.

It seems OK for faces and loops, but at exe time, I get an exception when I try to acces Edges:

          IEdge *pEdge,**ppEdge;

          IFace2 *pFace,*pnextFace;

          ILoop2* pLoop,*pnextLoop;

          .......

            hres = pBody->IGetFirstFace(&pFace);  // returns OK

            while(pFace)

            {

                  hres = pFace->IGetFirstLoop(&pLoop); // return OK

                  while(pLoop)

                  {

                        pLoop->GetEdgeCount(&nbEdge);   // OK         

                        ppEdge = new IEdge*[nbEdge];   // is it Wrong ?

                        hres = pLoop->IGetEdges(ppEdge); // return OK , but is it wrong ? do I have tu use  GetEdges(VARIANT* retval);?

                        if(S_OK == hres)

                        {

                           for( ie=0 ; ie

                           {

                             pEdge = ppEdge[ie];

                             hres = pEdge->GetID(&idEdge);// OK for ie = 0
                              //  get an exception for ie !=0

                    .....

        }

Probably ppEdge is badly defined and badly accessed.  I tried also to use GetEdges in place of IGetEdges, but it gives a VARIANT, and I don’t  know how to extract and convert it into individual IEdges* .

SolidworksApi macros