예제 #1
0
/*
	列表框消息回调函数
*/
static int CobProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
{
	int temp;
	int id;
	int index;
	RECT rc;
	HDC hdc= (HDC)NULL;
	
	GetWindowRect(hWnd, &rc);	
	switch(message){
		case MSG_SETFOCUS:{
			hdc = GetClientDC(GetParent(hWnd));
			if(hdc != (HDC)NULL){
				SetPenColor(hdc, SETFOCUS_COLOR);
				Rectangle(hdc, rc.left-1, rc.top-1, rc.right+1, rc.bottom+1);
				Rectangle(hdc, rc.left-2, rc.top-2, rc.right+2, rc.bottom+2);
				ReleaseDC(hdc);
			}
		}break;
		case MSG_KILLFOCUS:{
			hdc = GetClientDC(GetParent(hWnd));
			if(hdc !=(HDC)NULL){
				SetPenColor(hdc, KILLFOCUS_COLOR);
				Rectangle(hdc, rc.left-1, rc.top-1, rc.right+1, rc.bottom+1);
				Rectangle(hdc, rc.left-2, rc.top-2, rc.right+2, rc.bottom+2);
				ReleaseDC(hdc);
			}
		}break;
	case MSG_COMMAND:{
		case MSG_KEYUP:{
			if(wParam==SCANCODE_ENTER||CBN_EDITCHANGE==HIWORD(wParam)){
					id = GetDlgCtrlID(hWnd);
					index = SendMessage(hWnd, CB_GETCURSEL, 0, 0);
						
					switch(id){
						case DID_CO2SET_ALMCLASS:{
							gCfgCO2.bAlmControl = index;
							SetIntValueToResFile(gFileSetup, "CO2Setup", "alarm_control",  gCfgCO2.bAlmControl, 1);
							SetFocus(btnSetAlmClass);
							//改变参数的报警级别
							ChangeAlarmClass();
						}break;
						case DID_CO2SET_ALMPRINT:{
							gCfgCO2.bPrnControl = index;
							SetIntValueToResFile(gFileSetup, "CO2Setup", "alarm_print",  gCfgCO2.bPrnControl, 1);
							SetFocus(btnSetAlmPrint);
						}break;
					}	
					gbKeyType = KEY_TAB;
				}break;
			}
			return 0;
		}break;	
	}	
	temp = (*OldCobProc)(hWnd, message, wParam, lParam);
	return(temp);
}
예제 #2
0
void UI_Out_800_600_SetMainFromColor ( int nBkColor )
{

	HDC hDC  = GetClientDC ( UI_Out_800_600_Get_From_Handl() ) ;
	SetBrushColor ( hDC , nBkColor ) ;
	FillBox ( hDC , 0 , 0 , 800 , 2 ) ;
	FillBox ( hDC , 0 , 24 , 800 , 1 ) ;
	FillBox ( hDC , 0 , 48+3 , 800 , 3 ) ;
	FillBox ( hDC , 0 , 149+3 , 800 , 3 ) ;
	FillBox ( hDC , 0 , 171+6 , 800 , 9-6 ) ;
	FillBox ( hDC , 0 , 204 , 800 , 4 ) ;
	FillBox ( hDC , 0 , 306 , 360 , 2 ) ;
	FillBox ( hDC , 360 , 482 , 325 , 2 ) ;
	FillBox ( hDC , 360 , 507 , 440 , 2 ) ;
	FillBox ( hDC , 0 , 597 , 800 , 3 ) ;
	FillBox ( hDC , 0 , 0 , 1 , 24 ) ;
	FillBox ( hDC , 799 , 0 , 1 , 24 ) ;
	FillBox ( hDC , 0 , 24 , 4 , 600 - 24 ) ;
	FillBox ( hDC , 796 , 24 , 4 , 600 - 24 ) ;
	FillBox ( hDC , 168 , 24 , 3 , 180 - 24 ) ;
	FillBox ( hDC , 339 , 24 , 3 , 180 - 24 ) ;
	FillBox ( hDC , 460 , 24 , 3 , 180 - 24 ) ;
	FillBox ( hDC , 581 , 24 , 3 , 180 - 24 ) ;
	FillBox ( hDC , 357 , 171+6 , 3 , 600 - 171-6 ) ;
	FillBox ( hDC , 683 , 149+6 , 3 , 509 - 149-6 ) ;
	FillBox ( hDC , 621 , 149+6 , 3 , 180 - 149-6 ) ;
	FillBox ( hDC , 530 , 171+6 , 3 , 208 - 171-6 ) ;
	ReleaseDC ( hDC ) ;

}
예제 #3
0
static void setup_anim_mem_dc (HWND hwnd, ANIMATIONINFO* anim_info)
{
    gal_pixel bk_pixel;
    HDC hdc;

    if (!anim_info->anim)
        return;

    if (anim_info->mem_dc)
        DeleteCompatibleDC (anim_info->mem_dc);
    hdc = GetClientDC (hwnd);
#ifdef _USE_NEWGAL
    anim_info->mem_dc = CreateCompatibleDCEx (hdc,
                    anim_info->anim->width, anim_info->anim->height);
#else
    anim_info->mem_dc = CreateCompatibleDC (hdc);
#endif

    if (GetWindowExStyle (hwnd) & WS_EX_TRANSPARENT)
        bk_pixel = GetWindowBkColor (GetParent (hwnd));
    else
        bk_pixel = GetWindowBkColor (hwnd);

    SetBkColor (anim_info->mem_dc, bk_pixel);
    SetBrushColor (anim_info->mem_dc, bk_pixel);
    FillBox (anim_info->mem_dc, 0, 0,
            GetGDCapability (hdc, GDCAP_MAXX)+1,
            GetGDCapability (hdc, GDCAP_MAXY)+1);

    ReleaseDC (hdc);
}
예제 #4
0
void UI_Out_640_480_ShowDeviceState_MMI(int btnindex,BOOL flag)
{
	HDC hDC;
	if (U_SBtn_Flag==0)
		return;
	hDC = GetClientDC(From_Handl);   
	switch (btnindex)
	{
	case 1:
		FillBoxWithBitmap (hDC, rt1.left+4, rt1.top+4, 0, 0, flag  ? &bmYuPengG : &bmYuPengR);  
		break;
	case 2:
		FillBoxWithBitmap (hDC, rt2.left+4, rt2.top+4, 0, 0, flag ? &bmJiaoTongG : &bmJiaoTongR); 
		break;
	case 3:
		FillBoxWithBitmap (hDC, rt3.left+4, rt3.top+4, 0, 0, flag? &bmLanGanUp : &bmLanGanDown);   
		break;
	case 4:
		FillBoxWithBitmap (hDC, rt4.left+4, rt4.top+4, 0, 0, flag ? &bmXianQuanR:&bmXianQuanG );   
		break;
	case 5:
		FillBoxWithBitmap (hDC, rt5.left+4, rt5.top+4, 0, 0, flag? &bmXianQuanR:&bmXianQuanG);    
		break;
	case 6:
		FillBoxWithBitmap (hDC, rt6.left+4, rt6.top+4, 0, 0, flag ? &bmPrintG : &bmPrintR);  
		break;
	default:
		break;
	}
	ReleaseDC(hDC); 

}
예제 #5
0
void UI_Out_640_480_ClearAbateChargeEditC()
{
	HDC hDC;
	hDC = GetClientDC(From_Handl);   
	FillBoxWithBitmap(hDC,rec5.left+2, rec5.top+2,0,0,&g_bmP[12]);  
	ReleaseDC(hDC); 
}
static int TimeEditorWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
{
    switch (message) {
    case MSG_CREATE:
    {
        HWND hwnd;
        HDC hdc;
        HWND timeedit, spin;
        SIZE size;

        hwnd = CreateWindow (CTRL_STATIC, PROMPT, 
                        WS_CHILD | WS_VISIBLE | SS_LEFT, 
                        IDC_STATIC, 
                        10, 10, 210, 200, hWnd, 0);

        timefont = CreateLogFont (NULL, "System", "ISO8859-1", 
                        FONT_WEIGHT_BOOK, FONT_SLANT_ROMAN, FONT_FLIP_NIL,
                        FONT_OTHER_AUTOSCALE, FONT_UNDERLINE_NONE, FONT_STRUCKOUT_NONE, 
                        32, 0);

        hdc = GetClientDC (hWnd);
        SelectFont (hdc, timefont);
        GetTextExtent (hdc, "00:00:00", -1, &size);
        ReleaseDC (hdc);

        timeedit = CreateWindow (CTRL_SLEDIT, 
                        "00:00:00", 
                        WS_CHILD | WS_VISIBLE | ES_BASELINE, 
                        IDC_EDIT, 
                        40, 220, size.cx + 4, size.cy + 4, hWnd, 0);

        SetWindowFont (timeedit, timefont);
        old_edit_proc = SetWindowCallbackProc (timeedit, TimeEditBox);

        spin = CreateWindow (CTRL_SPINBOX, 
                        "", 
                        WS_CHILD | WS_VISIBLE, 
                        IDC_SPINBOX, 
                        40 + size.cx + 6, 220 + (size.cy - 14) / 2, 20, 20, hWnd, 0);
        SendMessage (spin, SPM_SETTARGET, 0, timeedit);
        break;
    }

    case MSG_DESTROY:
        DestroyAllControls (hWnd);
        DestroyLogFont (timefont);
	return 0;

    case MSG_CLOSE:
        DestroyMainWindow (hWnd);
        PostQuitMessage (hWnd);
        return 0;
    }

    return DefaultMainWinProc (hWnd, message, wParam, lParam);
}
static void hilight (HWND hWnd, PCOOLBARCTRL cb, COOLBARITEMDATA* item)
{
    HDC hdc;

    hdc = GetClientDC (hWnd);
    draw_hilight_box (hWnd, hdc, item);
    ReleaseDC (hdc);

    ShowCurItemHint (hWnd, cb, item);
}
예제 #8
0
BOOL BlinkCaret (HWND hWnd)
{
    PMAINWIN pWin;
    HDC hdc;

    pWin = (PMAINWIN)hWnd;

    if (!pWin->pCaretInfo)
        return FALSE;

    if (!pWin->pCaretInfo->fBlink)
        return FALSE;

    hdc = GetClientDC (hWnd);

    if (!pWin->pCaretInfo->fShow) {

        // show caret
#ifdef _USE_NEWGAL
        pWin->pCaretInfo->caret_bmp.bmBits = pWin->pCaretInfo->pXored;
        FillBoxWithBitmap (hdc,
                        pWin->pCaretInfo->x, pWin->pCaretInfo->y, 0, 0, 
                        &pWin->pCaretInfo->caret_bmp);
#else
        PutSavedBoxOnDC (hdc, 
                        pWin->pCaretInfo->x, pWin->pCaretInfo->y,
                        pWin->pCaretInfo->nEffWidth,
                        pWin->pCaretInfo->nEffHeight,
                        pWin->pCaretInfo->pXored);
#endif /* _USE_NEWGAL */

        pWin->pCaretInfo->fShow = TRUE;
    }
    else {
        // hide caret
#ifdef _USE_NEWGAL
        pWin->pCaretInfo->caret_bmp.bmBits = pWin->pCaretInfo->pNormal;
        FillBoxWithBitmap (hdc,
                        pWin->pCaretInfo->x, pWin->pCaretInfo->y, 0, 0, 
                        &pWin->pCaretInfo->caret_bmp);
#else
        PutSavedBoxOnDC (hdc, 
                        pWin->pCaretInfo->x, pWin->pCaretInfo->y,
                        pWin->pCaretInfo->nEffWidth,
                        pWin->pCaretInfo->nEffHeight,
                        pWin->pCaretInfo->pNormal);
#endif /* _USE_NEWGAL */

        pWin->pCaretInfo->fShow = FALSE;
    }
    
    ReleaseDC (hdc);

    return TRUE;
}
예제 #9
0
//Draw clock face.
static void DrawClockFace(HANDLE hWnd)
{
	HANDLE hDC = NULL;
	__RECT rect;       //Window client area's rect.
	HANDLE hPen = NULL;
	HANDLE hBrush = NULL;
	HANDLE hOldBrush = NULL;
	HANDLE hOldPen = NULL;
	int cx,cy,r;

	hDC = GetClientDC(hWnd);
	if(!GetWindowRect(hWnd,&rect,GWR_INDICATOR_CLIENT))
	{
		goto __TERMINAL;
	}
	//Calculate the circle's center coordinate and radius.
	cx = (rect.right - rect.left) / 2;
	cy = (rect.bottom - rect.top) / 2;
	r  = cx > cy ? cy : cx;
	r -= 10;  //Keep 10 pixel space between circle and window frame.

	//Create the pen and brush object used to draw circle.
	hPen = CreatePen(0,1,CLK_SCALE_COLOR);
	if(NULL == hPen)
	{
		goto __TERMINAL;
	}
	hBrush = CreateBrush(FALSE,CLK_FACE_COLOR);
	if(NULL == hBrush)
	{
		goto __TERMINAL;
	}
	hOldPen = SelectPen(hDC,hPen);
	hOldBrush = SelectBrush(hDC,hBrush);
	//Draw the clock face circle now.
	DrawCircle(hDC,cx,cy,r,FALSE);
	DrawCircle(hDC,cx,cy,r - 1,FALSE);
	DrawCircle(hDC,cx,cy,r - 2,FALSE);
	DrawCircle(hDC,cx,cy,r - 3,TRUE);
	DrawClockScale(hDC,cx,cy,r);  //Draw clock's scale.
	//Restore original pen and brush for this window's DC.
	SelectPen(hDC,hOldPen);
	SelectBrush(hDC,hOldBrush);

__TERMINAL:
	if(hPen)
	{
		DestroyPen(hPen);
	}
	if(hBrush)
	{
		DestroyBrush(hBrush);
	}
	return;
}
예제 #10
0
static void UpdateFaceRegWindow(HWND hWnd,HDC hdc)
{
	hdc=GetClientDC(hWnd);
	SelectFont(hdc,gfont);
        SetTextColor(hdc,PIXEL_lightwhite);
        SetBkMode(hdc,BM_TRANSPARENT);
	FillBoxWithBitmap (hdc, 0, -1, 0, MENUBAR_HEIGHT, &fvbar);
	DrawText(hdc,(char*)LoadStrByID(FACE_REG),-1,&title_rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
	FillBoxWithBitmap (hdc, 0, MENUBAR_HEIGHT, 0, 0, &fvbg);
	ReleaseDC(hdc);
}
예제 #11
0
파일: palette.c 프로젝트: mypopydev/xuanjia
static int PaletteWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
{
    HDC hdc;
    int x, y;
    static GAL_Color colorPal[256], myPal[256];
    switch (message) {
    case MSG_CREATE:
        GetPalette(HDC_SCREEN, 0, 256, colorPal);
#ifdef _DEBUG
	int i;
        for (i = 0; i < 256; i++) {
            printf ("i = %d\n, red = %d\n, green = %d\n, blue = %d\n\n", 
                    i, colorPal[i].r, colorPal[i].g, colorPal[i].b);
        }
#endif
        break;

    case MSG_PAINT:
        {
            if (g_bShowBall)
                SendMessage (hWnd, MSG_LBUTTONDOWN, 0, 0);
        }
        break;
    case MSG_LBUTTONDOWN:
        g_bShowBall = TRUE;
        hdc = GetClientDC(hWnd);
        InitMyPalette(myPal);
        SetPalette(hdc, 0, 256, myPal);
        SetBrushColor(hdc, COLOR_red);
        FillCircle(hdc, 10, 10, 8);
        for (y = 0; y < 240; y += 20) {
            for (x = 0; x < 320; x += 20) {
              BitBlt(hdc, 0, 0, 20, 20, hdc, x, y, 0);
              SetColorfulPalette(hdc);
            }
        }
        ReleaseDC(hdc);
        break;

    case MSG_RBUTTONDOWN:
        SetColorfulPalette(HDC_SCREEN);
        SetBrushColor(HDC_SCREEN, PIXEL_yellow);
        FillCircle(HDC_SCREEN, 50, 50, 15);
        break;

    case MSG_CLOSE:
        DestroyAllControls (hWnd);
        DestroyMainWindow (hWnd);
        PostQuitMessage (hWnd);
        return 0;
    }

    return DefaultMainWinProc(hWnd, message, wParam, lParam);
}
예제 #12
0
//Local helper routine to draw the content of year window.
static VOID DrawMonth(HANDLE hWnd,int month)
{
    __RECT rect;
    int x,y,length;
    HANDLE hDC = GetClientDC(hWnd);
    TCHAR yearstr[16];

    GetWindowRect(hWnd,&rect,GWR_INDICATOR_CLIENT);
    sprintf(yearstr,"%02dÔÂ",month);
    length = GetTextMetric(hDC,yearstr,TM_WIDTH);
    x = (rect.right - rect.left - length) / 2;
    y = 7;
    TextOut(hDC,x,y,yearstr);
}
예제 #13
0
void UI_Out_640_480_ShowTime_MMI(char * szInfo )
{
	HDC hDC; 
	RECT rt;
	hDC =     GetClientDC(From_Handl);    
	SetBkColor(hDC, RGB(254, 254, 254));    
	SetTextColor(hDC, RGB(0, 0, 0));    
	rt.left = rec2.left+2;
	rt.top = rec2.top+2;
	rt.right = rec2.right-2;
	rt.bottom = rec2.bottom-2;
	DrawText(hDC, szInfo, -1, &rt, DT_SINGLELINE | DT_CENTER | DT_VCENTER); 
	ReleaseDC(hDC); 
}
예제 #14
0
//A local helper routine,to draw weeks title.
static VOID DrawWeekTitle(HANDLE hWnd)
{
    static TCHAR* Weeks[7] = {
        "SUN",
        "MON",
        "TUES",
        "WED",
        "THUR",
        "FRI",
        "SAT"
    };
    HANDLE hDC = GetClientDC(hWnd);
    __RECT rect;
    HANDLE hBrush,hOldBrush;
    HANDLE hPen,hOldPen;
    int txtx,txty;  //Text start position.

    hBrush = CreateBrush(FALSE,COLOR_CYAN);
    if(NULL == hBrush)
    {
        return;
    }
    hPen = CreatePen(0,1,COLOR_WHITE);
    if(NULL == hPen)
    {
        DestroyBrush(hBrush);
        return;
    }
    hOldBrush = SelectBrush(hDC,hBrush);
    hOldPen   = SelectPen(hDC,hPen);

    for(int i = 0; i < 7; i ++)
    {
        rect.left = i * DAY_RECT_WIDTH;
        rect.right = rect.left + DAY_RECT_WIDTH;
        rect.top = DAY_RECT_HEIGHT;  //Reserve the space for year/month/time window.
        rect.bottom = rect.top + DAY_RECT_HEIGHT;
        DrawRectangle(hDC,rect);
        txtx = rect.left + 8;
        txty = rect.top + 9;
        TextOut(hDC,txtx,txty,Weeks[i]);
    }
    SelectBrush(hDC,hOldBrush);
    SelectPen(hDC,hOldPen);
    DestroyPen(hPen);
    DestroyBrush(hBrush);
    return;
}
static void untag_all (HWND hwnd)
{
    int x, y;
    HDC hdc = GetClientDC (hwnd);

    for (x = 0; x < STONE_COLS; x++)
        for (y = 0; y < STONE_LINES; y++){
            field [x][y].tag   = 0;
            if (sync_stones && field [x][y].frame != 0) {
                field [x][y].frame = 0;
                draw_ball (hdc, x, y);
            }
        }

    ReleaseDC (hdc);
}
예제 #16
0
파일: colordlg.c 프로젝트: VVillwin/minigui
static void UpdateValue (HWND hDlg, int id, PSCOLORDIA scld)
{
    char str[8];
    HDC dc = GetClientDC (hDlg);
    Uint8 r, g, b;
    
    HSV2RGB (scld->clrh, scld->clrs, scld->clrv, &r, &g, &b);
    switch (id) {
    case IDC_VALUE_Y:  
        GetDlgItemText (hDlg, id, str, 8);
        scld->clrh = atoi (str);
        scld->clrh = MIN (359, scld->clrh);
        SetValue (hDlg, scld);
        break;
    case IDC_VALUE_U:  
        GetDlgItemText (hDlg, id, str, 8);
        scld->clrs = atoi (str);
        SetValue (hDlg, scld);
        break;
    case IDC_VALUE_V:  
        GetDlgItemText (hDlg, id, str, 8);
        scld->clrv = atoi (str);
        SetValue (hDlg, scld);
        break;
    case IDC_VALUE_R:  
        GetDlgItemText (hDlg, id, str, 8);
        r = atoi (str);
        RGB2HSV (r, g, b, &scld->clrh, &scld->clrs, &scld->clrv);
        SetValue (hDlg, scld);
        break;
    case IDC_VALUE_G:  
        GetDlgItemText (hDlg, id, str, 8);
        g = atoi (str);
        RGB2HSV (r, g, b, &scld->clrh, &scld->clrs, &scld->clrv);
        SetValue (hDlg, scld);
        break;
    case IDC_VALUE_B:  
        GetDlgItemText (hDlg, id, str, 8);
        b = atoi (str);
        RGB2HSV (r, g, b, &scld->clrh, &scld->clrs, &scld->clrv);
        SetValue (hDlg, scld);
        break;
    }
    DrawAllSpace (dc, scld);
    ReleaseDC (dc);
}
예제 #17
0
void UI_Out_640_480_SetMainFromColor(int nBkColor)
{
	HWND hWnd = From_Handl;
	HDC hDC;
	hDC = GetClientDC(hWnd); 
	SetBrushColor(hDC, nBkColor);   
	FillBox(hDC, 2, 23, 636,3); 
	FillBox(hDC, 2, rec3.top-2, 636,2);
	FillBox(hDC, 2, rec5.top-3, 275,3); 
	FillBox(hDC, 2, rec6.top-3, 275,3);
	FillBox(hDC, 2, rec8.top-3, 275,3);
	FillBox(hDC, rec10.left, rec10.bottom+2, rec10.right-rec10.left+2,3);
	FillBox(hDC, 2, rec8.bottom+2, 636,2);
	FillBox(hDC, 2, 23, 2,453);
	FillBox(hDC,rec1.right+2, 23, 2, 453);
	FillBox(hDC,rec2.right+2, 23, 2, 453);
	FillBox(hDC,rec6.right+2, rec6.top-2, 3, rec6.bottom-rec6.top +6);
	ReleaseDC(hDC); 
}
static void set_item_rect (HWND hwnd, PCOOLBARCTRL TbarData, COOLBARITEMDATA* ptemp)
{
    SIZE size;
    int w;

    if (TbarData->tail == NULL) 
        ptemp->RcTitle.left = 2;
    else
        ptemp->RcTitle.left = TbarData->tail->RcTitle.right;

    switch (ptemp->ItemType) {
    case TYPE_BARITEM:
        w = ITEMBARWIDTH;
        break;

    case TYPE_BMPITEM:
        w = TbarData->ItemWidth + 4;
        break;

    case TYPE_TEXTITEM:
        if (strlen (ptemp->Caption)) {
            HDC hdc;
            hdc = GetClientDC (hwnd);
            GetTextExtent (hdc, ptemp->Caption, -1, &size);
            ReleaseDC (hdc);
        }
        w = size.cx + 4;
        break;

    default:
        w = 0;
        break;
    }

    ptemp->RcTitle.right = ptemp->RcTitle.left + w;
    ptemp->RcTitle.top = 2;
    ptemp->RcTitle.bottom = ptemp->RcTitle.top + TbarData->ItemHeight + 4;
  
    ptemp->hintx = ptemp->RcTitle.left;
    ptemp->hinty = ptemp->RcTitle.bottom;
}
예제 #19
0
//Window procedure of the main window.
static DWORD HCNHelpWndProc(HANDLE hWnd,UINT message,WORD wParam,DWORD lParam)
{
         static HANDLE hDC = GetClientDC(hWnd);
          __RECT rect;
		  int   ypos = 5;
 
         switch(message)
         {
         case WM_CREATE:    //Will receive this message when the window is created.
             break;
         case WM_TIMER:     //Only one timer can be set for one window in current version.
             break;
         case WM_DRAW:
               //GetWindowRect(hWnd,&rect,GWR_INDICATOR_CLIENT);
			   TextOut(hDC,10,ypos,"Hello China是一个智能嵌入式操作系统,应用在各种智能控制设备中。");
			   ypos += 20;
			   TextOut(hDC,10,ypos,"当前版本是V1.75,下列是一些相关的操作帮助:");
			   ypos += 20;
			   TextOut(hDC,10,ypos,"------------------------------------------");
			   ypos += 20;
			   TextOut(hDC,10,ypos,"当前模式是图形模式,按下CTRL + ALT + DEL组合键,可返回字符界面;");
			   ypos += 20;
			   TextOut(hDC,10,ypos,"在字符模式下,输入GUI并按回车,可进入图形模式;");
			   ypos += 20;
			   TextOut(hDC,10,ypos,"在字符模式下,输入help并按回车,可输出字符模式的帮助信息;");
			   ypos += 20;
			   TextOut(hDC,10,ypos,"任何技术问题,请加入QQ群:38467832 进行讨论;");
			   ypos += 20;
			   TextOut(hDC,10,ypos,"官方blog链接:http://blog.csdn.net/hellochina15");
			   ypos += 20;
			   TextOut(hDC,10,ypos,"技术支持邮件地址:[email protected]");
			   ypos += 20;
             break;
         case WM_CLOSE:
             PostQuitMessage(0);  //Exit the application.
             break;
         default:
             break;
         }
         return DefWindowProc(hWnd,message,wParam,lParam);
}
예제 #20
0
static int insert_new_page_normal_style (HWND hwnd, PPROPSHEETDATA propsheet, PPROPPAGE page, DWORD style)
{
    int require_width, index;
    HDC hdc = GetClientDC (hwnd);
    
    require_width = tab_required_width (hdc, propsheet, page);
    ReleaseDC (hdc);
    
    index = 0;
    
    if (propsheet->active) {
        show_hide_page (propsheet->active, SW_HIDE);
    }
    propsheet->active = page;
    
    page->width = require_width;
    index = append_page (propsheet, page);
    update_propsheet (propsheet);

    return index;
}
예제 #21
0
BOOL GUIAPI ShowCaret (HWND hWnd)
{
    PMAINWIN pWin;

    pWin = (PMAINWIN)hWnd;

    if (!pWin->pCaretInfo)
        return FALSE;

    if (pWin->pCaretInfo->fBlink)
        return FALSE;

    pWin->pCaretInfo->fBlink = TRUE;
    GetCaretBitmaps (pWin->pCaretInfo);
    
    if (!pWin->pCaretInfo->fShow) {

        HDC hdc;
        
        // show caret immediately
        hdc = GetClientDC (hWnd);
#ifdef _USE_NEWGAL
        pWin->pCaretInfo->caret_bmp.bmBits = pWin->pCaretInfo->pXored;
        FillBoxWithBitmap (hdc,
                        pWin->pCaretInfo->x, pWin->pCaretInfo->y, 0, 0, 
                        &pWin->pCaretInfo->caret_bmp);
#else
        PutSavedBoxOnDC (hdc, 
                        pWin->pCaretInfo->x, pWin->pCaretInfo->y,
                        pWin->pCaretInfo->nEffWidth,
                        pWin->pCaretInfo->nEffHeight,
                        pWin->pCaretInfo->pXored);
#endif /* _USE_NEWGAL */
        ReleaseDC (hdc);

        pWin->pCaretInfo->fShow = TRUE;
    }

    return TRUE;
}
예제 #22
0
//Window procedure for TimeWindow.
static DWORD TimeWindowProc(HANDLE hWnd,UINT message,WORD wParam,DWORD lParam)
{
    static __TIME currtime;
    TCHAR timestr[16];
    __RECT rect;
    int x,y,length;
    HANDLE hDC = NULL;

    switch(message)
    {
    case WM_CREATE:
        currtime.hour    = 12;
        currtime.minute  = 30;
        currtime.second  = 0;
        break;
    case WM_DRAW:
        sprintf(timestr,"%02d:%02d:%02d",currtime.hour,currtime.minute,currtime.second);
        hDC = GetClientDC(hWnd);
        length = GetTextMetric(hDC,timestr,TM_WIDTH);
        GetWindowRect(hWnd,&rect,GWR_INDICATOR_CLIENT);  //Get client rect.
        //Calculate the x and y of string.
        x = (rect.right - rect.left - length) / 2;
        if(x < 0)
        {
            x = 0;
        }
        y = 5;
        TextOut(hDC,x,y,timestr);
        break;
    case WM_SETTIME:  //Set current time.
        break;
    default:
        break;
    }
    return DefWindowProc(hWnd,message,wParam,lParam);
}
예제 #23
0
static int NewWiFiWinProc(HWND  hWnd, int message, WPARAM wParam, LPARAM lParam)
{
	HDC hdc;
	int id,nc;
	static char keyupFlag=0;

	switch (message)
	{
		case MSG_CREATE:
			wifidhcpflag = gOptions.wifidhcpfunon;
			InitWifiWindow(hWnd);		//add controls
			InitParameters();

			curFocusWnd =0;
			SetFocusChild(WifiWnd[curFocusWnd]);
			UpdateWindow(hWnd,TRUE);
			break;

		case MSG_ERASEBKGND:
			{
				HDC hdc = (HDC)wParam;
				const RECT* clip = (const RECT*)lParam;
				BOOL fGetDC = FALSE;
				RECT rcTemp;
				if(hdc == 0) {
					hdc = GetClientDC(hWnd);
					fGetDC = TRUE;
				}

				if(clip) {
					rcTemp = *clip;
					ScreenToClient(hWnd, &rcTemp.left, &rcTemp.top);
					ScreenToClient(hWnd,&rcTemp.right, &rcTemp.bottom);
					IncludeClipRect(hdc, &rcTemp);
				}

				FillBoxWithBitmap (hdc, 0, 0, gOptions.LCDWidth, 0, &wifibkg);
				if(fGetDC) {
					ReleaseDC (hdc);
				}
				return 0;
			}

		case MSG_PAINT:
			hdc=BeginPaint(hWnd);	
			EndPaint(hWnd,hdc);
			return 0;

		case MSG_KEYUP:
			if(3 == gOptions.TFTKeyLayout){
				keyupFlag=1;
			}
			break;
		case MSG_KEYDOWN:
			SetMenuTimeOut(time(NULL));
			if (3 == gOptions.TFTKeyLayout) {
				if (1==keyupFlag) {
					keyupFlag=0;
				} else {
					break;
				}
			}
			if (gOptions.KeyPadBeep){
				ExKeyBeep();
			}

			if ((LOWORD(wParam)==SCANCODE_ESCAPE)){
				PostMessage(hWnd, MSG_COMMAND, WIFI_EXIT, 0);
			} else 	if (LOWORD(wParam)==SCANCODE_CURSORBLOCKDOWN) {
				char tmpssid[128];
				if (curFocusWnd==0) {
					GetWindowText(WifiWnd[0], tmpssid, sizeof(tmpssid));
					if(tmpssid && strlen(tmpssid)>0) {
						if(hIMEWnd!=HWND_INVALID){
							SendMessage(hIMEWnd,MSG_CLOSE,0,0L);
							hIMEWnd=HWND_INVALID;
						}
						curFocusWnd++;
					}
				} else if (curFocusWnd==1) {
					if(hIMEWnd!=HWND_INVALID){
						SendMessage(hIMEWnd,MSG_CLOSE,0,0L);
						hIMEWnd=HWND_INVALID;
					}
					curFocusWnd++;
				} else if(++curFocusWnd>16) {
					curFocusWnd=0;
				}

				if (wifidhcpflag == 1 && curFocusWnd == 3) {
					curFocusWnd=15;
				}
				if (curFocusWnd == 4 || curFocusWnd == 5 ||curFocusWnd == 6 ){
					curFocusWnd = 7;
				}
				if (curFocusWnd == 8 || curFocusWnd == 9 || curFocusWnd == 10){
					curFocusWnd = 11;
				}
				if (curFocusWnd == 12 || curFocusWnd == 13 || curFocusWnd == 14){
					curFocusWnd = 15;
				}
				SetFocusChild(WifiWnd[curFocusWnd]);		
				return 0;
			} else if (LOWORD(wParam)==SCANCODE_CURSORBLOCKUP){
				char tmpssid[128];
				if(curFocusWnd==0){
					GetWindowText(WifiWnd[0], tmpssid, sizeof(tmpssid));
					if(tmpssid && strlen(tmpssid)>0){
						if(hIMEWnd!=HWND_INVALID){
							SendMessage(hIMEWnd,MSG_CLOSE,0,0L);
							hIMEWnd=HWND_INVALID;
						}
						curFocusWnd--;
					}
				} else if (curFocusWnd==1) {
					if(hIMEWnd!=HWND_INVALID){
						SendMessage(hIMEWnd,MSG_CLOSE,0,0L);
						hIMEWnd=HWND_INVALID;
					}
					curFocusWnd--;
				
				} else if(--curFocusWnd<0){
					curFocusWnd=16;
				}

				if (wifidhcpflag == 1 && curFocusWnd == 14) {
					curFocusWnd= 2;
				}

				if (curFocusWnd == 10|| curFocusWnd == 11|| curFocusWnd == 12 ||curFocusWnd == 13 ){
					curFocusWnd = 7;
				} else if (curFocusWnd == 6|| curFocusWnd == 7|| curFocusWnd == 8 || curFocusWnd == 9){
					curFocusWnd = 3;
				} else if (curFocusWnd == 3 || curFocusWnd == 4 || curFocusWnd == 5){
					curFocusWnd = 2;
				} else if(curFocusWnd == 14){
					curFocusWnd = 11;
				}

				SetFocusChild(WifiWnd[curFocusWnd]);
				return 0;

			} else if(LOWORD(wParam)==SCANCODE_F9 || 
					((gOptions.TFTKeyLayout==0 || gOptions.TFTKeyLayout==4) && (LOWORD(wParam)==SCANCODE_F11))) {
				if((curFocusWnd==0 || curFocusWnd==1) && (gOptions.IMEFunOn==1 && gOptions.TFTKeyLayout!=3))
				{
					T9IMEWindow(hWnd,0,200,gOptions.LCDWidth, gOptions.LCDHeight,gOptions.HzImeOn);
				}
			} else if ((LOWORD(wParam)==SCANCODE_CURSORBLOCKLEFT) || (LOWORD(wParam)==SCANCODE_CURSORBLOCKRIGHT)
				|| ((gOptions.TFTKeyLayout==3) && LOWORD(wParam)==SCANCODE_BACKSPACE)) {

				if ((LOWORD(wParam)==SCANCODE_CURSORBLOCKRIGHT) && gOptions.IMEFunOn==1 
						&& gOptions.TFTKeyLayout==3 && (curFocusWnd==0 || curFocusWnd==1)) {
					T9IMEWindow(hWnd,0,200,gOptions.LCDWidth, gOptions.LCDHeight, 0);
					return 0;
				}

				if(curFocusWnd==2 && ((LOWORD(wParam)==SCANCODE_CURSORBLOCKLEFT || ((gOptions.TFTKeyLayout==3) && LOWORD(wParam)==SCANCODE_BACKSPACE))
					||LOWORD(wParam)==SCANCODE_CURSORBLOCKRIGHT)) {

					int tmpsel = SendMessage(WifiWnd[curFocusWnd], CB_GETCURSEL, 0, 0);		
					if (tmpsel == 0) {
						SendMessage(WifiWnd[curFocusWnd], CB_SETCURSEL, 1, 0);
						dhcpswitch(1);
						UpdateWindow(hWnd,TRUE);
						wifidhcpflag =1;
					} else {
						SendMessage(WifiWnd[curFocusWnd], CB_SETCURSEL, 0, 0);
						dhcpswitch(0);
						UpdateWindow(hWnd,TRUE);
						wifidhcpflag = 0;
					}
				}
				if (curFocusWnd >2 && curFocusWnd<15 && wifidhcpflag ==0) {
					if (LOWORD(wParam)==SCANCODE_CURSORBLOCKLEFT ){
						curFocusWnd --;
						if (curFocusWnd == 2){
							curFocusWnd =14;
						}
					}else if (LOWORD(wParam)==SCANCODE_CURSORBLOCKRIGHT){
						curFocusWnd ++;
						if (curFocusWnd ==15){
							curFocusWnd = 3;
						}
					}
					SetFocusChild(WifiWnd[curFocusWnd]);
				}
				return 0;	
			} else if ((LOWORD(wParam)==SCANCODE_ENTER) || (LOWORD(wParam)==SCANCODE_F10)) {
				char tmpssid[128];
				switch(curFocusWnd)
				{
					case 0:
						GetWindowText(WifiWnd[0], tmpssid, sizeof(tmpssid));
						if(tmpssid && strlen(tmpssid)>0)
							SendMessage(hWnd, MSG_COMMAND, WIFI_SAVE, 0);
						else
							MessageBox1(hWnd ,LoadStrByID(HIT_ERROR0) ,LoadStrByID(HIT_ERR),MB_OK | MB_ICONINFORMATION);
						break;
					case 16:		//exit
						SendMessage(hWnd, MSG_COMMAND, WIFI_EXIT, 0);
						break;
					default:
						SendMessage(hWnd, MSG_COMMAND, WIFI_SAVE, 0);
				}
				return 0;
			} else if(LOWORD(wParam)==SCANCODE_MENU) {
				SendMessage(hWnd, MSG_COMMAND, WIFI_SAVE, 0);
				return 0;
			}
			break;

		case MSG_COMMAND:
			id = LOWORD(wParam);
			nc = HIWORD(wParam);
			if(id==WIFI_SAVE) {
				if(isModified() && SaveNewWiFiSetting(hWnd)) {
					MessageBox1(hWnd ,LoadStrByID(HIT_RIGHT) ,LoadStrByID(HIT_RUN),MB_OK| MB_ICONINFORMATION);
					if(!ismenutimeout) {
						PostMessage(hWnd, MSG_CLOSE, 0, 0);
					}
				} else if(!ismenutimeout) {
					PostMessage(hWnd, MSG_CLOSE, 0, 0);
				}
			} else if (id==WIFI_EXIT) {
				if(isModified() && MessageBox1(hWnd,LoadStrByID(MID_SAVEDATA),LoadStrByID(MID_APPNAME),
					MB_OKCANCEL|MB_ICONQUESTION|MB_BASEDONPARENT)==IDOK) {
					PostMessage(hWnd, MSG_COMMAND, WIFI_SAVE, 0);
				} else if(!ismenutimeout) {
					PostMessage(hWnd, MSG_CLOSE, 0, 0);
				}
			}
			break;

		case MSG_CLOSE:
			if(hIMEWnd!=HWND_INVALID){
				SendMessage(hIMEWnd,MSG_CLOSE,0,0);
				hIMEWnd=HWND_INVALID;
			}

			UnloadBitmap(&wifibkg);
			//MainWindowCleanup(hWnd);
			DestroyMainWindow(hWnd);
			return 0;

	}
	return DefaultMainWinProc(hWnd,message,wParam,lParam);
}
예제 #24
0
/*
	编辑框回调函数
*/
static int EditProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
{
	int temp;
	int iVaue;
	int id;
	RECT rc;
	HDC hdc= (HDC)NULL;
	
	GetWindowRect(hWnd, &rc);	
	switch(message){
		case MSG_SETFOCUS:{
			hdc = GetClientDC(GetParent(hWnd));
			if(hdc != (HDC)NULL){
				SetPenColor(hdc, SETFOCUS_COLOR);
				Rectangle(hdc, rc.left-1, rc.top-1, rc.right+1, rc.bottom+1);
				Rectangle(hdc, rc.left-2, rc.top-2, rc.right+2, rc.bottom+2);
				ReleaseDC(hdc);
			}
		}break;
		case MSG_KILLFOCUS:{
			hdc = GetClientDC(GetParent(hWnd));
			if(hdc !=(HDC)NULL){
				SetPenColor(hdc, KILLFOCUS_COLOR);
				Rectangle(hdc, rc.left-1, rc.top-1, rc.right+1, rc.bottom+1);
				Rectangle(hdc, rc.left-2, rc.top-2, rc.right+2, rc.bottom+2);
				ReleaseDC(hdc);
			}
		}break;
		case MSG_KEYUP:{
			id = GetDlgCtrlID(hWnd);
			
			switch(wParam){
				case SCANCODE_CURSORBLOCKDOWN:{
					switch(id){
						case DID_IBP2_TOP:{
							if(iTmpScaleTop<IBP2_SCALE_MAX){
								iTmpScaleTop += IBP2_SCALE_INTER;
								SetScaleText(hWnd, iTmpScaleTop);			
							}
						}break;
						case DID_IBP2_BOTTOM:{
							if(iTmpScaleBottom < (iTmpScaleTop - IBP2_RANGE_MIN)){
								iTmpScaleBottom += IBP2_SCALE_INTER;
								SetScaleText(hWnd, iTmpScaleBottom);			
							}
						}break;
					}
				}break;
				case SCANCODE_CURSORBLOCKUP:{
					switch(id){
						case DID_IBP2_TOP:{
							if(iTmpScaleTop > (iTmpScaleBottom + IBP2_RANGE_MIN)){
								iTmpScaleTop -= IBP2_SCALE_INTER;
								SetScaleText(hWnd, iTmpScaleTop);			
							}
						}break;
						case DID_IBP2_BOTTOM:{
							if(iTmpScaleBottom >IBP2_SCALE_MIN){
								iTmpScaleBottom -= IBP2_SCALE_INTER;
								SetScaleText(hWnd, iTmpScaleBottom);			
							}
						}break;
					}
				}break;
				case SCANCODE_ENTER:{
					switch(id){
						case DID_IBP2_TOP:{
							gCfgIbp2.iScaleTop = iTmpScaleTop;
							SetIntValueToResFile(gFileSetup, "IBP2Setup", "scale_top",  gCfgIbp2.iScaleTop, 4);
							SetFocus(btnSetTop);
// 							ChangeWaveRange_Ibp1();
							ChangeWaveGain_Ibp2();
						}break;
						case DID_IBP2_BOTTOM:{
							gCfgIbp2.iScaleBottom = iTmpScaleBottom;
							SetIntValueToResFile(gFileSetup, "IBP2Setup", "scale_bottom",  gCfgIbp2.iScaleBottom, 4);
							SetFocus(btnSetBottom);
// 							ChangeWaveRange_Ibp1();
							ChangeWaveGain_Ibp2();
						}break;
					}	
					gbKeyType = KEY_TAB;
				}break;
			}
			return 0;
		}break;	
	}
	
	temp = (*OldEditProc)(hWnd, message, wParam, lParam);
	return(temp);
}		
예제 #25
0
/*
	列表框消息回调函数
*/
static int CobProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
{
	int temp;
	int id;
	int index;
	RECT rc;
	HDC hdc= (HDC)NULL;
	
	GetWindowRect(hWnd, &rc);	
	switch(message){
		case MSG_SETFOCUS:{
			hdc = GetClientDC(GetParent(hWnd));
			if(hdc != (HDC)NULL){
				SetPenColor(hdc, SETFOCUS_COLOR);
				Rectangle(hdc, rc.left-1, rc.top-1, rc.right+1, rc.bottom+1);
				Rectangle(hdc, rc.left-2, rc.top-2, rc.right+2, rc.bottom+2);
				ReleaseDC(hdc);
			}
		}break;
		case MSG_KILLFOCUS:{
			hdc = GetClientDC(GetParent(hWnd));
			if(hdc !=(HDC)NULL){
				SetPenColor(hdc, KILLFOCUS_COLOR);
				Rectangle(hdc, rc.left-1, rc.top-1, rc.right+1, rc.bottom+1);
				Rectangle(hdc, rc.left-2, rc.top-2, rc.right+2, rc.bottom+2);
				ReleaseDC(hdc);
			}
		}break;
	case MSG_COMMAND:{
		case MSG_KEYUP:{
			if(wParam==SCANCODE_ENTER||CBN_EDITCHANGE==HIWORD(wParam)){
					id = GetDlgCtrlID(hWnd);
					index = SendMessage(hWnd, CB_GETCURSEL, 0, 0);
						
					switch(id){
						case DID_IBP2_LABEL:{
							if(gCfgIbp2.bLabel != index){
								ChangeIbp2Lable(index);
							}
							gCfgIbp2.bLabel = index;
							SetIntValueToResFile(gFileSetup, "IBP2Setup", "label",  gCfgIbp2.bLabel, 1);
							ChangeWaveGain_Ibp2();
							SetFocus(btnSetLabel);
						}break;
						case DID_IBP2_UNIT:{
							gCfgIbp2.bUnit = index;
							SetIntValueToResFile(gFileSetup, "IBP2Setup", "unit",  gCfgIbp2.bUnit, 1);
							SetFocus(btnSetUnit);
							
							//根据单位设置标尺上下限
							SetScaleText(editTop, gCfgIbp2.iScaleTop);		
							SetScaleText(editBottom, gCfgIbp2.iScaleBottom);		
						}break;
						case DID_IBP2_VIEW:{
							gCfgIbp2.bViewMode = index;
							SetIntValueToResFile(gFileSetup, "IBP2Setup", "view_mode",  gCfgIbp2.bViewMode, 1);
							SetFocus(btnSetView);
							//改变显示模式
							ChangeIbp2ViewMode();
						}break;
						case DID_IBP2_SPEED:{
							gCfgIbp2.bScanSpeed = index+1;
							SetIntValueToResFile(gFileSetup, "IBP2Setup", "scan_speed",  gCfgIbp2.bScanSpeed, 1);
							SetFocus(btnSetSpeed);

							ChangeWaveSpeed_Ibp2();
						}break;
						case DID_IBP2_SET_FILTER:{
							gCfgIbp2.bFilterMode= index;
							SetIntValueToResFile(gFileSetup, "IBP2Setup", "filter_mode",  gCfgIbp2.bFilterMode, 1);
							ChangeFilter_Ibp2();
							SetFocus(btnSetFilter);
							}break;
					}	
					gbKeyType = KEY_TAB;
				}break;
			}
			return 0;
		}break;	
	}	
	temp = (*OldCobProc)(hWnd, message, wParam, lParam);
	return(temp);
}
예제 #26
0
static int boardwinproc(HWND  hWnd, int message, WPARAM wParam, LPARAM lParam)
{
	HDC hdc;
	char sstr[20];
	static char keyupFlag=0;
	int tmpvalue = 0;
	switch (message)
	{
		case MSG_CREATE:
			LoadBitmap(HDC_SCREEN,&smsshowbk,GetBmpPath("sms.jpg"));
			LoadBitmap(HDC_SCREEN,&barbmp, GetBmpPath("bar.bmp"));
			LoadBitmap(HDC_SCREEN,&smsshowbmp1,GetBmpPath("left2.gif"));
			LoadBitmap(HDC_SCREEN,&smsshowbmp2,GetBmpPath("right2.gif"));

			if (gfont==NULL)
			{
				smsshowfont = CreateLogFont (NULL,"fixed","GB2312",FONT_WEIGHT_REGULAR, FONT_SLANT_ROMAN, FONT_SETWIDTH_NORMAL,
						FONT_SPACING_CHARCELL, FONT_UNDERLINE_NONE, FONT_STRUCKOUT_NONE,10, 0);
				titlefont = CreateLogFont (NULL,"fixed","GB2312",FONT_WEIGHT_REGULAR, FONT_SLANT_ROMAN, FONT_SETWIDTH_NORMAL,
						FONT_SPACING_CHARCELL, FONT_UNDERLINE_NONE, FONT_STRUCKOUT_NONE,12, 0);
			}
			else
			{
				smsshowfont=gfont;
				titlefont=gfont1;
			}
			LoadsshowHint();
			InitWindow(hWnd);		//add controls
			curIdx=1;
			ShowMessage(hWnd,GetSmsPIN(curIdx));

			exitcount = 0;
#ifdef ZEM600
			SetTimer(hWnd,IDC_TIMERSMS,50);
#else
			SetTimer(hWnd,IDC_TIMERSMS,100);
#endif
			break;

		case MSG_PAINT:
			hdc=BeginPaint(hWnd);

			//write title
			SelectFont(hdc,titlefont);
			SetTextColor(hdc,PIXEL_lightwhite);
			tmpvalue = SetBkMode(hdc,BM_TRANSPARENT);
			memset(sstr,0,20);
			sprintf(sstr,"%s",sshowhint[0]);
			TextOut(hdc,140,15,sstr);

			//                        SetBkColor(hdc,0x00FFA2BE);
			//SelectFont(hdc,smsshowfont);
			SelectFont(hdc,titlefont);
			SetTextColor(hdc,PIXEL_lightwhite);

			memset(sstr,0,20);
			if (fromRight)
				sprintf(sstr,"%s",sshowhint[1]);
			else
				sprintf(sstr,"%s:",sshowhint[1]);
			TextOut(hdc,5,220,sstr);
			FillBoxWithBitmap (hdc, 65, 218,16, 16, &smsshowbmp1);

			memset(sstr,0,20);
			if (fromRight)
				sprintf(sstr,"%s",sshowhint[2]);
			else
				sprintf(sstr,"%s:",sshowhint[2]);
			TextOut(hdc,90,220,sstr);
			FillBoxWithBitmap (hdc, 140, 218,16, 16, &smsshowbmp2);

			memset(sstr,0,20);
			if (fromRight)
				sprintf(sstr,"%s%d:%s,%s%d:%s",sshowhint[3],bsmscount,sshowhint[4],sshowhint[5],curIdx,sshowhint[4]);
			else
				sprintf(sstr,"%s:%d%s,%s:%d%s",sshowhint[3],bsmscount,sshowhint[4],sshowhint[5],curIdx,sshowhint[4]);
			TextOut(hdc,170,220,sstr);

			EndPaint(hWnd,hdc);
			break;

		case MSG_ERASEBKGND:
			{
				HDC hdc = (HDC)wParam;
				const RECT* clip = (const RECT*)lParam;
				BOOL fGetDC = FALSE;
				RECT rcTemp;
				if(hdc == 0)
				{
					hdc = GetClientDC(hWnd);
					fGetDC = TRUE;
				}

				if(clip)
				{
					rcTemp = *clip;
					ScreenToClient(hWnd, &rcTemp.left, &rcTemp.top);
					ScreenToClient(hWnd,&rcTemp.right, &rcTemp.bottom);
					IncludeClipRect(hdc, &rcTemp);
				}

				FillBoxWithBitmap (hdc, 0, 0, gOptions.LCDWidth, gOptions.LCDHeight-30, &smsshowbk);
				FillBoxWithBitmap (hdc, 0, 210, gOptions.LCDWidth,30,&barbmp);

				if(fGetDC) ReleaseDC (hdc);
				break;
			}

		case MSG_KEYUP:
			if(3 == gOptions.TFTKeyLayout)
			{
				keyupFlag=1;
			}
			break;
		case MSG_KEYDOWN:
			SetMenuTimeOut(time(NULL));
			if(3 == gOptions.TFTKeyLayout)
			{
				if(1==keyupFlag)
					keyupFlag=0;
				else
					break;
			}
			exitcount=0;

			if ((LOWORD(wParam)==SCANCODE_ESCAPE))
				PostMessage(hWnd,MSG_CLOSE,0,0L);

			/*SMS快捷键查看,modify by yangxiaolong,start*/
			//del
			/*
			   if(LOWORD(wParam)==SCANCODE_CURSORBLOCKDOWN || LOWORD(wParam)==SCANCODE_CURSORBLOCKUP)
			   {
			   SendMessage(EdText,MSG_KEYDOWN,wParam,lParam);
			   }*/
			//add
			//快捷键查看SMS时,上下键翻动换行反应缓慢,调成翻页处理
			if(LOWORD(wParam)==SCANCODE_CURSORBLOCKDOWN)
			{
				SendMessage(EdText,MSG_KEYDOWN,SCANCODE_PAGEDOWN,lParam);
			}
			else if (LOWORD(wParam)==SCANCODE_CURSORBLOCKUP)
			{
				SendMessage(EdText,MSG_KEYDOWN,SCANCODE_PAGEUP,lParam);
			}
			/*SMS快捷键查看,modify by yangxiaolong,end*/	

			if(LOWORD(wParam)==SCANCODE_F11)
				SendMessage(EdText,MSG_KEYDOWN,SCANCODE_PAGEUP,lParam);
			if(LOWORD(wParam)==SCANCODE_F12)
				SendMessage(EdText,MSG_KEYDOWN,SCANCODE_PAGEDOWN,lParam);

			//if(LOWORD(wParam)==SCANCODE_CURSORBLOCKLEFT && bsmscount>1)
			if((LOWORD(wParam)==SCANCODE_CURSORBLOCKLEFT || (LOWORD(wParam)==SCANCODE_BACKSPACE && 3==gOptions.TFTKeyLayout)) && bsmscount>1)
			{
				if(--curIdx < 1) curIdx = bsmscount;
				ShowMessage(hWnd,GetSmsPIN(curIdx));
			}

			if(LOWORD(wParam)==SCANCODE_CURSORBLOCKRIGHT && bsmscount>1)
			{
				if(++curIdx > bsmscount) curIdx = 1;
				ShowMessage(hWnd,GetSmsPIN(curIdx));
			}

			break;

		case MSG_TIMER:
			if(wParam==IDC_TIMERSMS)
			{
				if(++exitcount>60) SendMessage(hWnd,MSG_CLOSE,0,0);
			}
			break;

		case MSG_CLOSE:
			UnloadBitmap(&smsshowbk);
			UnloadBitmap(&barbmp);
			UnloadBitmap(&smsshowbmp1);
			UnloadBitmap(&smsshowbmp2);
			if (gfont1==NULL)
			{
				DestroyLogFont(smsshowfont);
				DestroyLogFont(titlefont);
			}
			KillTimer(hWnd,IDC_TIMERSMS);
			freeList();
			DestroyMainWindow(hWnd);
			//hSMSWnd=NULL;
			break;

		default:
			return DefaultMainWinProc(hWnd,message,wParam,lParam);

	}
	return (0);

}
예제 #27
0
BOOL GUIAPI SetCaretPos (HWND hWnd, int x, int y)
{
    PMAINWIN pWin;

    pWin = (PMAINWIN)hWnd;

    if (!pWin->pCaretInfo)
        return FALSE;

    if (pWin->pCaretInfo->fBlink) {
        if (pWin->pCaretInfo->fShow) {
        
            HDC hdc;

            // hide caret first
            hdc = GetClientDC (hWnd);
#ifdef _USE_NEWGAL
            pWin->pCaretInfo->caret_bmp.bmBits = pWin->pCaretInfo->pNormal;
            FillBoxWithBitmap (hdc,
                        pWin->pCaretInfo->x, pWin->pCaretInfo->y, 0, 0, 
                        &pWin->pCaretInfo->caret_bmp);
#else
            PutSavedBoxOnDC (hdc, 
                        pWin->pCaretInfo->x, pWin->pCaretInfo->y,
                        pWin->pCaretInfo->nEffWidth,
                        pWin->pCaretInfo->nEffHeight,
                        pWin->pCaretInfo->pNormal);
#endif /* _USE_NEWGAL */

            // then update position
            pWin->pCaretInfo->x = x;
            pWin->pCaretInfo->y = y;

            // save normal bitmap first
            GetCaretBitmaps (pWin->pCaretInfo);
            
            // show caret again
#ifdef _USE_NEWGAL
            pWin->pCaretInfo->caret_bmp.bmBits = pWin->pCaretInfo->pXored;
            FillBoxWithBitmap (hdc,
                        pWin->pCaretInfo->x, pWin->pCaretInfo->y, 0, 0, 
                        &pWin->pCaretInfo->caret_bmp);
#else
            PutSavedBoxOnDC (hdc, 
                        pWin->pCaretInfo->x, pWin->pCaretInfo->y,
                        pWin->pCaretInfo->nEffWidth,
                        pWin->pCaretInfo->nEffHeight,
                        pWin->pCaretInfo->pXored);
#endif /* _USE_NEWGAL */

            ReleaseDC (hdc);
        }
        else {
            HDC hdc;
        
            // update position
            pWin->pCaretInfo->x = x;
            pWin->pCaretInfo->y = y;

            // save normal bitmap first
            GetCaretBitmaps (pWin->pCaretInfo);

            // show caret
            hdc = GetClientDC (hWnd);
#ifdef _USE_NEWGAL
            pWin->pCaretInfo->caret_bmp.bmBits = pWin->pCaretInfo->pXored;
            FillBoxWithBitmap (hdc,
                        pWin->pCaretInfo->x, pWin->pCaretInfo->y, 0, 0, 
                        &pWin->pCaretInfo->caret_bmp);
#else
            PutSavedBoxOnDC (hdc, 
                        pWin->pCaretInfo->x, pWin->pCaretInfo->y,
                        pWin->pCaretInfo->nEffWidth,
                        pWin->pCaretInfo->nEffHeight,
                        pWin->pCaretInfo->pXored);
#endif /* _USE_NEWGAL */

            ReleaseDC (hdc);

            pWin->pCaretInfo->fShow = TRUE;
        }
    }
    else {
        // update position
        pWin->pCaretInfo->x = x;
        pWin->pCaretInfo->y = y;
    }

    return TRUE;
}
예제 #28
0
BOOL GUIAPI ChangeCaretSize (HWND hWnd, int newWidth, int newHeight)
{
    PMAINWIN pWin;

    pWin = (PMAINWIN)hWnd;

    if (!pWin->pCaretInfo)
        return FALSE;
    
#ifdef _USE_NEWGAL
    if (newWidth == pWin->pCaretInfo->caret_bmp.bmWidth
            && newHeight == pWin->pCaretInfo->caret_bmp.bmHeight)
        return TRUE;
#else
    if (newWidth == pWin->pCaretInfo->nEffWidth
            && newHeight == pWin->pCaretInfo->nEffHeight)
        return TRUE;
#endif /* _USE_NEWGAL */
        
    if (newWidth > pWin->pCaretInfo->nWidth
            || newHeight > pWin->pCaretInfo->nHeight
            || newWidth <= 0 || newHeight <= 0)
        return FALSE;

    if (pWin->pCaretInfo->fBlink) {
        if (pWin->pCaretInfo->fShow) {
        
            HDC hdc;

            // hide caret first
            hdc = GetClientDC (hWnd);
#ifdef _USE_NEWGAL
            pWin->pCaretInfo->caret_bmp.bmBits = pWin->pCaretInfo->pNormal;
            FillBoxWithBitmap (hdc,
                        pWin->pCaretInfo->x, pWin->pCaretInfo->y, 0, 0, 
                        &pWin->pCaretInfo->caret_bmp);
#else
            PutSavedBoxOnDC (hdc, 
                        pWin->pCaretInfo->x, pWin->pCaretInfo->y,
                        pWin->pCaretInfo->nEffWidth,
                        pWin->pCaretInfo->nEffHeight,
                        pWin->pCaretInfo->pNormal);
#endif /* _USE_NEWGAL */

            // then update size info
#ifdef _USE_NEWGAL
            pWin->pCaretInfo->caret_bmp.bmWidth = newWidth;
            pWin->pCaretInfo->caret_bmp.bmHeight= newHeight;
            pWin->pCaretInfo->nBytesNr = pWin->pCaretInfo->caret_bmp.bmPitch * newHeight;
#else
            pWin->pCaretInfo->nEffWidth = newWidth;
            pWin->pCaretInfo->nEffHeight = newHeight;
            pWin->pCaretInfo->nBytesNr = newWidth * newHeight * BYTESPERPHYPIXEL;
#endif /* _USE_NEWGAL */

            // save normal bitmap first
            GetCaretBitmaps (pWin->pCaretInfo);
            
            // show caret again
#ifdef _USE_NEWGAL
            pWin->pCaretInfo->caret_bmp.bmBits = pWin->pCaretInfo->pXored;
            FillBoxWithBitmap (hdc,
                        pWin->pCaretInfo->x, pWin->pCaretInfo->y, 0, 0, 
                        &pWin->pCaretInfo->caret_bmp);
#else
            PutSavedBoxOnDC (hdc, 
                        pWin->pCaretInfo->x, pWin->pCaretInfo->y,
                        pWin->pCaretInfo->nEffWidth,
                        pWin->pCaretInfo->nEffHeight,
                        pWin->pCaretInfo->pXored);
#endif /* _USE_NEWGAL */

            ReleaseDC (hdc);
        }
        else {
            HDC hdc;
        
            // then update size info
#ifdef _USE_NEWGAL
            pWin->pCaretInfo->caret_bmp.bmWidth = newWidth;
            pWin->pCaretInfo->caret_bmp.bmHeight= newHeight;
            pWin->pCaretInfo->nBytesNr = pWin->pCaretInfo->caret_bmp.bmPitch * newHeight;
#else
            pWin->pCaretInfo->nEffWidth = newWidth;
            pWin->pCaretInfo->nEffHeight = newHeight;
            pWin->pCaretInfo->nBytesNr = newWidth * newHeight * BYTESPERPHYPIXEL;
#endif /* _USE_NEWGAL */

            // save normal bitmap first
            GetCaretBitmaps (pWin->pCaretInfo);

            // show caret
            hdc = GetClientDC (hWnd);
#ifdef _USE_NEWGAL
            pWin->pCaretInfo->caret_bmp.bmBits = pWin->pCaretInfo->pXored;
            FillBoxWithBitmap (hdc,
                        pWin->pCaretInfo->x, pWin->pCaretInfo->y, 0, 0, 
                        &pWin->pCaretInfo->caret_bmp);
#else
            PutSavedBoxOnDC (hdc, 
                        pWin->pCaretInfo->x, pWin->pCaretInfo->y,
                        pWin->pCaretInfo->nEffWidth,
                        pWin->pCaretInfo->nEffHeight,
                        pWin->pCaretInfo->pXored);
#endif /* _USE_NEWGAL */

            ReleaseDC (hdc);

            pWin->pCaretInfo->fShow = TRUE;
        }
    }
    else {
        // update size info
#ifdef _USE_NEWGAL
        pWin->pCaretInfo->caret_bmp.bmWidth = newWidth;
        pWin->pCaretInfo->caret_bmp.bmHeight= newHeight;
        pWin->pCaretInfo->nBytesNr = pWin->pCaretInfo->caret_bmp.bmPitch * newHeight;
#else
        pWin->pCaretInfo->nEffWidth  = newWidth;
        pWin->pCaretInfo->nEffHeight = newHeight;
        pWin->pCaretInfo->nBytesNr = newWidth * newHeight * BYTESPERPHYPIXEL;
#endif
    }

    return TRUE;
}
예제 #29
0
/*
	编辑框回调函数
*/
static int EditProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
{
	int temp;
	int iVaue;
	int id;
	RECT rc;
	HDC hdc= (HDC)NULL;
	
	GetWindowRect(hWnd, &rc);
	switch(message){
		case MSG_SETFOCUS:{
			hdc = GetClientDC(GetParent(hWnd));
			if(hdc != (HDC)NULL){
				SetPenColor(hdc, SETFOCUS_COLOR);
				Rectangle(hdc, rc.left-1, rc.top-1, rc.right+1, rc.bottom+1);
				Rectangle(hdc, rc.left-2, rc.top-2, rc.right+2, rc.bottom+2);
				ReleaseDC(hdc);
			}
		}break;
		case MSG_KILLFOCUS:{
			hdc = GetClientDC(GetParent(hWnd));
			if(hdc !=(HDC)NULL){
				SetPenColor(hdc, KILLFOCUS_COLOR);
				Rectangle(hdc, rc.left-1, rc.top-1, rc.right+1, rc.bottom+1);
				Rectangle(hdc, rc.left-2, rc.top-2, rc.right+2, rc.bottom+2);
				ReleaseDC(hdc);
			}
		}break;
		case MSG_KEYUP:{
			id = GetDlgCtrlID(hWnd);
			
			switch(wParam){
				case SCANCODE_CURSORBLOCKDOWN:{
					switch(id){
 						case DID_CO2SET_HIGH_ETCO2:{
 							if(iTmpHigh_EtCO2 <CO2_LIMIT_MAX){
								iTmpHigh_EtCO2 += CO2_LIMIT_INTER;
								SetLimitText(gCfgCO2.bUnit, hWnd, iTmpHigh_EtCO2, 0);			
							}
						}break;
						case DID_CO2SET_LOW_ETCO2:{
							if(iTmpLow_EtCO2 < (iTmpHigh_EtCO2 - CO2_LIMITRANGE_MIN)){
								iTmpLow_EtCO2 += CO2_LIMIT_INTER;
								SetLimitText(gCfgCO2.bUnit, hWnd, iTmpLow_EtCO2, 0);			
							}
						}break;
						case DID_CO2SET_HIGH_FICO2:{
							if(iTmpHigh_FiCO2 < CO2_LIMIT_MAX){
								iTmpHigh_FiCO2 += CO2_LIMIT_INTER;
								SetLimitText(gCfgCO2.bUnit, hWnd, iTmpHigh_FiCO2, 0);			
							}
						}break;
						case DID_CO2SET_HIGH_RR:{
							if(iTmpHigh_RR <RR_LIMIT_MAX){
								iTmpHigh_RR += RR_LIMIT_INTER;
								SetLimitText(gCfgCO2.bUnit, hWnd, iTmpHigh_RR, 1);			
							}
						}break;
						case DID_CO2SET_LOW_RR:{
							if(iTmpLow_RR < (iTmpHigh_RR - RR_LIMITRANGE_MIN)){
								iTmpLow_RR += RR_LIMIT_INTER;
								SetLimitText(gCfgCO2.bUnit, hWnd, iTmpLow_RR, 1);			
							}
						}break;
						case DID_CO2SET_APNEA:{
							if(iTmpApnea <APNEA_LIMIT_MAX){
								iTmpApnea += APNEA_LIMIT_INTER;
								SetLimitText(gCfgCO2.bUnit, hWnd, iTmpApnea, 2);			
							}
						}break;
					}
				}break;
				case SCANCODE_CURSORBLOCKUP:{
					switch(id){
						case DID_CO2SET_HIGH_ETCO2:{
							if(iTmpHigh_EtCO2 > (iTmpLow_EtCO2 + CO2_LIMITRANGE_MIN)){
								iTmpHigh_EtCO2 -= CO2_LIMIT_INTER;
								SetLimitText(gCfgCO2.bUnit, hWnd, iTmpHigh_EtCO2, 0);			
							}
						}break;
						case DID_CO2SET_LOW_ETCO2:{
							if(iTmpLow_EtCO2 > CO2_LIMIT_MIN){
								iTmpLow_EtCO2 -= CO2_LIMIT_INTER;
								SetLimitText(gCfgCO2.bUnit, hWnd, iTmpLow_EtCO2, 0);			
							}
						}break;
						case DID_CO2SET_HIGH_FICO2:{
							if(iTmpHigh_FiCO2 > CO2_LIMIT_MIN){
								iTmpHigh_FiCO2 -= CO2_LIMIT_INTER;
								SetLimitText(gCfgCO2.bUnit, hWnd, iTmpHigh_FiCO2, 0);			
							}
						}break;
						case DID_CO2SET_HIGH_RR:{
							if(iTmpHigh_RR > (iTmpLow_RR + RR_LIMITRANGE_MIN)){
								iTmpHigh_RR -= RR_LIMIT_INTER;
								SetLimitText(gCfgCO2.bUnit, hWnd, iTmpHigh_RR, 1);			
							}
						}break;
						case DID_CO2SET_LOW_RR:{
							if(iTmpLow_RR >RR_LIMIT_MIN){
								iTmpLow_RR -= RR_LIMIT_INTER;
								SetLimitText(gCfgCO2.bUnit, hWnd, iTmpLow_RR, 1);			
							}
						}break;
						case DID_CO2SET_APNEA:{
							if(iTmpApnea > APNEA_LIMIT_MIN){
								iTmpApnea -= APNEA_LIMIT_INTER;
								SetLimitText(gCfgCO2.bUnit, hWnd, iTmpApnea, 2);			
							}
						}break;
					}
				}break;
				case SCANCODE_ENTER:{
					switch(id){
						case DID_CO2SET_HIGH_ETCO2:{
							gCfgCO2.wHigh_EtCO2= iTmpHigh_EtCO2;
							SetIntValueToResFile(gFileSetup, "CO2Setup", "etco2_high",  gCfgCO2.wHigh_EtCO2, 4);
							SetFocus(btnSetHigh_EtCO2);
						}break;
						case DID_CO2SET_LOW_ETCO2:{
							gCfgCO2.wLow_EtCO2 = iTmpLow_EtCO2;
							SetIntValueToResFile(gFileSetup, "CO2Setup", "etco2_low",  gCfgCO2.wLow_EtCO2, 4);
							SetFocus(btnSetLow_EtCO2);
						}break;
						case DID_CO2SET_HIGH_FICO2:{
							gCfgCO2.wHigh_FiCO2 = iTmpHigh_FiCO2;
							SetIntValueToResFile(gFileSetup, "CO2Setup", "fico2_high",  gCfgCO2.wHigh_FiCO2, 4);
							SetFocus(btnSetHigh_FiCO2);
						}break;
						case DID_CO2SET_HIGH_RR:{
							gCfgCO2.wHigh_awRR = iTmpHigh_RR;
							SetIntValueToResFile(gFileSetup, "CO2Setup", "awrr_high",  gCfgCO2.wHigh_awRR, 4);
							SetFocus(btnSetHigh_RR);
						}break;
						case DID_CO2SET_LOW_RR:{
							gCfgCO2.wLow_awRR = iTmpLow_RR;
							SetIntValueToResFile(gFileSetup, "CO2Setup", "awrr_low",  gCfgCO2.wLow_awRR, 4);
							SetFocus(btnSetLow_RR);
						}break;
						case DID_CO2SET_APNEA:{
							gCfgCO2.wApneaTime = iTmpApnea;
							SetIntValueToResFile(gFileSetup, "CO2Setup", "apnea_time",  gCfgCO2.wApneaTime, 4);
							SetFocus(btnSetApnea);
						}break;
					}	
					gbKeyType = KEY_TAB;
				}break;
			}
			return 0;
		}break;	
	}
	
	temp = (*OldEditProc)(hWnd, message, wParam, lParam);
	return(temp);
}
예제 #30
0
static int HelloWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
{
HDC hdc;
static HWND hwnd;
static int i = 0;
switch (message) {
case MSG_PAINT:
hdc = BeginPaint (hWnd);
TextOut (hdc, 60, 60, "Hello world!");
EndPaint (hWnd, hdc);
return 0;
case 888888888888888888:
        {

            HDC hdc2 = (HDC)wParam;
            const RECT* clip = (const RECT*) lParam;
            BOOL fGetDC = FALSE;
            RECT rcTemp;

            if (hdc2 == 0) {
                hdc2 = GetClientDC (hWnd);
                fGetDC = TRUE;
            }

            if (clip) {
                rcTemp = *clip;
                ScreenToClient (hWnd, &rcTemp.left, &rcTemp.top);
                ScreenToClient (hWnd, &rcTemp.right, &rcTemp.bottom);
                IncludeClipRect (hdc2, &rcTemp);
            }

            FillBoxWithBitmap (HDC_SCREEN, 0, 0, 0, 0, &bmp_bkgnd);

            if (fGetDC)
                ReleaseDC (hdc2);
            return 0;
        }
        break;
case MSG_CREATE:
	hwnd = CreateWindowEx("static", "",
			WS_CHILD | WS_VISIBLE,
			WS_EX_NONE,
			123,
			0, 0, 50, 50,
			hWnd, NULL);
	SetWindowBkColor(hwnd, RGBA2Pixel(HDC_SCREEN, 0x00, 0x00, 0xff, 0x10));
break;
case MSG_KEYDOWN:
	if (i) {
	SetWindowBkColor(hwnd, RGBA2Pixel(HDC_SCREEN, 0x00, 0x00, 0xff, 0x10));
	} else {
	SetWindowBkColor(hwnd, RGB2Pixel(HDC_SCREEN, 0x00, 0xff, 0xff));
	}
	i = 1-i;
break;
case MSG_CLOSE:
DestroyMainWindow (hWnd);
PostQuitMessage (hWnd);
return 0;

}
return DefaultMainWinProc (hWnd, message, wParam, lParam);
}