minigui 时钟程序

来源:互联网 发布:淘宝延长收钱怎么取消 编辑:程序博客网 时间:2024/05/12 19:16
照《ARM嵌入式MiniGUI初步与应用开发范例》改写的时钟程序#include <minigui/common.h>#include <minigui/minigui.h>#include <minigui/gdi.h>#include <minigui/window.h>#include <minigui/control.h>#include <time.h>#define MWINDOW_LX 0  //window left border x#define MWINDOW_TY 0  //window topp border y#define MWINDOW_RX 320 //right x#define MWINDOW_BY 240 //low y#define TIMER0  0#define IDC_RTC1 1000#define CTRL_RTC "rtcdisp"#define RTC_SETTIME 800#define RTC_GETTIME 801#define RTC_SETHOUR 802#define RTC_SETMIN 803#define RTC_SETSEC 804#define IDC_SET_STATIC0 2000#define IDC_SET_STATIC1 2001#define IDC_SET_STATIC2 2002#define IDC_SET_STATIC3 2003#define IDC_SET_EDIT1 2011#define IDC_SET_EDIT2 2012#define IDC_SET_EDIT3 2013#define IDM_CLOCK 3000#define IDM_SETCLOCK 3001#define IDM_SYSCLOCK 3002#define IDM_SETSYSCLOCK 3003#define IDM_SYSTEM 3010#define IDM_EXIT 3011#define IDM_ABOUT 3012HWND hMainWnd;HWND s_myhwnd;typedef struct time{ int hour; int min; int sec;}Time;#define TDRAW_BAS_X 2#define TDRAW_BAS_Y 23static void DispTimeSub(HDC hdc, int x, int y, int r){//draw point(x,y) and four point side of it x=TDRAW_BAS_X+r+x; y=TDRAW_BAS_Y+r+y; SetPixel(hdc,x,y,PIXEL_magenta); SetPixel(hdc,x+1,y,PIXEL_magenta); SetPixel(hdc,x-1,y,PIXEL_magenta); SetPixel(hdc,x,y+1,PIXEL_magenta); SetPixel(hdc,x,y-1,PIXEL_magenta);}static void DispTimeSubHL(HDC hdc, int x, int y, int r){//draw point(x,y)'s top and under line x=TDRAW_BAS_X+r+x; y=TDRAW_BAS_Y+r+y; SetPenColor(hdc,PIXEL_magenta); MoveTo(hdc,x,y-1); LineTo(hdc,x-3,y-1); MoveTo(hdc,x,y+1); LineTo(hdc,x-3,y+1);}static void DispTimeSubHR(HDC hdc,int x, int y, int r){//draw point(x,y)'s top and under line x=TDRAW_BAS_X+r+x; y=TDRAW_BAS_Y+r+y; SetPenColor(hdc,PIXEL_magenta); MoveTo(hdc,x,y-1); LineTo(hdc,x+3,y-1); MoveTo(hdc,x,y+1); LineTo(hdc,x+3,y+1);}static void DispTimeSubLT(HDC hdc,int x, int y, int r){//draw point(x,y)'s lift and right line x=TDRAW_BAS_X+r+x; y=TDRAW_BAS_Y+r+y; SetPenColor(hdc,PIXEL_magenta); MoveTo(hdc,x-1,y); LineTo(hdc,x-1,y-4); MoveTo(hdc,x+1,y); LineTo(hdc,x+1,y-4);}static void DispTimeSubLB(HDC hdc,int x, int y, int r){//draw point(x,y)'s lift and right line x=TDRAW_BAS_X+r+x; y=TDRAW_BAS_Y+r+y; SetPenColor(hdc,PIXEL_magenta); MoveTo(hdc,x-1,y); LineTo(hdc,x-1,y+4); MoveTo(hdc,x+1,y); LineTo(hdc,x+1,y+4);}//round's  radius is 40 ,twelve point of it's 30 degreestatic const POINT PD_R40D30[]={ {40,0},{34,19},{20,34},{0,39},     {-19,34},{-34,20},{-40,0},{-34,-20},     {-19,-34},{0,-39},{20,-34},{34,-19}    };static void DrawTimeFrame(HDC hdc,int hight){ int i; SetPenColor(hdc,PIXEL_blue); MoveTo(hdc,0,hight); LineTo(hdc,90,hight); MoveTo(hdc,0,hight+2); LineTo(hdc,90,hight+2);//note:  the array of PD_R40D30 begin at right place,that the place of 3 hour. for(i=0; i<12; i++) {  if((i%3) == 0)  {   if((i == 0) || (i == 6))   {    if(i == 0)               DispTimeSubHL(hdc,PD_R40D30[i].x,PD_R40D30[i].y,40);    else        DispTimeSubHR(hdc,PD_R40D30[i].x,PD_R40D30[i].y,40);   }   else   {    if(i == 3)        DispTimeSubLT(hdc,PD_R40D30[i].x,PD_R40D30[i].y,40);    else        DispTimeSubLB(hdc,PD_R40D30[i].x,PD_R40D30[i].y,40);   }  }  else  {   DispTimeSub(hdc,PD_R40D30[i].x,PD_R40D30[i].y,40);  } }}static const POINT PD_R30D6[]={{30,0},{29,3},{29,6},{28,9},{27,12},{25,14},{24,17},{22,20},{20,22},{17,24},{15,25},{12,27},{9,28},{6,29},{3,29},{0,29},{-3,29},{-6,29},{-9,28},{-12,27},{-14,25},{-17,24},{-20,22},{-22,20},{-27,17},{-25,15},{-27,12},{-28,9},{-29,6},{-29,3},{-29,0},{-29,-3},{-29,-6},{-28,-9},{-27,-12},{-25,-14},{-24,-17},{-22,-20},{-20,-22},{-17,-24},{-15,-25},{-12,-27},{-9,-28},{-6,-29},{-3,-29},{0,-29},{3,-29},{6,-29},{9,-28},{12,-27},{14,-25},{17,-24},{20,-22},{22,-20},{24,-17},{25,-15},{27,-12},{28,-9},{29,-6},{29,-3}};static const POINT PD_R20D5[]={{20,0},{19,1},{19,3},{19,5},{18,6},{18,8},{17,9},{16,11},{15,12},{14,14},{12,15},{11,16},{10,17},{8,18},{6,18},{5,19},{3,19},{1,19},{0,19},{-1,19},{-3,19},{-5,19},{-6,18},{-8,18},{-9,17},{-11,16},{-12,15},{-14,14},{-15,12},{-16,11},{-17,10},{-18,8},{-18,6},{-19,5},{-19,3},{-19,1},{-19,0},{-19,-1},{-19,-3},{-19,-5},{-18,-6},{-18,-8},{-17,-9},{-16,-11},{-15,-12},{-14,-14},{-12,-15},{-11,-16},{-10,-17},{-8,-18},{-6,-18},{-5,-19},{-3,-19},{-1,-19},{0,-19},{1,-19},{3,-19},{5,-19},{6,-18},{8,-18},{9,-17},{11,-16},{12,-15},{14,-14},{15,-12},{16,-11},{17,-10},{18,-8},{18,-6},{19,-5},{19,-3},{19,-1}};    static void DrawTime(HWND hWnd,HDC hdc,Time *rtime){ static int old_minx=0; static int old_miny=0; static int old_hourx=0; static int old_houry=0; static int old_secx=0; static int old_secy=0; int secx,secy; static int r=40; int rx,ry; int x,y; int n; int bak;//calculate clock's the centre of a circle   coordinate rx=TDRAW_BAS_X+r; ry=TDRAW_BAS_Y+r;  n=rtime->sec; n=n+45; if(n > 59)  n=n-60; secx=TDRAW_BAS_X+r+PD_R30D6[n].x; secy=TDRAW_BAS_Y+r+PD_R30D6[n].y; bak=GetWindowBkColor(hWnd); if((old_secx+old_secy) != 0) {  SetPenColor(hdc,bak);  MoveTo(hdc,rx,ry);  LineTo(hdc,old_secx,old_secy); }//show second hand SetPenColor(hdc,PIXEL_red); MoveTo(hdc,rx,ry); LineTo(hdc,secx,secy); old_secx=secx; old_secy=secy; //calculate min whether or not move//note:  the array of PD_R30D6 begin at right place,that the place of 3 hour.//rtime->min/60  is percent  the first 60 is clock divide up 60 part n=60*rtime->min/60; //see above note,when n is 0,it must add 45 from 3 hour place. n=n+45; if(n > 59)  n=n-60; x=TDRAW_BAS_X+r+PD_R30D6[n].x; y=TDRAW_BAS_Y+r+PD_R30D6[n].y;// if((x == old_minx) && (y == old_miny))//  return ;//delete old hour hand and minute hand bak=GetWindowBkColor(hWnd); if((old_minx+old_miny) != 0) {  SetPenColor(hdc,bak);  MoveTo(hdc,rx,ry);  LineTo(hdc,old_minx,old_miny); } SetPenType(hdc,PT_SOLID); SetPenWidth(hdc,2); if((old_hourx+old_houry) != 0) {  SetPenColor(hdc,bak);  LineEx(hdc,rx,ry,old_hourx,old_houry); }//show minute hand SetPenColor(hdc,PIXEL_darkgray); MoveTo(hdc,rx,ry); LineTo(hdc,x,y); old_minx=x; old_miny=y;//show hour hand//because 24 hours.but clock show 12 hours. if((rtime->hour) > 11)  bak=rtime->min+(rtime->hour-12)*60; else  bak=rtime->min+rtime->hour*60;//calculate hour*60+minute. the bak is all minute.12 hours is  60*12=720 minute.//bak/720 is percent .the 72 is clock divide up 72 part.//the same as minute disposal n=72*bak/720; n=n+54; if(n > 71)  n=n-72; x=TDRAW_BAS_X+r+PD_R20D5[n].x; y=TDRAW_BAS_Y+r+PD_R20D5[n].y; LineEx(hdc,rx,ry,x,y); old_hourx=x; old_houry=y;}DispTimeNum(HDC hdc,Time *rtime){ char disp_buf[50]; sprintf(disp_buf,"%02d:%02d:%02d",rtime->hour,rtime->min,rtime->sec); TextOut(hdc,0,0,disp_buf);}static Time s_rtime;static int RTCControlProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam){ HDC hdc;// static Time s_rtime; static PLOGFONT s_font; Time *p_btime;  switch(message) {  case MSG_CREATE:   s_font=CreateLogFont(NULL,"Courier","ISO8859-1",      FONT_WEIGHT_BOLD,      FONT_SLANT_ROMAN,      FONT_SETWIDTH_NORMAL,      FONT_SPACING_CHARCELL,      FONT_UNDERLINE_NONE,      FONT_STRUCKOUT_NONE,      16,0);   p_btime=(Time *)GetWindowAdditionalData(hWnd);   if(p_btime != NULL)   {    if((p_btime->hour) > 23)     s_rtime.hour=0;    else     s_rtime.hour=p_btime->hour;    if((p_btime->min) > 59)     s_rtime.min=0;    else     s_rtime.min=p_btime->min;    if((p_btime->sec) >59)     s_rtime.sec=0;    else     s_rtime.sec=p_btime->sec;   }   else   {    s_rtime.hour=0;    s_rtime.min=0;    s_rtime.sec=0;   }   SetTimer(hWnd,TIMER0,100);   break;  case MSG_PAINT:   hdc=BeginPaint(hWnd);   SelectFont(hdc,s_font);   DispTimeNum(hdc,&s_rtime);   DrawTimeFrame(hdc,17);   DrawTime(hdc,hdc,&s_rtime);   EndPaint(hWnd,hdc);   return 0;  case MSG_TIMER:   if(wParam == TIMER0)   {    if((++s_rtime.sec) > 59)    {     s_rtime.sec=0;     if((++s_rtime.min) > 59)     {      s_rtime.min=0;      if((++s_rtime.hour) > 23)       s_rtime.hour=0;     }    }   }   hdc=GetClientDC(hWnd);   SelectFont(hdc,s_font);   DispTimeNum(hdc,&s_rtime);   DrawTime(hWnd,hdc,&s_rtime);   ReleaseDC(hdc);   break;  case RTC_SETTIME:   p_btime=(Time *)lParam;   if(p_btime != NULL)   {    if((p_btime->hour) > 23)     s_rtime.hour=0;    else     s_rtime.hour=p_btime->hour;    if((p_btime->min) > 59)     s_rtime.min=0;    else     s_rtime.min=p_btime->min;    if((p_btime->sec) >59)     s_rtime.sec=0;    else     s_rtime.sec=p_btime->sec;    hdc=GetClientDC(hWnd);    SelectFont(hdc,s_font);    DispTimeNum(hdc,&s_rtime);    DrawTime(hWnd,hdc,&s_rtime);    ReleaseDC(hdc);   }   break;  case RTC_GETTIME:   p_btime=(Time*)lParam;   if(p_btime != NULL)   {    p_btime->hour=s_rtime.hour;    p_btime->min=s_rtime.min;    p_btime->sec=s_rtime.sec;   }   break;  case RTC_SETHOUR:   if(lParam > 23)    s_rtime.hour=0;   else    s_rtime.hour=lParam;   hdc=GetClientDC(hWnd);   SelectFont(hdc,s_font);   DispTimeNum(hdc,&s_rtime);   DrawTime(hWnd,hdc,&s_rtime);   ReleaseDC(hdc);   break;  case RTC_SETMIN:   if(lParam > 59)    s_rtime.min=0;   else    s_rtime.min=lParam;   hdc=GetClientDC(hWnd);   SelectFont(hdc,s_font);   DispTimeNum(hdc,&s_rtime);   DrawTime(hWnd,hdc,&s_rtime);   ReleaseDC(hdc);   break;  case RTC_SETSEC:   if(lParam > 59)    s_rtime.sec=0;   else    s_rtime.sec=lParam;   hdc=GetClientDC(hWnd);   SelectFont(hdc,s_font);   DispTimeNum(hdc,&s_rtime);   DrawTime(hWnd,hdc,&s_rtime);   ReleaseDC(hdc);   break;  case MSG_DESTROY:   KillTimer(hWnd,TIMER0);   break;  default:   return (DefaultControlProc(hWnd,message,wParam,lParam)); } return 0;}static BOOL RegisterMyControl(void){ WNDCLASS MyClass; MyClass.spClassName=CTRL_RTC; MyClass.dwStyle=WS_NONE; MyClass.dwExStyle=WS_EX_NONE; MyClass.hCursor=GetSystemCursor(IDC_BUSY); MyClass.iBkColor=COLOR_lightwhite; MyClass.WinProc=RTCControlProc; return RegisterWindowClass(&MyClass);}static void UnregisterMyControl(void){ UnregisterWindowClass(CTRL_RTC);}static DLGTEMPLATE DlgSetTime={ WS_BORDER | WS_CAPTION, WS_EX_NONE, 100,100,250,250, "set time", 0, 0, 9, NULL, 0};static CTRLDATA CtrlInitData[]={ {  "static",  WS_VISIBLE | SS_SIMPLE,  40,40,50,20,  IDC_SET_STATIC0,  "set time",  0,  WS_EX_NONE }, {  "static",  WS_VISIBLE | SS_SIMPLE,  40,70,40,20,  IDC_SET_STATIC1,  "hour",  0,  WS_EX_NONE }, {  "static",  WS_VISIBLE | SS_SIMPLE,  40,100,40,20,  IDC_SET_STATIC2,  "minute",  0,  WS_EX_NONE }, {  "static",  WS_VISIBLE | SS_SIMPLE,  40,130,40,20,  IDC_SET_STATIC3,  "second",  0,  WS_EX_NONE }, {  "edit",  WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP,  85,70,40,20,  IDC_SET_EDIT1,  "",  0,  WS_EX_NONE }, {  "edit",  WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP,  85,100,40,20,  IDC_SET_EDIT2,  "",  0,  WS_EX_NONE }, {  "edit",  WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP,  85,130,40,20,  IDC_SET_EDIT3,  "",  0,  WS_EX_NONE }, {  "button",  WS_VISIBLE | WS_TABSTOP | BS_DEFPUSHBUTTON,  40,170,50,30,  IDOK,  "OK",  0,  WS_EX_NONE }, {  "button",  WS_VISIBLE | WS_TABSTOP,  100,170,50,30,  IDCANCEL,  "CANCEL",  0,  WS_EX_NONE }};static int DialogBoxProc(HWND hDlg, int message, WPARAM wParam, LPARAM lParam){ char sethour[5]={0}; char setmin[5]={0}; char setsec[5]={0}; Time set_time; switch(message) {  case MSG_INITDIALOG:   SendMessage(GetDlgItem(hDlg,IDC_SET_EDIT1),EM_LIMITTEXT,2,0L);   SendMessage(GetDlgItem(hDlg,IDC_SET_EDIT2),EM_LIMITTEXT,2,0L);   SendMessage(GetDlgItem(hDlg,IDC_SET_EDIT3),EM_LIMITTEXT,2,0L);   return 1;  case MSG_COMMAND:   switch(wParam)   {    case IDOK:    GetWindowText(GetDlgItem(hDlg,IDC_SET_EDIT1),sethour,2);    GetWindowText(GetDlgItem(hDlg,IDC_SET_EDIT2),setmin,2);    GetWindowText(GetDlgItem(hDlg,IDC_SET_EDIT3),setsec,2);    set_time.hour=atoi(sethour);    set_time.min=atoi(setmin);    set_time.sec=atoi(setsec);    if((set_time.hour < 0) || set_time.hour > 24)    {     MessageBox(hDlg,"set hour error","error",MB_OK);     break;    }    if((set_time.min < 0) || set_time.min > 59)    {     MessageBox(hDlg,"set minute error","error",MB_OK);     break;    }    if((set_time.sec < 0) || set_time.sec > 59)    {     MessageBox(hDlg,"set second error","error",MB_OK);     break;    }    SendMessage(s_myhwnd,RTC_SETTIME,0L,(LPARAM)(&set_time));           case IDCANCEL:     EndDialog(hDlg,wParam);     DestroyAllControls(hDlg);     break;   }   break; } return DefaultDialogProc(hDlg,message,wParam,lParam);}static void InitDialogBox(HWND hWnd){ DlgSetTime.controls=CtrlInitData; DialogBoxIndirectParam(&DlgSetTime,hWnd,DialogBoxProc,0L); }static HMENU CreateClockMenu(void){ HMENU hmenu; MENUITEMINFO mii; memset(&mii,0,sizeof(MENUITEMINFO)); mii.type=MFT_STRING; mii.id=0; mii.typedata=(DWORD)"Clock"; hmenu=CreatePopupMenu(&mii);  memset(&mii,0,sizeof(MENUITEMINFO)); mii.type=MFT_STRING; mii.state=0; mii.id=IDM_SETCLOCK; mii.typedata=(DWORD)"SetClock"; InsertMenuItem(hmenu,0,TRUE,&mii); memset(&mii,0,sizeof(MENUITEMINFO)); mii.type=MFT_STRING; mii.state=0; mii.id=IDM_SYSCLOCK; mii.typedata=(DWORD)"SysClock"; InsertMenuItem(hmenu,1,TRUE,&mii);  memset(&mii,0,sizeof(MENUITEMINFO)); mii.type=MFT_STRING; mii.state=0; mii.id=IDM_SETSYSCLOCK; mii.typedata=(DWORD)"SetSysClock"; InsertMenuItem(hmenu,2,TRUE,&mii); return StripPopupHead(hmenu);}static HMENU CreateClockSystemMenu(void){ HMENU hmenu; MENUITEMINFO mii; memset(&mii,0,sizeof(MENUITEMINFO)); mii.type=MFT_STRING; mii.id=0; mii.typedata=(DWORD)"System"; hmenu=CreatePopupMenu(&mii); memset(&mii,0,sizeof(MENUITEMINFO)); mii.type=MFT_STRING; mii.state=0; mii.id=IDM_ABOUT; mii.typedata=(DWORD)"About"; InsertMenuItem(hmenu,0,TRUE,&mii);  memset(&mii,0,sizeof(MENUITEMINFO)); mii.type=MFT_STRING; mii.state=0; mii.id=IDM_EXIT; mii.typedata=(DWORD)"Exit"; InsertMenuItem(hmenu,1,TRUE,&mii); return StripPopupHead(hmenu);}static HMENU CreateMainMenu(void){ HMENU hmenu; MENUITEMINFO mii; hmenu=CreateMenu();  memset(&mii,0,sizeof(MENUITEMINFO)); mii.type=MFT_STRING; mii.id=IDM_CLOCK; mii.typedata=(DWORD)"Clock"; mii.hsubmenu=CreateClockMenu(); InsertMenuItem(hmenu,0,TRUE,&mii);  memset(&mii,0,sizeof(MENUITEMINFO)); mii.type=MFT_STRING; mii.id=IDM_SYSTEM; mii.typedata=(DWORD)"System"; mii.hsubmenu=CreateClockSystemMenu(); InsertMenuItem(hmenu,1,TRUE,&mii); return hmenu;}static int GetCurrTime(Time *stime){ time_t now; struct tm *currtime; time(&now); currtime=localtime(&now); stime->hour=currtime->tm_hour; stime->min=currtime->tm_min; stime->sec=currtime->tm_sec; return 0;}static int SetCurrTime(Time *settime){ time_t now; struct tm *currtime; time(&now); currtime=localtime(&now); currtime->tm_hour=settime->hour; currtime->tm_min=settime->min; currtime->tm_sec=settime->sec; now=mktime(currtime); stime(&now); return 0;}//  WinProc()static int WinProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam){ HDC hdc; //static HWND s_myhwnd; Time stime; time_t now; static int GUIAPI id_message; switch(message) {  case MSG_CREATE:   GetCurrTime(&stime);   s_myhwnd=CreateWindow(CTRL_RTC,"",WS_VISIBLE | WS_BORDER,     IDC_RTC1,100,50,90,110,hWnd,(LPARAM)(&stime));   break;  /*case MSG_LBUTTONDOWN:   SendMessage(s_myhwnd,RTC_GETTIME,0L,(LPARAM)(&stime));   stime.hour++;   stime.min++;   stime.sec++;   SendMessage(s_myhwnd,RTC_SETTIME,0L,(LPARAM)(&stime));   //SendMessage(s_myhwnd,RTC_SETHOUR,0L,(LPARAM)(stime.hour));   //SendMessage(s_myhwnd,RTC_SETMIN,0L,(LPARAM)(stime.min));   //SendMessage(s_myhwnd,RTC_SETSEC,0L,(LPARAM)(stime.sec));   break;*/  case MSG_COMMAND:   switch(wParam)   {    case IDM_EXIT:     DestroyAllControls(hWnd);     DestroyMainWindow(hWnd);     PostQuitMessage(hWnd);     break;    case IDM_ABOUT:     MessageBox(hWnd,"SeaRobberStudio","Clock",MB_OK);     break;    case IDM_SETCLOCK:     InitDialogBox(hWnd);     break;    case IDM_SYSCLOCK:          GetCurrTime(&stime);    SendMessage(s_myhwnd,RTC_SETTIME,0L,(LPARAM)(&stime));     break;    case IDM_SETSYSCLOCK:     SetCurrTime(&s_rtime);   MessageBox(hWnd,"SetSystemTime Success!","SetSysTime",MB_OK);     break;    default:     break;   }  break;  case MSG_CLOSE:   DestroyAllControls(hWnd);   DestroyMainWindow(hWnd);   PostQuitMessage(hWnd);   break;  default:   return (DefaultMainWinProc(hWnd,message,wParam,lParam)); } return 0;}//InitMainWindow()int InitMainWindow(void){ MAINWINCREATE window_info; window_info.dwStyle=WS_VISIBLE | WS_BORDER | WS_CAPTION; window_info.dwExStyle=WS_EX_NONE; window_info.spCaption="MiniGUI"; window_info.hMenu=CreateMainMenu(); window_info.hCursor=GetSystemCursor(0); window_info.hIcon=0; window_info.MainWindowProc=WinProc; window_info.lx=MWINDOW_LX; window_info.ty=MWINDOW_TY; window_info.rx=MWINDOW_RX; window_info.by=MWINDOW_BY; window_info.iBkColor=COLOR_lightwhite; window_info.dwAddData=0; window_info.hHosting=HWND_DESKTOP; hMainWnd=CreateMainWindow(&window_info); if(hMainWnd == HWND_INVALID)  return 0; else  return 1;}//MiniGUIMain()int MiniGUIMain(int argc, const char *argv[]){ MSG Msg;#ifdef _LINE_VERSION SetDesktopRect(0,0,800,600);#endif RegisterMyControl(); InitMainWindow(); ShowWindow(hMainWnd,SW_SHOWNORMAL); while(GetMessage(&Msg,hMainWnd)) {  TranslateMessage(&Msg);  DispatchMessage(&Msg); } MainWindowThreadCleanup(hMainWnd); UnregisterMyControl(); return 0;}#ifndef _LITE_VERSION #include <minigui/dti.c>#endif