硬汉嵌入式论坛

 找回密码
 立即注册
查看: 1433|回复: 5
收起左侧

[emWin] 求助各位大佬,使用STemwin通过图标反复切换两个界面。一开始是正常的,切换到第五次就卡住不动了。

[复制链接]

2

主题

7

回帖

52

积分

初级会员

积分
52
发表于 2017-12-24 11:45:45 | 显示全部楼层 |阅读模式
本人萌新。使用STemwin在Window中生成了四个图标,每个图标可以切换到其他Window。每次切换我都使用WM_DeleteWindow()把之前的Window删除。但是运行时发现两个界面互相切换时到了第五次就卡住了。使用GUI_ALLOC_GetNumFreeBytes(),发现内存并没有减少。这是啥原因啊?。各位大佬,江湖救急。。。附代码如下:


#include "icontest.h"
/*********************************************************************
*                                                                    *
*                SEGGER Microcontroller GmbH & Co. KG                *
*        Solutions for real time microcontroller applications        *
*                                                                    *
**********************************************************************
*                                                                    *
* C-file generated by:                                               *
*                                                                    *
*        GUI_Builder for emWin version 5.40                          *
*        Compiled Jun 22 2017, 10:13:26                              *
*        (c) 2017 Segger Microcontroller GmbH & Co. KG               *
*                                                                    *
**********************************************************************
*                                                                    *
*        Internet: www.segger.com  Support: support@segger.com       *
*                                                                    *
**********************************************************************
*/

// USER START (Optionally insert additional includes)
// USER END

#include "DIALOG.h"

/*********************************************************************
*
*       Defines
*
**********************************************************************
*/
#define ID_WINDOW_0  (GUI_ID_USER + 0x00)
#define ID_ICONVIEW_0  (GUI_ID_USER + 0x01)
#define ID_ICONVIEW_1  (GUI_ID_USER + 0x02)
#define ID_ICONVIEW_2  (GUI_ID_USER + 0x03)
#define ID_ICONVIEW_3  (GUI_ID_USER + 0x04)


// USER START (Optionally insert additional defines)
#define RECOMMENDED_MEMORY (1024L * 20)
// USER END

/*********************************************************************
*
*       Static data
*
**********************************************************************
*/

// USER START (Optionally insert additional static data)


typedef struct{
        const GUI_BITMAP         *pBitmap;   //app图标
        const char                        *pText;     //app图标名字
}BITMAP_ITEM;




static const BITMAP_ITEM BitmapItemTab1[]={
       
        {&bmtiming,                "Time"},
        {&bmwalk,                "Walk"},
        {&bmsos,        "SOS"        },
        {&bmtalk,        "Talk"},
       
       
};



// USER END

/*********************************************************************
*
*       _aDialogCreate
*/
static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
  { WINDOW_CreateIndirect, "Window", ID_WINDOW_0, 0, 0, 240, 240, 0, 0x0, 0 },
  { ICONVIEW_CreateIndirect, "Iconview", ID_ICONVIEW_0, 0, 0, 120, 120, 0, 0x0, 0 },
  { ICONVIEW_CreateIndirect, "Iconview", ID_ICONVIEW_1, 120, 0, 120, 120, 0, 0x0, 0 },
  { ICONVIEW_CreateIndirect, "Iconview", ID_ICONVIEW_2, 0, 120, 120, 120, 0, 0x0, 0 },
  { ICONVIEW_CreateIndirect, "Iconview", ID_ICONVIEW_3, 120, 120, 120, 120, 0, 0x0, 0 },
  // USER START (Optionally insert additional widgets)
  // USER END
};

/*********************************************************************
*
*       Static code
*
**********************************************************************
*/

// USER START (Optionally insert additional static code)


// USER END

