📄 win_syssetseries.c
字号:
/*** COMPANY NAME: 国星** FILE NAME: win_sysSetSeries.c** FILE PATH: Interface/win_sysSetSeries.c** WINDOWS NAME: 串口设置** WINDOWS PATH: 系统 / 系统设置 / 串口设置** OTHER INFORMATION; 无** CREATER NAME: LiWencheng, JiangYuanqing** MENDER NAME: LiWencheng** CHANGE TIME: 11/4/2007 */#include "sysSrcInfo.h"#define JULI_SLLI 21extern void *SendDataGram( void *arg );static HWND hWndCombox;static BITMAP bmpsysSetSeries; //缓存中间状态栏图片static HWND hWndMainsysSetSeries;static const char *bmp_name_sysSetSeries[] = { "./Pictures/b_windowsbackground_1.PNG", "./Pictures/OK.PNG", "./Pictures/return.PNG" };/* 定义皮肤元素数组 *///三个button 为左中右, 并不表示它就一定指OK或MENUstatic skin_item_t skinItemssysSetSeries [] ={ {SIID_OK, SI_TYPE_CHKBUTTON | SI_TEST_SHAPE_RECT | SI_STATUS_VISIBLE, BUTTONLEFT_X, BUTTON_Y, {}, 1, "" }, {SIID_RETURN, SI_TYPE_CHKBUTTON | SI_TEST_SHAPE_RECT | SI_STATUS_VISIBLE, BUTTONRIGHT_X, BUTTON_Y, {}, 2, "" }, };/* 定义皮肤 */static skin_head_t skinsysSetSeries ={ "skinsysSetSeries", //const BITMAP* bmps; SKIN_STYLE_TOOLTIP, NULL, NULL, 0, 2, skinItemssysSetSeries, FALSE};static const char *labels_sysSetSeries[] = { "19200", "12000", "2400", "4800", "9600", "38400", "57600", "115200"};static void CloseWindow_sysSetSeries (){ LoadSkinBmps (&skinsysSetSeries, FALSE, bmp_name_sysSetSeries, (sizeof (bmp_name_sysSetSeries))/sizeof (char *) ); ShowWindow (hWndMainsysSetSeries, SW_HIDE); UnloadBitmap (&bmpsysSetSeries );}static int main_event_cb_sysSetSeries (HWND hwnd, skin_item_t* item, int event, void* data){ int currSelect; if (event == SIE_BUTTON_CLICKED) { switch (item->id) { case SIID_OK: SetSeries (SendMessage (hWndCombox, CB_GETCURSEL, 0, 0 ) ); currSelect = GetSeriesSet (); printf("currSelect is %d \n",currSelect); memset( cksc->baudRate ,'\0',10); switch( currSelect ) { case 0: memcpy(cksc->baudRate, "19200", 5); break; case 1: memcpy(cksc->baudRate, "12000", 5); break; case 2: memcpy(cksc->baudRate, "2400", 4); break; case 3: memcpy(cksc->baudRate, "4800", 4); break; case 4: memcpy(cksc->baudRate, "9600", 4); break; case 5: memcpy(cksc->baudRate, "38400", 5); break; case 6: memcpy(cksc->baudRate, "57600", 5); break; case 7: memcpy(cksc->baudRate, "115200", 6); break; } printf("CKSC cksc->baudRate %s \n",cksc->baudRate); sendArg.cmd ="$CKSC"; sendArg.fixedLen = LEN_OF_CKSC; sendArg.length = 0; memset(sendArg.srcID, '\0', 10); memcpy(sendArg.srcID, "105006", 6);//Get the local user's ID to send printf("CKSC sendArg.srcID %s \n",sendArg.srcID); sendArg.cksc = cksc; CheckTidCount( );
Pthread_create(&tid_Processing[tidProcessing],&attr,SendDataGram,NULL); break; case SIID_RETURN://return CloseWindow_sysSetSeries (); win_SysSet (hWndMain ); break; } } return 1;}static int msg_event_cb_sysSetSeries (HWND hwnd, int message, WPARAM wparam, LPARAM lparam, int* result){ HDC hdc; gal_pixel pixel; int i; switch (message) { case MSG_CREATE: LoadBitmap (HDC_SCREEN, &bmpsysSetSeries, "Pictures/a_sysSysset_3.PNG"); hWndCombox = CreateWindow (CTRL_COMBOBOX, "", WS_CHILD | WS_VISIBLE |CBS_EDITNOBORDER|//| WS_BORDER CBS_READONLY|CBS_SPINARROW_LEFTRIGHT |CBS_SPINLIST, //CBS_AUTOSPIN|CBS_AUTOLOOP| 2343, 5, 50, 70, 25, hwnd, 0); gal_pixel pixel = RGB2Pixel (HDC_SCREEN, 0xFF, 0xFF, 0xFF); SetWindowBkColor (hWndCombox, pixel); InvalidateRect (hWndCombox, NULL, TRUE); for (i=0;i<8;i++) { SendMessage (hWndCombox, CB_ADDSTRING, 0, (LPARAM)labels_sysSetSeries[i]); } SendMessage (hWndCombox, CB_SETCURSEL, GetSeriesSet (), 0 ); InvalidateRect (hWndMainSysLook, NULL, TRUE);//re1draw break; case MSG_PAINT : hdc=BeginPaint (hwnd); SetBkMode (hdc, BM_TRANSPARENT); FillBoxWithBitmap (hdc, ZTL_PIC_X, ZTL_PIC_Y, ZTL_PIC_W, ZTL_PIC_H, &bmpsysSetSeries); TextOut (hdc, WZ_ZTL_X4, WZ_ZTL_Y, "串口设置" ); TextOut (hdc, RJ_X, 23, "串口波特率" ); EndPaint (hwnd, hdc); break; } return 1;}void win_sysSetSeries (HWND hwndmain ){ MSG msg; LoadSkinBmps (&skinsysSetSeries, TRUE, bmp_name_sysSetSeries, (sizeof (bmp_name_sysSetSeries))/sizeof (char *) ); if (skinsysSetSeries.bmps == NULL) { printf ("Could not load skin bitmaps!\n"); } if (!skin_init (&skinsysSetSeries, main_event_cb_sysSetSeries, msg_event_cb_sysSetSeries) ){ /* 初始化皮肤 */ printf ("skin init fail!\n\n"); } else{ hWndMainsysSetSeries = create_skin_control (&skinsysSetSeries, hwndmain, 153, DEF_X_, DEF_Y_, DEF_WIDTH, DEF_HEIGHT); currShowWindowHwnd = hWndMainsysSetSeries; }}#ifndef _LITE_VERSION#include <minigui/dti.c>#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -