硬汉嵌入式论坛

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

[emWin] 关于给Framewin设置回调函数后无法在WM_INITDIALOG里初始化Framewin的问题

[复制链接]

13

主题

48

回帖

87

积分

初级会员

积分
87
发表于 2018-3-27 11:35:33 | 显示全部楼层 |阅读模式
如题,给Framewin设置回调函数后(针对GUI_ID_CLOSE的功能函数),无法在主调函数里初始化Framewin的问题,字体跟Framewin的框架皮肤回调函数一律不起作用了,这是为什么呢?
回复

使用道具 举报

1万

主题

7万

回帖

11万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
115765
QQ
发表于 2018-3-27 11:56:29 | 显示全部楼层
WM_INITDIALOG是给对话框用的。
回复

使用道具 举报

13

主题

48

回帖

87

积分

初级会员

积分
87
 楼主| 发表于 2018-3-27 12:03:29 | 显示全部楼层
eric2013 发表于 2018-3-27 11:56
WM_INITDIALOG是给对话框用的。

但是没有设置回调函数的时候在WM_INITDIALOG消息里初始化Framewin的字体以及其他的设置都是可以的啊。
按照你的说法,Framewin的初始化要在哪里进行呢?
回复

使用道具 举报

1万

主题

7万

回帖

11万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
115765
QQ
发表于 2018-3-27 12:05:41 | 显示全部楼层
黑眼圈红了 发表于 2018-3-27 12:03
但是没有设置回调函数的时候在WM_INITDIALOG消息里初始化Framewin的字体以及其他的设置都是可以的啊。
...

WM_CREATE试试。
回复

使用道具 举报

13

主题

48

回帖

87

积分

初级会员

积分
87
 楼主| 发表于 2018-3-27 13:56:59 | 显示全部楼层

不行,我是从资源表创建的该对话框,无论在对话框的WM_CREATE里进行Framewin的初始化还是在Framewin的回调函数里用WM_CREATE里处理初始化都是不行的
回复

使用道具 举报

1万

主题

7万

回帖

11万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
115765
QQ
发表于 2018-3-27 13:58:58 | 显示全部楼层
黑眼圈红了 发表于 2018-3-27 13:56
不行,我是从资源表创建的该对话框,无论在对话框的WM_CREATE里进行Framewin的初始化还是在Framewin的回 ...

方便的话,发个能在模拟器上跑的测试程序,我走一个。
回复

使用道具 举报

13

主题

48

回帖

87

积分

初级会员

积分
87
 楼主| 发表于 2018-3-27 14:15:35 | 显示全部楼层
本帖最后由 黑眼圈红了 于 2018-3-27 14:17 编辑

...
回复

使用道具 举报

13

主题

48

回帖

87

积分

初级会员

积分
87
 楼主| 发表于 2018-3-27 14:18:03 | 显示全部楼层