/*********************************************************************
*
*       _cbDialog
*/
static void _cbIconDialog(WM_MESSAGE * pMsg) {
  static int NCode;
  static int Id;
  // USER START (Optionally insert additional variables)
        static ICONVIEW_Handle  IconviewWin;

        //int i;
  // USER END

  switch (pMsg->MsgId) {
               
                case WM_PAINT:
                GUI_SetBkColor(GUI_BLACK);
                GUI_Clear();
                break;
        case WM_INIT_DIALOG:
        IconviewWin=WM_GetDialogItem(pMsg->hWin,ID_ICONVIEW_0);
        ICONVIEW_SetFont(IconviewWin,&GUI_Font8_ASCII);
        ICONVIEW_SetBkColor(IconviewWin,ICONVIEW_CI_BK,GUI_BLACK);
        ICONVIEW_SetIconAlign(IconviewWin,ICONVIEW_IA_LEFT|ICONVIEW_IA_TOP);
  ICONVIEW_AddBitmapItem(IconviewWin,BitmapItemTab1[0].pBitmap,BitmapItemTab1[0].pText);
       
        IconviewWin=WM_GetDialogItem(pMsg->hWin,ID_ICONVIEW_1);
        ICONVIEW_SetFont(IconviewWin,&GUI_Font16_ASCII);
  ICONVIEW_SetBkColor(IconviewWin,ICONVIEW_CI_BK,GUI_BLACK);
        ICONVIEW_SetIconAlign(IconviewWin,ICONVIEW_IA_LEFT|ICONVIEW_IA_TOP);
  ICONVIEW_AddBitmapItem(IconviewWin,BitmapItemTab1[1].pBitmap,BitmapItemTab1[1].pText);
       
        IconviewWin=WM_GetDialogItem(pMsg->hWin,ID_ICONVIEW_2);
        ICONVIEW_SetFont(IconviewWin,&GUI_Font16_ASCII);
  ICONVIEW_SetBkColor(IconviewWin,ICONVIEW_CI_BK,GUI_BLACK);
        ICONVIEW_SetIconAlign(IconviewWin,ICONVIEW_IA_LEFT|ICONVIEW_IA_TOP);
  ICONVIEW_AddBitmapItem(IconviewWin,BitmapItemTab1[2].pBitmap,BitmapItemTab1[2].pText);
       
        IconviewWin=WM_GetDialogItem(pMsg->hWin,ID_ICONVIEW_3);
        ICONVIEW_SetFont(IconviewWin,&GUI_Font16_ASCII);
  ICONVIEW_SetBkColor(IconviewWin,ICONVIEW_CI_BK,GUI_BLACK);
        ICONVIEW_SetIconAlign(IconviewWin,ICONVIEW_IA_LEFT|ICONVIEW_IA_TOP);
  ICONVIEW_AddBitmapItem(IconviewWin,BitmapItemTab1[3].pBitmap,BitmapItemTab1[3].pText);

break;
               
  case WM_NOTIFY_PARENT:
    Id    = WM_GetId(pMsg->hWinSrc);
    NCode = pMsg->Data.v;
    switch(Id) {
    case ID_ICONVIEW_0: // Notifications sent by 'Iconview'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
                         
//                    WM_DeleteWindow(pMsg->hWin);
//                          pMsg->hWin=0;
                          GUI_EndDialog(pMsg->hWin,0);
        WM_DeleteWindow(pMsg->hWin);
                          main_time_set();

        // USER END
        break;
      case WM_NOTIFICATION_MOVED_OUT:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_SCROLL_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_SEL_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_ICONVIEW_1: // Notifications sent by 'Iconview'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
       
//                  WM_DeleteWindow(pMsg->hWin);
//                        pMsg->hWin=0;
        GUI_EndDialog(pMsg->hWin,0);
        WM_DeleteWindow(pMsg->hWin);
        MainGraphTask();


        // USER END
        break;
      case WM_NOTIFICATION_MOVED_OUT:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_SCROLL_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_SEL_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_ICONVIEW_2: // Notifications sent by 'Iconview'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
                       
        WM_HideWindow(pMsg->hWin);
                          messageboxtest();
                          WM_ShowWindow(pMsg->hWin);
        // USER END
        break;
      case WM_NOTIFICATION_MOVED_OUT:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_SCROLL_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_SEL_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_ICONVIEW_3: // Notifications sent by 'Iconview'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_MOVED_OUT:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_SCROLL_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_SEL_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    // USER START (Optionally insert additional code for further Ids)
    // USER END
    }
    break;
  // USER START (Optionally insert additional message handling)
                        case WM_DELETE:

                break;
  // USER END
  default:
    WM_DefaultProc(pMsg);
    break;
  }
}

