double *p=new double [icount]
....
 dlg2 dlg;
/// 例如想把这个动态数组传递给另一个弹出对话框
   
  dlg.DoModal();    请不要用全局变量,用类的思想,求具体实现 

解决方案 »

  1.   

      class dlg2
      {
      public:
       dlg2();
       protected:
        double *m_p;
      
      }
      
      dlg2::dlg2(double *_p)
      m_p(_p)
      {
      
      }
      
      double *p=new double [icount]
      dlg2 dlg(p);
      
        dlg.DoModal();
      

  2.   

    class dlg2
      {
      public:
       dlg2(double *_p);
       protected:
        double *m_p;
        }
      

  3.   

    假设你的类结构如下:
    #include “dlg2.h"
    class YView: public CView//或者(CDialog,CWnd)等窗口类
    {
        double *p=new double [icount];    void Dialogshow( )
        {
            dlg2 dlg(this); //传递当前YView窗口指针作为dlg的父窗口
            dlg.DoModal(); 
        }
    }dlg2.h文件不进行改动,这里为了显眼,增加一个赋值函数
    class dlg2: public CDialog
    {
        void fuzhi();
    }
    dlg2.cpp文件
    #include "YView.h"                 //Cpp文件中引用父窗口类头文件dlg2::dlg2(CWnd* pParent /*=NULL*/): CDialog( dlg2::IDD, pParent)
    {}dlg2::fuzhi()
    {
         YView* pYview = ( YView* )GetParent(); //取得父窗口,并转换指针类型
         for( int i = 0; i < pYview->icount; i ++ )
         {
             pYview->p[i]//这里可以进行操作了
         }
    }
      

  4.   

    取得pYview指针后,还可以通过pYview指针找到其他的很多内容,包括在Yview下定义的其他对话框。
      

  5.   

    dlg2::dlg2(double *_p)
      m_p(_p)
      {
      
      }
    这句话写的混乱啊
      

  6.   

    既然是new出来的那直接把指针传过去就是了