eric2013 发表于 2018-3-27 13:58
方便的话,发个能在模拟器上跑的测试程序,我走一个。
  1. /*********************************************************************
  2. *                                                                    *
  3. *                SEGGER Microcontroller GmbH & Co. KG                *
  4. *        Solutions for real time microcontroller applications        *
  5. *                                                                    *
  6. **********************************************************************
  7. *                                                                    *
  8. * C-file generated by:                                               *
  9. *                                                                    *
  10. *        GUI_Builder for emWin version 5.40                          *
  11. *        Compiled Jun 22 2017, 10:13:26                              *
  12. *        (c) 2017 Segger Microcontroller GmbH & Co. KG               *
  13. *                                                                    *
  14. **********************************************************************
  15. *                                                                    *
  16. *        Internet: www.segger.com  Support: support@segger.com       *
  17. *                                                                    *
  18. **********************************************************************
  19. */

  20. // USER START (Optionally insert additional includes)
  21. // USER END

  22. #include "DIALOG.h"

  23. /*********************************************************************
  24. *
  25. *       Defines
  26. *
  27. **********************************************************************
  28. */
  29. #define ID_FRAMEWIN_0 (GUI_ID_USER + 0x00)
  30. #define ID_BUTTON_0 (GUI_ID_USER + 0x01)
  31. #define ID_BUTTON_1 (GUI_ID_USER + 0x02)
  32. #define ID_BUTTON_2 (GUI_ID_USER + 0x03)
  33. #define ID_BUTTON_3 (GUI_ID_USER + 0x04)


  34. // USER START (Optionally insert additional defines)
  35. // USER END

  36. /*********************************************************************
  37. *
  38. *       Static data
  39. *
  40. **********************************************************************
  41. */

  42. // USER START (Optionally insert additional static data)
  43. // USER END

  44. /*********************************************************************
  45. *
  46. *       _aDialogCreate
  47. */
  48. static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
  49.   { FRAMEWIN_CreateIndirect, "Framewin", ID_FRAMEWIN_0, 79, 37, 800, 480, 0, 0x64, 0 },
  50.   { BUTTON_CreateIndirect, "Button", ID_BUTTON_0, 98, 82, 80, 20, 0, 0x0, 0 },
  51.   { BUTTON_CreateIndirect, "Button", ID_BUTTON_1, 249, 87, 80, 20, 0, 0x0, 0 },
  52.   { BUTTON_CreateIndirect, "Button", ID_BUTTON_2, 98, 186, 80, 20, 0, 0x0, 0 },
  53.   { BUTTON_CreateIndirect, "Button", ID_BUTTON_3, 256, 186, 80, 20, 0, 0x0, 0 },
  54.   // USER START (Optionally insert additional widgets)
  55.   // USER END
  56. };



  57. static void _Framewin(WM_MESSAGE * pMsg)
  58. {
  59.         WM_HWIN hWin = pMsg->hWin;
  60.         switch (pMsg->MsgId) {       
  61.                 case WM_NOTIFY_PARENT:
  62.                         if (pMsg->Data.v == WM_NOTIFICATION_RELEASED) {
  63.                                 int Id = WM_GetId(pMsg->hWinSrc);
  64.                                 if (Id == GUI_ID_CLOSE) {
  65.                                         GUI_EndDialog(hWin,0);                                       
  66.                                         hWin = 0;
  67.        
  68.                                 }
  69.                         }
  70.                         break;
  71.         }
  72. }

  73. /*********************************************************************
  74. *
  75. *       Static code
  76. *
  77. **********************************************************************
  78. */

  79. // USER START (Optionally insert additional static code)
  80. // USER END

  81. /*********************************************************************
  82. *
  83. *       _cbDialog
  84. */
  85. static void _cbDialog(WM_MESSAGE * pMsg) {
  86.   WM_HWIN hItem;
  87.   int     NCode;
  88.   int     Id;
  89.   WM_HWIN hWin = pMsg->hWin;
  90.   WM_SetCallback(WM_GetParent(hWin),_Framewin);
  91.   // USER START (Optionally insert additional variables)
  92.   // USER END

  93.   switch (pMsg->MsgId) {
  94.   case WM_INIT_DIALOG:
  95.     //
  96.     // Initialization of 'Framewin'
  97.     //
  98.     hItem = pMsg->hWin;
  99.     FRAMEWIN_SetText(hItem, "SET");
  100.     FRAMEWIN_SetTitleHeight(hItem, 35);
  101.     FRAMEWIN_SetFont(hItem, GUI_FONT_20B_ASCII);
  102.     FRAMEWIN_AddCloseButton(hWin, FRAMEWIN_BUTTON_RIGHT, 0);

  103.     // USER START (Optionally insert additional code for further widget initialization)
  104.     // USER END
  105.     break;
  106.   case WM_NOTIFY_PARENT:
  107.     Id    = WM_GetId(pMsg->hWinSrc);
  108.     NCode = pMsg->Data.v;
  109.     switch(Id) {
  110.     case ID_BUTTON_0: // Notifications sent by 'Button'
  111.       switch(NCode) {
  112.       case WM_NOTIFICATION_CLICKED:
  113.         // USER START (Optionally insert code for reacting on notification message)
  114.         // USER END
  115.         break;
  116.       case WM_NOTIFICATION_RELEASED:
  117.         // USER START (Optionally insert code for reacting on notification message)
  118.         // USER END
  119.         break;
  120.       // USER START (Optionally insert additional code for further notification handling)
  121.       // USER END
  122.       }
  123.       break;
  124.     case ID_BUTTON_1: // Notifications sent by 'Button'
  125.       switch(NCode) {
  126.       case WM_NOTIFICATION_CLICKED:
  127.         // USER START (Optionally insert code for reacting on notification message)
  128.         // USER END
  129.         break;
  130.       case WM_NOTIFICATION_RELEASED:
  131.         // USER START (Optionally insert code for reacting on notification message)
  132.         // USER END
  133.         break;
  134.       // USER START (Optionally insert additional code for further notification handling)
  135.       // USER END
  136.       }
  137.       break;
  138.     case ID_BUTTON_2: // Notifications sent by 'Button'
  139.       switch(NCode) {
  140.       case WM_NOTIFICATION_CLICKED:
  141.         // USER START (Optionally insert code for reacting on notification message)
  142.         // USER END
  143.         break;
  144.       case WM_NOTIFICATION_RELEASED:
  145.         // USER START (Optionally insert code for reacting on notification message)
  146.         // USER END
  147.         break;
  148.       // USER START (Optionally insert additional code for further notification handling)
  149.       // USER END
  150.       }
  151.       break;
  152.     case ID_BUTTON_3: // Notifications sent by 'Button'
  153.       switch(NCode) {
  154.       case WM_NOTIFICATION_CLICKED:
  155.         // USER START (Optionally insert code for reacting on notification message)
  156.         // USER END
  157.         break;
  158.       case WM_NOTIFICATION_RELEASED:
  159.         // USER START (Optionally insert code for reacting on notification message)
  160.         // USER END
  161.         break;
  162.       // USER START (Optionally insert additional code for further notification handling)
  163.       // USER END
  164.       }
  165.       break;
  166.     // USER START (Optionally insert additional code for further Ids)
  167.     // USER END
  168.     }
  169.     break;
  170.   // USER START (Optionally insert additional message handling)
  171.   // USER END
  172.   default:
  173.     WM_DefaultProc(pMsg);
  174.     break;
  175.   }
  176. }

  177. /*********************************************************************
  178. *
  179. *       Public code
  180. *
  181. **********************************************************************
  182. */
  183. /*********************************************************************
  184. *
  185. *       CreateFramewin
  186. */
  187. WM_HWIN CreateFramewin(void);
  188. WM_HWIN CreateFramewin(void) {
  189.   WM_HWIN hWin;

  190.   hWin = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, WM_HBKWIN, 0, 0);
  191.   return hWin;
  192. }

  193. // USER START (Optionally insert additional public code)
  194. // USER END

  195. /*************************** End of file ****************************/