/*********************************************************************
*
*       Public code
*
**********************************************************************
*/
/*********************************************************************
*
*       CreateWindow
*/

static WM_HWIN CreateIconWindow(void) {
  static WM_HWIN hWin;

  hWin = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbIconDialog, WM_HBKWIN, 0, 0);
  return hWin;
}

// USER START (Optionally insert additional public code)

void icontest(void)
{
        static WM_HWIN IhWin;
  if (GUI_ALLOC_GetNumFreeBytes() < RECOMMENDED_MEMORY) {
    GUI_ErrorOut("Not enough memory available.");
    return;
  }
        IhWin = CreateIconWindow();


        while(1)
        {

                GUI_Delay(100);
               
        }
       
}

// USER END

/*************************** End of file ****************************/







///*********************************************************************
//*                                                                    *
//*                SEGGER Microcontroller GmbH & Co. KG                *
//*        Solutions for real time microcontroller applications        *
//*                                                                    *
//**********************************************************************
//*                                                                    *
//* C-file generated by:                                               *
//*                                                                    *
//*        GUI_Builder for emWin version 5.40                          *
//*        Compiled Jun 22 2017, 10:13:26                              *
//*        (c) 2017 Segger Microcontroller GmbH & Co. KG               *
//*                                                                    *
//**********************************************************************
//*                                                                    *
//*        Internet: www.segger.com  Support: support@segger.com       *
//*                                                                    *
//**********************************************************************
//*/

//// USER START (Optionally insert additional includes)
//// USER END

//#include "DIALOG.h"

///*********************************************************************
//*
//*       Defines
//*
//**********************************************************************
//*/
//#define ID_WINDOW_0  (GUI_ID_USER + 0x00)
//#define ID_ICONVIEW_0  (GUI_ID_USER + 0x01)


//// USER START (Optionally insert additional defines)
//// USER END

///*********************************************************************
//*
//*       Static data
//*
//**********************************************************************
//*/

//// USER START (Optionally insert additional static data)

//typedef struct{
//        const GUI_BITMAP         *pBitmap;   //app图标
//        const char                        *pText;     //app图标名字
//}BITMAP_ITEM;




//static const BITMAP_ITEM BitmapItemTab1[]={
//       
//        {&bmstepcount,                "Step"},
//        {&bmlocation,                "Location"},
//        {&bmpill,        "ill"        },
//        {&bmstepcount,        "Setting"},
//};

//// USER END

///*********************************************************************
//*
//*       _aDialogCreate
//*/
//static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
//  { WINDOW_CreateIndirect, "Window", ID_WINDOW_0, 0, 0, 240, 240, 0, 0x0, 0 },
//  { ICONVIEW_CreateIndirect, "Iconview", ID_ICONVIEW_0, 0, 0, 240, 240, 0, 0x0, 0 },
//  // USER START (Optionally insert additional widgets)
//  // USER END
//};

///*********************************************************************
//*
//*       Static code
//*
//**********************************************************************
//*/

//// USER START (Optionally insert additional static code)
//// USER END

///*********************************************************************
//*
//*       _cbDialog
//*/
//static void _cbDialog(WM_MESSAGE * pMsg) {
//  int NCode;
//  int Id;
//  // USER START (Optionally insert additional variables)
//        static int Iconview0_Sel;
//        ICONVIEW_Handle  IconviewWin;
//        int i;
//  // USER END

