菜鸟学UCGUI 请问一下 ,UCGUI的界面里要加自己的应该程序,应该怎么加。求高手回答。。
1个回答
展开全部
我给你写个简单的,你参考下。
/*
******************************************************************
** uCGUIBuilder **
** Version: 4.0.0.0 **
** 2012 / 04 **
** CpoyRight to: wyl **
** Email:ucguibuilder@163.com **
** This text was Created by uCGUIBuilder **
******************************************************************/
#include <stddef.h>
#include <stdio.h>
#include "GUI.h"
#include "WM.h"
#include "BUTTON.h"
#include "FRAMEWIN.h"
static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] =
{
{ FRAMEWIN_CreateIndirect, "Caption", 0, 0, 0, 320,240,0,0},
{ BUTTON_CreateIndirect, "BUTTON", GUI_ID_BUTTON0, 10, 10,300, 200, 0,0},
};
void InitDialog(WM_MESSAGE * pMsg)
{
WM_HWIN hWin = pMsg->hWin;
//FRAMEWIN
FRAMEWIN_AddCloseButton(hWin, FRAMEWIN_BUTTON_RIGHT, 0);
FRAMEWIN_AddMaxButton(hWin, FRAMEWIN_BUTTON_RIGHT, 1);
FRAMEWIN_AddMinButton(hWin, FRAMEWIN_BUTTON_RIGHT, 2);
}
static void doUserApp(void)
{
;;;
}
static void _cbCallback(WM_MESSAGE * pMsg)
{
int NCode, Id;
WM_HWIN hWin = pMsg->hWin;
WM_HWIN hEdit = WM_GetDialogItem(hWin, GUI_ID_EDIT0);
char str[30] = "";
switch (pMsg->MsgId)
{
case WM_INIT_DIALOG:
InitDialog(pMsg);
break;
case WM_NOTIFY_PARENT:
Id = WM_GetId(pMsg->hWinSrc);
NCode = pMsg->Data.v;
if (NCode == WM_NOTIFICATION_RELEASED)//如果按钮已被释放;如果缺省这句会执行3次(即BUTTON的3个通知代码)
{
switch (Id)
{
case GUI_ID_BUTTON0:
{
doUserApp();
}
break;
}
}
break;
default:
WM_DefaultProc(pMsg);
}
}
/*GUI初始化*/
void MainTask(void)
{
GUI_Init();
WM_SetDesktopColor(GUI_WHITE); /* Automacally update desktop window */
WM_SetCreateFlags(WM_CF_MEMDEV); /* Use memory devices on all windows to avoid flicker */
while (1)
{
GUI_ExecDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), &_cbCallback, 0, 0, 0);
}
}
更多追问追答
追问
doUserApp();就是应用程序吧 ,这样做的话 我试过了好像不行的呀,,
追答
不可能不行的,你自己看看是不死你那个应用程序有问题。单独跑你的应用程序试试。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询