复制代码
回复

使用道具 举报

1万

主题

7万

回帖

11万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
115765
QQ
发表于 2018-3-27 14:39:24 | 显示全部楼层

这种的,肯定没问题的,在我们V6板子帮你测试的效果

QQ截图20180327143729.png
回复

使用道具 举报

13

主题

48

回帖

87

积分

初级会员

积分
87
 楼主| 发表于 2018-3-27 15:03:01 | 显示全部楼层
eric2013 发表于 2018-3-27 14:39
这种的,肯定没问题的,在我们V6板子帮你测试的效果

那麻烦你帮我在WM_INITDIALOG里加一句FRAMEWIN_SetSkin(hWin,  _DrawSkinFlex_FRAME );

_DrawSkinFlex_FRAME 函数在贴出来的代码里,麻烦帮看下皮肤函数有没有作用
  1. static int _DrawSkinFlex_FRAME(const WIDGET_ITEM_DRAW_INFO * pDrawItemInfo)
  2. {
  3.         GUI_SetColor(0XFFB3B3);
  4.         switch (pDrawItemInfo->Cmd)
  5.         {
  6.                 case WIDGET_ITEM_DRAW_BACKGROUND:
  7.                         break;
  8.                
  9.                 case WIDGET_ITEM_DRAW_FRAME:
  10.                   GUI_FillRoundedRect(pDrawItemInfo->x0, pDrawItemInfo->y0, pDrawItemInfo->x1-1,
  11.                                         pDrawItemInfo->y1-1, 0);
  12.                         break;
  13.                
  14.                 default:
  15.                         return FRAMEWIN_DrawSkinFlex(pDrawItemInfo);
  16.         }
  17.         return 0;

  18. }
复制代码
回复

使用道具 举报

13

主题

48

回帖

87

积分

初级会员

积分
87
 楼主| 发表于 2018-3-27 16:39:22 | 显示全部楼层
eric2013 发表于 2018-3-27 14:39
这种的,肯定没问题的,在我们V6板子帮你测试的效果

我在模拟器上测试单独对话框的时候是可以的,但是加上其他的就不行了(主界面有一个按钮调出该对话框,关闭按钮关闭该对话框,结果关于Framewin的设置就失效了),我把代码贴给你运行下看看
  1. /*********************************************************************
  2. *                                                                    *
  3. *                SEGGER Microcontroller GmbH & Co. KG                *
  4. *        Solutions for real time microcontroller applications        *
  5. *                                                                    *
  6. **********************************************************************
  7. *                                                                    *
  8. * C-file generated by:                                               *
  9. *                                                                    *
  10. *        GUI_Builder for emWin version 5.40                          *
  11. *        Compiled Jun 22 2017, 10:13:26                              *
  12. *        (c) 2017 Segger Microcontroller GmbH & Co. KG               *
  13. *                                                                    *
  14. **********************************************************************
  15. *                                                                    *
  16. *        Internet: www.segger.com  Support: support@segger.com       *
  17. *                                                                    *
  18. **********************************************************************
  19. */

  20. // USER START (Optionally insert additional includes)
  21. // USER END

  22. #include "DIALOG.h"

  23. /*********************************************************************
  24. *
  25. *       Defines
  26. *
  27. **********************************************************************
  28. */
  29. #define ID_FRAMEWIN_0  (GUI_ID_USER + 0x00)
  30. #define ID_BUTTON_0  (GUI_ID_USER + 0x01)
  31. #define ID_BUTTON_1  (GUI_ID_USER + 0x02)
  32. #define ID_BUTTON_2  (GUI_ID_USER + 0x03)
  33. #define ID_BUTTON_3  (GUI_ID_USER + 0x04)
  34. #define ID_BUTTON_4  (GUI_ID_USER + 0x05)

  35. // USER START (Optionally insert additional defines)
  36. // USER END

  37. /*********************************************************************
  38. *
  39. *       Static data
  40. *
  41. **********************************************************************
  42. */

  43. // USER START (Optionally insert additional static data)
  44. // USER END

  45. /*********************************************************************
  46. *
  47. *       _aDialogCreate
  48. */
  49. static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
  50.   { FRAMEWIN_CreateIndirect, "Framewin", ID_FRAMEWIN_0, 8, 8, 800, 480, 0, 0x64, 0 },
  51.   { BUTTON_CreateIndirect, "Button", ID_BUTTON_0, 35, 49, 80, 20, 0, 0x0, 0 },
  52.   { BUTTON_CreateIndirect, "Button", ID_BUTTON_1, 157, 53, 80, 20, 0, 0x0, 0 },
  53.   { BUTTON_CreateIndirect, "Button", ID_BUTTON_2, 40, 113, 80, 20, 0, 0x0, 0 },
  54.   { BUTTON_CreateIndirect, "Button", ID_BUTTON_3, 162, 115, 80, 20, 0, 0x0, 0 },
  55.   // USER START (Optionally insert additional widgets)
  56.   // USER END
  57. };

  58. /*********************************************************************
  59. *
  60. *
  61. *********************************************************************/
  62. static int _DrawSkinFlex_FRAME(const WIDGET_ITEM_DRAW_INFO * pDrawItemInfo)
  63. {
  64.         GUI_SetColor(0XFFB3B3);
  65.         switch (pDrawItemInfo->Cmd)
  66.         {
  67.                 case WIDGET_ITEM_DRAW_BACKGROUND:
  68.                         break;
  69.                
  70.                 case WIDGET_ITEM_DRAW_FRAME:
  71.                   GUI_FillRoundedRect(pDrawItemInfo->x0, pDrawItemInfo->y0, pDrawItemInfo->x1-1,
  72.                                         pDrawItemInfo->y1-1, 0);
  73.                         break;
  74.                
  75.                 default:
  76.                         return FRAMEWIN_DrawSkinFlex(pDrawItemInfo);
  77.         }
  78.         return 0;

  79. }

  80. /*********************************************************************
  81. *
  82. *
  83. *********************************************************************/
  84. static void _Framewin(WM_MESSAGE * pMsg)
  85. {
  86.         WM_HWIN hWin = pMsg->hWin;
  87.         switch (pMsg->MsgId) {        
  88.                 case WM_NOTIFY_PARENT:
  89.                         if (pMsg->Data.v == WM_NOTIFICATION_RELEASED) {
  90.                                 int Id = WM_GetId(pMsg->hWinSrc);
  91.                                 if (Id == GUI_ID_CLOSE) {
  92.                                         GUI_EndDialog(hWin,0);                                       
  93.                                         hWin = 0;
  94.         
  95.                                 }
  96.                         }
  97.                         break;
  98.         }
  99. }

  100. /*********************************************************************
  101. *
  102. *       Static code
  103. *
  104. **********************************************************************
  105. */

  106. // USER START (Optionally insert additional static code)
  107. // USER END

  108. /*********************************************************************
  109. *
  110. *       _cbDialog
  111. */
  112. static void _cbDialog(WM_MESSAGE * pMsg) {
  113.   WM_HWIN hItem;
  114.   WM_HWIN hWin = pMsg->hWin;
  115.   int     NCode;
  116.   int     Id;
  117.   WM_SetCallback(WM_GetParent(hWin),_Framewin);
  118.   // USER START (Optionally insert additional variables)
  119.   // USER END

  120.   switch (pMsg->MsgId) {
  121.   case WM_INIT_DIALOG:
  122.     //
  123.     // Initialization of 'Framewin'
  124.     //
  125.     hItem = pMsg->hWin;
  126.     FRAMEWIN_SetText(hItem, "set");
  127.     FRAMEWIN_SetFont(hItem, GUI_FONT_20B_ASCII);
  128.     FRAMEWIN_AddCloseButton(hWin, FRAMEWIN_BUTTON_RIGHT, 0);
  129.         FRAMEWIN_SetSkin(hWin,  _DrawSkinFlex_FRAME );
  130.     // USER START (Optionally insert additional code for further widget initialization)
  131.     // USER END
  132.     break;
  133.   case WM_NOTIFY_PARENT:
  134.     Id    = WM_GetId(pMsg->hWinSrc);
  135.     NCode = pMsg->Data.v;
  136.     switch(Id) {
  137.     case ID_BUTTON_0: // Notifications sent by 'Button'
  138.       switch(NCode) {
  139.       case WM_NOTIFICATION_CLICKED:
  140.         // USER START (Optionally insert code for reacting on notification message)
  141.         // USER END
  142.         break;
  143.       case WM_NOTIFICATION_RELEASED:
  144.         // USER START (Optionally insert code for reacting on notification message)
  145.         // USER END
  146.         break;
  147.       // USER START (Optionally insert additional code for further notification handling)
  148.       // USER END
  149.       }
  150.       break;
  151.     case ID_BUTTON_1: // Notifications sent by 'Button'
  152.       switch(NCode) {
  153.       case WM_NOTIFICATION_CLICKED:
  154.         // USER START (Optionally insert code for reacting on notification message)
  155.         // USER END
  156.         break;
  157.       case WM_NOTIFICATION_RELEASED:
  158.         // USER START (Optionally insert code for reacting on notification message)
  159.         // USER END
  160.         break;
  161.       // USER START (Optionally insert additional code for further notification handling)
  162.       // USER END
  163.       }
  164.       break;
  165.     case ID_BUTTON_2: // Notifications sent by 'Button'
  166.       switch(NCode) {
  167.       case WM_NOTIFICATION_CLICKED:
  168.         // USER START (Optionally insert code for reacting on notification message)
  169.         // USER END
  170.         break;
  171.       case WM_NOTIFICATION_RELEASED:
  172.         // USER START (Optionally insert code for reacting on notification message)
  173.         // USER END
  174.         break;
  175.       // USER START (Optionally insert additional code for further notification handling)
  176.       // USER END
  177.       }
  178.       break;
  179.     case ID_BUTTON_3: // Notifications sent by 'Button'
  180.       switch(NCode) {
  181.       case WM_NOTIFICATION_CLICKED:
  182.         // USER START (Optionally insert code for reacting on notification message)
  183.         // USER END
  184.         break;
  185.       case WM_NOTIFICATION_RELEASED:
  186.         // USER START (Optionally insert code for reacting on notification message)
  187.         // USER END
  188.         break;
  189.       // USER START (Optionally insert additional code for further notification handling)
  190.       // USER END
  191.       }
  192.       break;
  193.     // USER START (Optionally insert additional code for further Ids)
  194.     // USER END
  195.     }
  196.     break;
  197.   // USER START (Optionally insert additional message handling)
  198.   // USER END
  199.   default:
  200.     WM_DefaultProc(pMsg);
  201.     break;
  202.   }
  203. }

  204. /*********************************************************************
  205. *
  206. *       Public code
  207. *
  208. **********************************************************************
  209. */
  210. /*********************************************************************
  211. *
  212. *       CreateFramewin
  213. */

  214. static void _cbMain(WM_MESSAGE * pMsg) {

  215.   WM_HWIN hButton;
  216.   int NCode, Id;
  217.   WM_HWIN hWin = pMsg->hWin;
  218.   switch(pMsg->MsgId)
  219.   {
  220.                 case WM_PAINT:     /*立即绘制或重绘一个窗口*/
  221.                 {                       
  222.                     GUI_SetBkColor(0XFFFFFF);
  223.                     GUI_Clear();
  224.                 }
  225.                 break;

  226.                 case WM_CREATE:  //ID_BUTTON_4
  227.                         {
  228.                 hButton = BUTTON_CreateEx(80, 30, 120, 145,
  229.                             hWin, WM_CF_SHOW, 0, ID_BUTTON_4);  //ID_BUTTON_MAIN_SET
  230.                              BUTTON_SetFont(hButton, GUI_FONT_20B_ASCII);
  231.                                 BUTTON_SetText(hButton, "Osci");
  232.                         }
  233.                         break;

  234.         case WM_NOTIFY_PARENT:
  235.             Id    = WM_GetId(pMsg->hWinSrc);
  236.             NCode = pMsg->Data.v;
  237.                         switch(Id)
  238.                         {
  239.                         case ID_BUTTON_4:
  240.                                 {
  241.                                         WM_HWIN hSetHwin;
  242.                     hSetHwin = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, WM_HBKWIN, 0, 0);
  243.                                         GUI_ExecCreatedDialog(hSetHwin);

  244.                                 }
  245.                                 break;
  246.                         }

  247.                         break;


  248.   }


  249. }

  250. // USER START (Optionally insert additional public code)
  251. // USER END
  252. void MainTask(void)
  253. {
  254.   WM_HWIN hWin;
  255.   GUI_Init();
  256.   hWin = WM_CreateWindow(0,0,800,480, WM_CF_SHOW,_cbMain,0);
  257.   while(1)
  258.   {
  259.           GUI_Delay(1000);
  260.   }

  261. }


  262. /*************************** End of file ****************************/