//  switch (pMsg->MsgId) {
//               
//        case WM_PAINT:
//                GUI_SetBkColor(GUI_BLACK);
//                GUI_Clear();
//        break;
//       
//        case WM_INIT_DIALOG:
//  IconviewWin=WM_GetDialogItem(pMsg->hWin,ID_ICONVIEW_0);               
//        ICONVIEW_SetFont(IconviewWin,&GUI_Font16_ASCII);
//        ICONVIEW_SetBkColor(IconviewWin,ICONVIEW_CI_SEL,GUI_WHITE|0X70000000);
////        ICONVIEW_SetSpace(IconviewWin,GUI_COORD_X,10);
////        ICONVIEW_SetSpace(IconviewWin,GUI_COORD_Y,10);
//        ICONVIEW_SetIconAlign(IconviewWin,ICONVIEW_IA_LEFT |ICONVIEW_IA_TOP);
//        for(i=0;i<(GUI_COUNTOF(BitmapItemTab1));i++)
//        {
//                ICONVIEW_AddBitmapItem(IconviewWin,BitmapItemTab1.pBitmap,BitmapItemTab1.pText);
//        }
//        break;
//       
//  case WM_NOTIFY_PARENT:
//    Id    = WM_GetId(pMsg->hWinSrc);
//    NCode = pMsg->Data.v;
//    switch(Id) {
//    case ID_ICONVIEW_0: // Notifications sent by 'Iconview'
//      switch(NCode) {
//      case WM_NOTIFICATION_CLICKED:
//        // USER START (Optionally insert code for reacting on notification message)
//        // USER END
//        break;
//      case WM_NOTIFICATION_RELEASED:
//        // USER START (Optionally insert code for reacting on notification message)
//                        Iconview0_Sel=ICONVIEW_GetSel(pMsg->hWinSrc);
//                                                        switch(Iconview0_Sel)
//                                                        {
//                                                                case 0:                //APP0
//                                    StepcountApp();      //创建BagAPP
//                                                                        break;
//                                                                case 1:                //APP1
//                                    LocationApp();     //创建BookAPP
//                                                                        break;
//                    case 2:                //APP2
//                                    PillApp();     //创建BookshAPP
//                                                                        break;
//                     case 3:                //APP3
//                                    SettingApp();    //创建BrowerAPP
//                                                                        break;
//                                                        }
//               
//        // USER END
//        break;
//      case WM_NOTIFICATION_MOVED_OUT:
//        // USER START (Optionally insert code for reacting on notification message)
//        // USER END
//        break;
//      case WM_NOTIFICATION_SCROLL_CHANGED:
//        // USER START (Optionally insert code for reacting on notification message)
//        // USER END
//        break;
//      case WM_NOTIFICATION_SEL_CHANGED:
//        // USER START (Optionally insert code for reacting on notification message)
//        // USER END
//        break;
//      // USER START (Optionally insert additional code for further notification handling)
//      // USER END
//      }
//      break;
//    // USER START (Optionally insert additional code for further Ids)
//    // USER END
//    }
//    break;
//  // USER START (Optionally insert additional message handling)
//  // USER END
//  default:
//    WM_DefaultProc(pMsg);
//    break;
//  }
//}

///*********************************************************************
//*
//*       Public code
//*
//**********************************************************************
//*/
///*********************************************************************
//*
//*       CreateWindow
//*/

//WM_HWIN CreateIconWindow(void) {
//  WM_HWIN hWin;

//  hWin = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, WM_HBKWIN, 0, 0);
//  return hWin;
//}

//// USER START (Optionally insert additional public code)



//void icontest(void)
//{
//        GUI_Init();
//        WM_SetCreateFlags(WM_CF_MEMDEV);
//        CreateIconWindow();
//        while(1)
//        {
//                GUI_Delay(100);
//               
//        }
//       
//}

//// USER END

///*************************** End of file ****************************/



另一个界面切换回去

