完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我在一本书上看到一个例程,代码如下:
#include "GUIDEMO.h" #include #include "stdio.h" #include "EDIT.h" #include #include "DIALOG.h" #include "WM.h" #include "BUTTON.h" #include "FRAMEWIN.h" #include "GUI.h" #include "TEXT.h" static int Count; static const GUI_WIDGET_CREATE_INFO _aDialogCreate[]={ {FRAMEWIN_CreateIndirect,"ARMfly",0,0,0,800,480,FRAMEWIN_CF_MOVEABLE,0}, {BUTTON_CreateIndirect,"BUTTON0",GUI_ID_BUTTON0,82,122,162,37,0,0}, {BUTTON_CreateIndirect,"BUTTON1",GUI_ID_BUTTON1,82,62,162,37,0,0}, {TEXT_CreateIndirect,"0000",GUI_ID_TEXT0,10,10,50,48,0,0} }; void PaintDialog(WM_MESSAGE *pMsg) { WM_HWIN hWin=pMsg->hWin; } void InitDialog(WM_MESSAGE *pMsg) { WM_HWIN hWin=pMsg->hWin; FRAMEWIN_SetFont(hWin,&GUI_Font24B_ASCII); FRAMEWIN_SetTextAlign(hWin,GUI_TA_VCENTER|GUI_TA_CENTER); FRAMEWIN_AddCloseButton(hWin,FRAMEWIN_BUTTON_RIGHT,0); FRAMEWIN_AddMaxButton(hWin,FRAMEWIN_BUTTON_RIGHT,1); FRAMEWIN_AddMinButton(hWin,FRAMEWIN_BUTTON_RIGHT,2); FRAMEWIN_SetTitleHeight(hWin,30); TEXT_SetFont(WM_GetDialogItem(hWin,GUI_ID_TEXT0),&GUI_FontD36x48); } static void _cbCallback(WM_MESSAGE *pMsg) { int NCode,Id; char buf[10]; WM_HWIN hWin=pMsg->hWin; switch(pMsg->MsgId) { case WM_TIMER: Count++; sprintf(buf,"%04d",Count); TEXT_SetText(WM_GetDialogItem(hWin,GUI_ID_TEXT0),(const char *)buf); WM_RestartTimer(pMsg->Data.v,100); break; case WM_PAINT: PaintDialog(pMsg); case WM_INIT_DIALOG: InitDialog(pMsg); break; case WM_KEY: switch(((WM_KEY_INFO *)(pMsg->Data.p))->Key) { case GUI_KEY_ESCAPE: GUI_EndDialog(hWin,1); break; case GUI_KEY_ENTER: GUI_EndDialog(hWin,0); break; } break; case WM_NOTIFY_PARENT: Id=WM_GetId(pMsg->hWinSrc); NCode=pMsg->Data.v; switch(Id) { case GUI_ID_OK: if(NCode==WM_NOTIFICATION_RELEASED) GUI_EndDialog(hWin,0); break; case GUI_ID_CANCEL: if(NCode==WM_NOTIFICATION_RELEASED) GUI_EndDialog(hWin,0); break; case GUI_ID_BUTTON0: switch(NCode) { case WM_NOTIFICATION_CLICKED: break; case WM_NOTIFICATION_RELEASED: break; case WM_NOTIFICATION_MOVED_OUT: break; } break; case GUI_ID_BUTTON1: switch(NCode) { case WM_NOTIFICATION_CLICKED: break; case WM_NOTIFICATION_RELEASED: break; case WM_NOTIFICATION_MOVED_OUT: break; } break; } break; default: WM_DefaultProc(pMsg); } } void MainTask(void) { WM_HWIN hDlg; WM_HTIMER hTimer; Count=0; WM_SetCreateFlags(WM_CF_MEMDEV); GUI_Init(); WM_SetDesktopColor(GUI_BLUE); FRAMEWIN_SetDefaultSkin(FRAMEWIN_SKIN_FLEX); BUTTON_SetDefaultSkin(BUTTON_SKIN_FLEX); hDlg=GUI_CreateDialogBox(_aDialogCreate,GUI_COUNTOF(_aDialogCreate),&_cbCallback,0,0,0); //GUI_ExecDialogBox(_aDialogCreate,GUI_COUNTOF(_aDialogCreate),&_cbCallback,0,0,0); //hTimer=WM_CreateTimer(WM_GetClientWindow(hDlg),0,100,0); while(1) { GUI_Delay(100); } } /*************************** End of file ****************************/ 可是模拟器仿真出错,图片如下: 请问大神,怎么解决?谢谢! |
|
相关推荐
2个回答
|
|
参数设置错识
|
|
|
|
谢谢,少了一个break
|
|
|
|
只有小组成员才能发言,加入小组>>
710 浏览 0 评论
1120 浏览 1 评论
2497 浏览 5 评论
2836 浏览 9 评论
移植了freeRTOS到STMf103之后显示没有定义的原因?
2677 浏览 6 评论
使用eim外接fpga可是端口一点反应都没有有没有大哥指点一下啊
662浏览 9评论
673浏览 7评论
请教大神怎样去解决iMX6Q在linux3.0.35内核上做AP失败的问题呢
791浏览 6评论
638浏览 5评论
681浏览 5评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-27 13:07 , Processed in 1.287318 second(s), Total 83, Slave 63 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号