复制代码
回复

使用道具 举报

11

主题

130

回帖

168

积分

初级会员

积分
168
发表于 2018-3-27 20:36:58 | 显示全部楼层
黑眼圈红了 发表于 2018-3-27 16:39
我在模拟器上测试单独对话框的时候是可以的,但是加上其他的就不行了(主界面有一个按钮调出该对话框, ...

WM_SetCallback(WM_GetParent(hWin),_Framewin);你把回掉函数注册给framewin的客户窗口了。按你的意思捕获关闭按钮应该给framewin的主窗口注册回调函数。framewin控件结构在说明手册里有。
回复

使用道具 举报

1万

主题

7万

回帖

11万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
115765
QQ
发表于 2018-3-28 01:27:43 | 显示全部楼层
黑眼圈红了 发表于 2018-3-27 16:39
我在模拟器上测试单独对话框的时候是可以的,但是加上其他的就不行了(主界面有一个按钮调出该对话框, ...

你写的程序有错误。修改两个地方
1.
  1. static void _Framewin(WM_MESSAGE * pMsg)
  2. {
  3.         WM_HWIN hWin = pMsg->hWin;
  4.         switch (pMsg->MsgId)
  5.         {   
  6.                 case WM_NOTIFY_PARENT:
  7.                         if (pMsg->Data.v == WM_NOTIFICATION_RELEASED) {
  8.                                         int Id = WM_GetId(pMsg->hWinSrc);
  9.                                         if (Id == GUI_ID_CLOSE) {
  10.                                                         GUI_EndDialog(hWin,0);                                       
  11.                                                         hWin = 0;

  12.                                         }
  13.                         }
  14.                         break;
  15.                                
  16.                 default:
  17.                         FRAMEWIN_Callback(pMsg);
  18.                         break;
  19.         }
  20. }
复制代码


2.  函数WM_SetCallback(hWin,_Framewin)应该放在消息case WM_INIT_DIALOG:里面,不用一直调用。
回复

使用道具 举报

13

主题

48

回帖

87

积分

初级会员

积分
87
 楼主| 发表于 2018-3-28 08:58:21 | 显示全部楼层
有梦为马 发表于 2018-3-27 20:36
WM_SetCallback(WM_GetParent(hWin),_Framewin);你把回掉函数注册给framewin的客户窗口了。按你的意思捕 ...

我是给客户端窗口的父窗口的哦,也就是Framewin的框架窗口
回复

使用道具 举报

13

主题

48

回帖

87

积分

初级会员

积分
87
 楼主| 发表于 2018-3-28 08:58:56 | 显示全部楼层
eric2013 发表于 2018-3-28 01:27
你写的程序有错误。修改两个地方
1.

好的。我试试
回复

使用道具 举报

13

主题

48

回帖

87

积分

初级会员

积分
87
 楼主| 发表于 2018-3-28 09:03:18 | 显示全部楼层
eric2013 发表于 2018-3-28 01:27
你写的程序有错误。修改两个地方
1.

不行诶,我把WM_SetCallback函数放在WM_INIT_DIALOG消息里面处理的话连对话框都进不去了
回复

使用道具 举报

13

主题

48

回帖

87

积分

初级会员

积分
87
 楼主| 发表于 2018-3-28 09:09:32 | 显示全部楼层
eric2013 发表于 2018-3-28 01:27
你写的程序有错误。修改两个地方
1.

我试了下把WM_SetCallback放进WM_PAINT消息里处理,程序可正常运行,但是关闭对话框的时候模拟器弹出该消息,需从任务管理器里结束该任务才能关掉模拟器,这是为什么呢?
QQ图片20180328090413.png
回复

使用道具 举报

1万

主题

7万

回帖

11万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
115765
QQ
发表于 2018-3-28 11:43:38 | 显示全部楼层
黑眼圈红了 发表于 2018-3-28 09:09
我试了下把WM_SetCallback放进WM_PAINT消息里处理,程序可正常运行,但是关闭对话框的时候模拟器弹出该消 ...

你的程序设计有问题,出现了多次嵌套调用,直至嵌套层数被用完就会出现这个错误。
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-5-16 11:58 , Processed in 0.321461 second(s), 27 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2023, Tencent Cloud.

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