#include "stepcount.h"
/*********************************************************************
*                                                                    *
*                SEGGER Microcontroller GmbH & Co. KG                *
*        Solutions for real time microcontroller applications        *
*                                                                    *
**********************************************************************
*                                                                    *
* C-file generated by:                                               *
*                                                                    *
*        GUI_Builder for emWin version 5.40                          *
*        Compiled Jun 22 2017, 10:13:26                              *
*        (c) 2017 Segger Microcontroller GmbH & Co. KG               *
*                                                                    *
**********************************************************************
*                                                                    *
*        Internet: www.segger.com  Support: support@segger.com       *
*                                                                    *
**********************************************************************
*/

// USER START (Optionally insert additional includes)
// USER END

#include "DIALOG.h"

/*********************************************************************
*
*       Defines
*
**********************************************************************
*/
#define ID_WINDOW_0  (GUI_ID_USER + 0x00)
#define ID_GRAPH_0  (GUI_ID_USER + 0x01)
#define ID_TEXT_0  (GUI_ID_USER + 0x02)
#define ID_TEXT_1  (GUI_ID_USER + 0x03)
#define ID_BUTTON_0 (GUI_ID_USER+0x04)

// USER START (Optionally insert additional defines)
#define RECOMMENDED_MEMORY (1024L * 20)

// USER END

/*********************************************************************
*
*       Static data
*
**********************************************************************
*/

// USER START (Optionally insert additional static data)
static GRAPH_SCALE_Handle hScaleV;
static GRAPH_SCALE_Handle hScaleH;
static GRAPH_DATA_Handle  ahData;
static uint32_t memnum;

static WM_HWIN hWin;
// USER END

/*********************************************************************
*
*       _aDialogCreate
*/
static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
  { WINDOW_CreateIndirect, "Window", ID_WINDOW_0, 0, 0, 240, 240, 0, 0x0, 0 },
  { GRAPH_CreateIndirect, "Graph", ID_GRAPH_0, 15, 15, 210, 160, 0, 0x0, 0 },
  { TEXT_CreateIndirect, "Text", ID_TEXT_0, 20, 180, 200, 25, 0, 0x64, 0 },
  { TEXT_CreateIndirect, "Text", ID_TEXT_1, 20, 205, 80, 20, 0, 0x64, 0 },
        { BUTTON_CreateIndirect, "Button", ID_BUTTON_0, 165, 210, 70, 25, 0, 0x0, 0 },
  // USER START (Optionally insert additional widgets)
  // USER END
};

/*********************************************************************
*
*       Static code
*
**********************************************************************
*/

// USER START (Optionally insert additional static code)
// USER END

/*********************************************************************
*
*       _cbDialog
*/
static void _cbGraphDialog(WM_MESSAGE * pMsg) {
  static WM_HWIN hItem;
  // USER START (Optionally insert additional variables)
        static int     NCode;
  static int     Id;
  // USER END

  switch (pMsg->MsgId) {
               
                case WM_PAINT:
                        GUI_SetBkColor(GUI_BLACK);
                break;
                               
  case WM_INIT_DIALOG:
    //
    // Initialization of 'Graph'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_GRAPH_0);

                ahData = GRAPH_DATA_YT_Create(GUI_GREEN,400,0,0);
                GRAPH_AttachData(hItem,ahData);
          GRAPH_SetGridDistY(hItem,20);
          GRAPH_SetGridDistX(hItem,10);
          GRAPH_SetGridVis(hItem,1);
          hScaleV=GRAPH_SCALE_Create(13,GUI_TA_RIGHT,GRAPH_SCALE_CF_VERTICAL,25);
                GRAPH_AttachScale(hItem,hScaleV);
          hScaleH=GRAPH_SCALE_Create(150,GUI_TA_RIGHT,GRAPH_SCALE_CF_HORIZONTAL,25);
          GRAPH_AttachScale(hItem,hScaleH);
                GRAPH_SCALE_SetFactor(hScaleV,0.4);
          GRAPH_SCALE_SetTextColor(hScaleV,GUI_RED);
                GRAPH_SCALE_SetFactor(hScaleH,0.04);
          GRAPH_SCALE_SetTextColor(hScaleH,GUI_RED);

       
          GRAPH_SetBorder(hItem, 14, 0, 0, 13);

    //
    // Initialization of 'Text'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_0);
    TEXT_SetFont(hItem, GUI_FONT_20_1);
    TEXT_SetText(hItem, "Stepcount:");
    //
    // Initialization of 'Text'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_1);
    TEXT_SetFont(hItem, GUI_FONT_20_ASCII);
    TEXT_SetText(hItem, "Calorie:");
    // USER START (Optionally insert additional code for further widget initialization)
                hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_0);
    BUTTON_SetFont(hItem, GUI_FONT_20_ASCII);
    BUTTON_SetText(hItem, "Cancle");
               
    // USER END
    break;
  // USER START (Optionally insert additional message handling)
        case WM_NOTIFY_PARENT:
          Id    = WM_GetId(pMsg->hWinSrc);
    NCode = pMsg->Data.v;       
                switch(Id) {
    case ID_BUTTON_0: // Notifications sent by 'Button'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
//                                hItem = pMsg->hWin;
                          if(WM_IsWindow(pMsg->hWin))
                                {
//                                WM_DeleteWindow(pMsg->hWin);
//                                hItem=0;
                                GUI_EndDialog(pMsg->hWin,0);
                                WM_DeleteWindow(pMsg->hWin);
                          icontest();


                                }
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    // USER START (Optionally insert additional code for further Ids)
    // USER END
    }
    break;

    case WM_DELETE:

                break;
  // USER END
  default:
    WM_DefaultProc(pMsg);
    break;
  }
}

/*********************************************************************
*
*       Public code
*
**********************************************************************
*/
/*********************************************************************
*
*       CreateWindow
*/

static WM_HWIN CreateGraphWindow(void) {
  static WM_HWIN hWin;

  hWin = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbGraphDialog, WM_HBKWIN, 0, 0);
  return hWin;
}

// USER START (Optionally insert additional public code)
// USER END

/*************************** End of file ****************************/


void MainGraphTask(void)
{
         if (GUI_ALLOC_GetNumFreeBytes() < RECOMMENDED_MEMORY) {
    GUI_ErrorOut("Not enough memory available.");
    return;
  }
        hWin=CreateGraphWindow();
        while(1)
        {
                memnum=GUI_ALLOC_GetNumFreeBytes();
    GRAPH_DATA_YT_AddValue(ahData,memnum/192);
                GUI_Delay(100);

        }
}







回复

使用道具 举报

1万

主题

7万

回帖

11万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
117635
QQ
发表于 2017-12-24 12:01:12 | 显示全部楼层
你的使用有误,以MainGraphTask();函数为例,这个里面仅仅需要你调用下函数CreateGraphWindow就好了。

要不你这里会造成重复的嵌套调用,也就是GUI_Delay在不断的嵌套,直到死机。

点评

ok,谢谢版主。我试试先。  发表于 2017-12-24 12:08
回复

使用道具 举报

2

主题

7

回帖

52

积分

初级会员

积分
52
 楼主| 发表于 2017-12-24 13:00:12 | 显示全部楼层
eric2013 发表于 2017-12-24 12:01
你的使用有误,以MainGraphTask();函数为例,这个里面仅仅需要你调用下函数CreateGraphWindow就好了。

...

就是这个原因,谢谢版主。
回复

使用道具 举报

1万

主题

7万

回帖

11万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
117635
QQ
发表于 2017-12-24 13:00:43 | 显示全部楼层
Audacity 发表于 2017-12-24 13:00
就是这个原因,谢谢版主。

好的,后面还有什么问题,随时发帖交流。
回复

使用道具 举报

2

主题

7

回帖

52

积分

初级会员

积分
52
 楼主| 发表于 2017-12-24 13:01:22 | 显示全部楼层
eric2013 发表于 2017-12-24 13:00
好的,后面还有什么问题,随时发帖交流。

嗯嗯,好的。谢谢
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|Archiver|手机版|硬汉嵌入式论坛

GMT+8, 2025-8-19 22:34 , Processed in 0.048687 second(s), 25 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表