예제 #1
0
//flag=0: Enroll , flag=1: Verify
int CreateFaceEnrollWindow(HWND hWnd, int pin)
{
	MSG msg;
	HWND hMainWnd;
	MAINWINCREATE CreateInfo;

	if(0==InitFaceEnroll())
        	return 0;

	f_pin=pin;
	regok=0;

	SetMenuTimeOut(time(NULL));
	ismenutimeout=0;

	hWnd = GetMainWindowHandle(hWnd);
	CreateInfo.dwStyle = WS_VISIBLE ;
	CreateInfo.dwExStyle = WS_EX_NONE;
	CreateInfo.spCaption = "Face";
	CreateInfo.hMenu = 0;
//	CreateInfo.hCursor = GetSystemCursor(0);
	CreateInfo.hIcon = 0;
        CreateInfo.MainWindowProc = FaceEnrollWinProc;
        CreateInfo.lx = 0;
        CreateInfo.ty = 0;
        CreateInfo.rx = g_rcScr.right;
        CreateInfo.by = g_rcScr.bottom;
        CreateInfo.iBkColor = 0x00FFA2BE;
        CreateInfo.dwAddData = 0;
        CreateInfo.hHosting = hWnd;
	
	LoadBitmap(HDC_SCREEN, &fvbg, GetBmpPath("mainmenu.jpg"));
	LoadBitmap(HDC_SCREEN, &fvbar, GetBmpPath("bar.bmp"));

        hMainWnd = CreateMainWindow(&CreateInfo);
        if (hMainWnd == HWND_INVALID)
	{
		UnloadBitmap(&fvbg);
		UnloadBitmap(&fvbar);
                return 0;
	}

        ShowWindow(hMainWnd, SW_SHOWNORMAL);
        while (GetMessage(&msg, hMainWnd))
        {
                TranslateMessage(&msg);
                DispatchMessage(&msg);
        }

        MainWindowThreadCleanup(hMainWnd);
	UnloadBitmap(&fvbg);
	UnloadBitmap(&fvbar);
        return regok;
}
    //------------------------------------------------------------------------
    bool platform_support::load_img(unsigned idx, const char* file)
    {
        if(idx < max_images) {

#ifndef _MG_MINIMALGRAF
            if(m_specific->m_surf_img[idx]) 
                UnloadBitmap(m_specific->m_surf_img[idx]);
            else
                m_specific->m_surf_img[idx] = (PBITMAP)calloc(1, sizeof(BITMAP)); 

            if (LoadBitmapFromFile(m_specific->m_surf_window, 
                        m_specific->m_surf_img[idx], file) != 0)
                return false;
#endif
#if 0
            FillBoxWithBitmap(m_specific->m_surf_window, 0, 0, 0, 0, 
                    m_specific->m_surf_img[idx]);
#endif

#if 0
            printf("load img: w=%d, h=%d, pitch=%d, pixels=%x\n", 
                    m_specific->m_surf_img[idx]->bmWidth, 
                    m_specific->m_surf_img[idx]->bmHeight, 
                    m_specific->m_surf_img[idx]->bmPitch, 
                    m_specific->m_surf_img[idx]->bmBits);
#endif
            m_rbuf_img[idx].attach(m_specific->m_surf_img[idx]->bmBits, 
                    m_specific->m_surf_img[idx]->bmWidth, 
                    m_specific->m_surf_img[idx]->bmHeight, 
                    m_flip_y?(-m_specific->m_surf_img[idx]->bmPitch):
                            m_specific->m_surf_img[idx]->bmPitch);
            return true;
        }
        return false;
    }
예제 #3
0
void
ListboxControlCleanup()
{
#if 0
	UnloadBitmap(&sg_bmpCheckMark);
#endif
}
예제 #4
0
/***************************Bitmap Support***************************/
static BOOL LoadBitmapRes (void)
{
    int i, nBmpNr, size;
    char *temp;
    BITMAP bmp;
    char szValue [12];

    if (GetMgEtcValue ("bitmapinfo", "bitmapnumber", szValue, 10) < 0)
        return FALSE;

    nBmpNr = atoi(szValue);
    if (nBmpNr <= 0) return FALSE;
    nBmpNr = nBmpNr < SYSBMP_ITEM_NUMBER ? nBmpNr : SYSBMP_ITEM_NUMBER;

    ((PG_RES)mgSharedRes)->bmpnum    = nBmpNr;
    ((PG_RES)mgSharedRes)->bmpoffset = mgSizeRes;

    for (i = 0; i < nBmpNr; i++) {
        sprintf (szValue, "bitmap%d", i);
        if (!LoadSystemBitmap (&bmp, szValue))
            return FALSE;

#ifdef _USE_NEWGAL
        size = bmp.bmHeight * bmp.bmPitch;
#else
        size = bmp.bmHeight * bmp.bmWidth * BYTESPERPHYPIXEL;
#endif
        if ((mgSharedRes = realloc (mgSharedRes, mgSizeRes + size + sizeof (BITMAP))) == NULL) {
            UnloadBitmap (&bmp);
            perror ("realloc shared memory for system bitmap");
            return FALSE;
        }

        temp= (char*)mgSharedRes + mgSizeRes;
        memcpy (temp, &bmp, sizeof(BITMAP));
        temp += sizeof (BITMAP);
        memcpy (temp, bmp.bmBits, size);

        mgSizeRes += size;
        mgSizeRes += sizeof (BITMAP);

        UnloadBitmap (&bmp);
    }

    return TRUE;
}
void free_picture(picture* p)
{
    if (!p)
        return;

    ps_image_unref(p->image);
    UnloadBitmap(((BITMAP*)p->native));
    free(p->native);
    free(p);
}
    bool platform_support::load_img_from_dc(unsigned idx, HDC hdc)
    {
        if(idx < max_images) 
        {
#ifndef _MG_MINIMALGRAF
            if(m_specific->m_surf_img[idx]) 
                UnloadBitmap(m_specific->m_surf_img[idx]);
            else
                m_specific->m_surf_img[idx] = (PBITMAP)calloc(1, sizeof(BITMAP)); 
#endif

#if 0
            if (LoadBitmapFromMem(m_specific->m_surf_window, 
                                m_specific->m_surf_img[idx], 
                                (const void *)LockDC(hdc, NULL, NULL, NULL, NULL), 
                                0,
                                "bmp") != 0)
#else
            HDC tmpdc = CreateCompatibleDC(m_specific->m_surf_window);
            if(tmpdc == HDC_INVALID)
                return false;

            BitBlt(hdc, 0, 0, 0, 0, tmpdc, 0, 0, 0);
            if ( !GetBitmapFromDC(tmpdc, 
                            0, 0, 240, 320, 
                            m_specific->m_surf_img[idx]) )
#endif
            {
                DeleteCompatibleDC(tmpdc);
                return false;
            }

            DeleteCompatibleDC(tmpdc);
#if 0
            FillBoxWithBitmap(HDC_SCREEN, 350, 0, 0, 0, 
                    m_specific->m_surf_img[idx]);
            //BitBlt(hdc, 0, 0, 0, 0, HDC_SCREEN, 500, 0, true);
#endif

#if 0
            printf("load img: w=%d, h=%d, pitch=%d, pixels=%x\n", 
                    m_specific->m_surf_img[idx]->bmWidth, 
                    m_specific->m_surf_img[idx]->bmHeight, 
                    m_specific->m_surf_img[idx]->bmPitch, 
                    m_specific->m_surf_img[idx]->bmBits);
#endif
            m_rbuf_img[idx].attach(m_specific->m_surf_img[idx]->bmBits, 
                    m_specific->m_surf_img[idx]->bmWidth, 
                    m_specific->m_surf_img[idx]->bmHeight, 
                    m_flip_y?(-m_specific->m_surf_img[idx]->bmPitch):
                            m_specific->m_surf_img[idx]->bmPitch);
            return true;
        }
        return false;
    }
static void this_deinit(void* context)
{
    if(((Context *)context)->bg) 
        UnloadBitmap (((Context *)context)->bg);

    free_dsp_app ();

	if (context != NULL) free(context);

    return;
}
static void load_scenario (const char *fname)
{
    UnloadBitmap (&stones);
    if (LoadBitmap (HDC_SCREEN, &stones, fname)) {
        printf ("Loading scenario failed: %s.\n", fname);
        exit (1);
    }

    configure_sync (fname);

    nstones = stones.bmWidth / STONE_SIZE;
    ncolors = 3;
}
    bool platform_support::load_img_from_bitmap(unsigned idx, PBITMAP pbmp)
    {
        if(idx < max_images) 
        {
            int ret = FALSE;

#ifndef _MG_MINIMALGRAF
            if(m_specific->m_surf_img[idx]) 
                UnloadBitmap(m_specific->m_surf_img[idx]);
            else
                m_specific->m_surf_img[idx] = (PBITMAP)calloc(1, sizeof(BITMAP)); 
#endif

            HDC tmpdc = CreateCompatibleDC(m_specific->m_surf_window);
            HDC tmpdc2 = CreateCompatibleDC(HDC_SCREEN);

            if(tmpdc == HDC_INVALID)
                return false;

            FillBoxWithBitmap(tmpdc2, 0, 0, pbmp->bmWidth, pbmp->bmHeight, 
                    pbmp);

            BitBlt(tmpdc2, 0, 0, 0, 0, tmpdc, 0, 0, 0);
            do {
                if (!GetBitmapFromDC(tmpdc, 
                            0, 0, 240, 320, 
                            m_specific->m_surf_img[idx]))
                {
                    ret = FALSE;
                    break;
                }
                m_rbuf_img[idx].attach(m_specific->m_surf_img[idx]->bmBits, 
                        m_specific->m_surf_img[idx]->bmWidth, 
                        m_specific->m_surf_img[idx]->bmHeight, 
                        m_flip_y?(-m_specific->m_surf_img[idx]->bmPitch):
                        m_specific->m_surf_img[idx]->bmPitch);

                ret = TRUE;

            } while(FALSE);

            DeleteCompatibleDC(tmpdc);
            DeleteCompatibleDC(tmpdc2);

            return ret;
        }
        return false;
    }
static void free_dsp_app (void)
{
    int i;
    DSPITEM* item;

    item = icon_info.app_items;
    for (i = 0; i < icon_info.nr_apps; i++, item++) {
        if (item->bmp.bmBits) {
            UnloadBitmap (&item->bmp);
            item->bmp.bmBits = NULL;
        }
    }

    free (icon_info.app_items);
    icon_info.app_items = NULL;
}
    //------------------------------------------------------------------------
    platform_specific::~platform_specific()
    {
        int i;
        for(i = platform_support::max_images - 1; i >= 0; --i)
        {
            if(m_surf_img[i]) 
            {
#ifndef _MG_MINIMALGRAF
                UnloadBitmap(m_surf_img[i]);
#endif
                free(m_surf_img[i]);
                m_surf_img[i]=NULL;
            }
        }
        if(m_surf_window) 
            DeleteMemDC(m_surf_window);
    }
예제 #12
0
int MiniGUIMain (int argc, const char* argv[])
{
MSG Msg;
HWND hMainWnd;
MAINWINCREATE CreateInfo;
#ifdef _MGRM_PROCESSES
JoinLayer (NAME_DEF_LAYER , "helloworld" , 0 , 0);
#endif
CreateInfo.dwStyle = WS_VISIBLE | WS_BORDER | WS_CAPTION;
CreateInfo.dwExStyle = WS_EX_NONE;
CreateInfo.spCaption = "HelloWorld";
CreateInfo.hMenu = 0;
CreateInfo.hCursor = GetSystemCursor (0);
CreateInfo.hIcon = 0;
CreateInfo.MainWindowProc = HelloWinProc;
CreateInfo.lx = 0;
CreateInfo.ty = 0;
CreateInfo.rx = 240;
CreateInfo.by = 180;
CreateInfo.iBkColor = RGBA2Pixel(HDC_SCREEN, 0xff, 0xff, 0xff, 0x00);
CreateInfo.dwAddData = 0;
CreateInfo.hHosting = HWND_DESKTOP;
hMainWnd = CreateMainWindow (&CreateInfo);
if (LoadBitmap (HDC_SCREEN, &bmp_bkgnd, "/res/topbar/playback.png"))
         return 1;
if (hMainWnd == HWND_INVALID)
return -1;
ShowWindow (hMainWnd, SW_SHOWNORMAL);
while (GetMessage (&Msg, hMainWnd)) {
	fprintf(stderr, "msg\n");
TranslateMessage (&Msg);
DispatchMessage (&Msg);
}
UnloadBitmap(&bmp_bkgnd);
MainWindowThreadCleanup (hMainWnd);
return 0;
}
예제 #13
0
void mini3d::OGL20BitmapTexture::SetBitmap(const void* pBitmap, const unsigned int& width, const unsigned int& height, const IBitmapTexture::BitDepth bitDepth, const ITexture::WrapStyle wrapStyle)
{
	// If width or height is not a power of two
	if (((width & (width - 1)) != 0) || ((height & (height - 1)) != 0))
	{
		throw Error::MINI3D_ERROR_NON_POWER_OF_TWO;
	}

	UnloadBitmap();

	this->bitDepth = bitDepth;
	sizeInBytes = width * height * GetBytesPerPixel();
	this->pBitmap = malloc(sizeInBytes);
	std::memcpy(this->pBitmap, pBitmap, sizeInBytes);

	this->width = width;
	this->height = height;
	
	this->wrapStyle = wrapStyle;

	isDirty = true;
	LoadResource();

}
static int ControlTestWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
{
    switch (message) {
    case MSG_CREATE:
    {
        int i;
        COOLBARITEMINFO cbii;
        HWND coolbar1, coolbar2, coolbar3, coolbar4;

        coolbar1 = CreateWindow (CTRL_COOLBAR,
                              "",
                              WS_CHILD | WS_VISIBLE | CBS_BMP_CUSTOM,
                              IDC_COOLBAR1,
                              0, 0,
                              52 * (NM_BARPIC + 1), 0,
                              hWnd, MAKELONG (48, 48));
           
        coolbar2 = CreateWindow (CTRL_COOLBAR,
                              "",
                              WS_CHILD | WS_VISIBLE | CBS_BMP_32X32,
                              IDC_COOLBAR2,
                              0, 100,
                              36 * (NM_BARPIC + 1), 0, hWnd, 0);

        coolbar3 = CreateWindow (CTRL_COOLBAR,
                              "",
                              WS_CHILD | WS_VISIBLE,
                              IDC_COOLBAR3,
                              0, 230,
                              20 * (NM_BARPIC + 1), 0, hWnd, 0);
           
        coolbar4 = CreateWindow (CTRL_COOLBAR,
                              "res/bkgnd.gif",
                              WS_CHILD | WS_VISIBLE | CBS_USEBKBMP | CBS_BMP_CUSTOM,
                              IDC_COOLBAR4,
                              0, 170,
                              240, 0, hWnd, MAKELONG (20, 20));
           
        for (i = 0; i < NM_BARPIC; i++) {
            LoadBitmapFromFile (HDC_SCREEN, bmps+i, barpic[i]);
            cbii.id = IDC_BAR + i + 1;
            cbii.ItemType = TYPE_BMPITEM;
            cbii.Bmp = bmps + i;
            cbii.ItemHint = barhint[i];
            cbii.Caption = NULL;
            cbii.dwAddData = 0;
            SendMessage (coolbar1, CBM_ADDITEM, 0, (LPARAM)&cbii);
            SendMessage (coolbar2, CBM_ADDITEM, 0, (LPARAM)&cbii);
            SendMessage (coolbar3, CBM_ADDITEM, 0, (LPARAM)&cbii);

            if (i == 3) {
                cbii.ItemType = TYPE_BARITEM;
                SendMessage (coolbar4, CBM_ADDITEM, 0, (LPARAM)&cbii);
            }

            if (i >= 3) {
                cbii.ItemType = TYPE_TEXTITEM;
                cbii.Bmp = NULL;
                cbii.ItemHint = barhint[i];
                cbii.Caption = barhint[i];
                cbii.dwAddData = 0;
            }

            SendMessage (coolbar4, CBM_ADDITEM, 0, (LPARAM)&cbii);
        }
        break;
    }
       	
    case MSG_COMMAND:
    {
#if 0
        int id = LOWORD (wParam);
        int nc = HIWORD (wParam);
#endif

        break;
    }

    case MSG_DESTROY:
    {
        int i;

        for (i = 0; i < 6; i++)
            UnloadBitmap (bmps+i);

        hMainWnd = HWND_INVALID;
        return 0;
    }

    case MSG_CLOSE:
        DestroyAllControls (hWnd);
        DestroyMainWindow (hWnd);
        MainWindowCleanup (hWnd);
        return 0;

    default:
        break;
    }

    return DefaultMainWinProc (hWnd, message, wParam, lParam);
}
예제 #15
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);
}
예제 #16
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);

}
static int CoolBarCtrlProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
{
    HDC              hdc;
    PCOOLBARCTRL     TbarData;
    PCOOLBARITEMDATA pTbid;
        
    switch (message) {
        case MSG_CREATE:
        {
            DWORD data; 
            DWORD dwStyle;
            const char* caption;

            if ((TbarData = (COOLBARCTRL*) calloc (1, sizeof (COOLBARCTRL))) == NULL)
                return 1;

            TbarData->nCount = 0;
            TbarData->head = TbarData->tail = NULL;
            TbarData->BackBmp = NULL;
            TbarData->iSel = -1;
            TbarData->iMvOver = -1;
            TbarData->ShowHint = TRUE;
            TbarData->hToolTip = 0;

            ExcludeWindowStyle (hWnd, WS_BORDER);

            dwStyle = GetWindowStyle (hWnd);
            if (dwStyle & CBS_BMP_32X32) {
                TbarData->ItemWidth = 32;
                TbarData->ItemHeight = 32;
            }
            else if (dwStyle & CBS_BMP_CUSTOM) {
                data = GetWindowAdditionalData (hWnd);
                TbarData->ItemWidth = LOWORD (data);
                TbarData->ItemHeight = HIWORD (data);
            }
            else {
                TbarData->ItemWidth = 16;
                TbarData->ItemHeight = 16;
            }

            caption = GetWindowCaption (hWnd);
            if ((dwStyle & CBS_USEBKBMP) && caption [0]) {
                TbarData->BackBmp = (BITMAP*)calloc (1, sizeof (BITMAP));
                if (LoadBitmap (HDC_SCREEN, TbarData->BackBmp, caption) < 0) {
                    free (TbarData->BackBmp);
                    TbarData->BackBmp = NULL;
                    break;
                }
            }
            SetWindowAdditionalData2 (hWnd, (DWORD)TbarData);
        }
        break;

        case MSG_DESTROY:
        { 
            COOLBARITEMDATA* unloaddata, *tmp;
            TbarData = (PCOOLBARCTRL) GetWindowAdditionalData2(hWnd);
            if (TbarData->hToolTip != 0) {
                DestroyToolTipWin (TbarData->hToolTip);
                TbarData->hToolTip = 0;
            }

            if (TbarData->BackBmp) {
                UnloadBitmap (TbarData->BackBmp);
                free (TbarData->BackBmp);
            }

            unloaddata = TbarData->head;
            while (unloaddata) {
                tmp = unloaddata->next;
                free (unloaddata);
                unloaddata = tmp;
            }

            free (TbarData);
        }
        break;

        case MSG_SIZECHANGING:
        {
            const RECT* rcExpect = (const RECT*)wParam;
            RECT* rcResult = (RECT*)lParam;

            TbarData = (PCOOLBARCTRL) GetWindowAdditionalData2(hWnd);

            rcResult->left = rcExpect->left;
            rcResult->top = rcExpect->top;
            rcResult->right = rcExpect->right;
            rcResult->bottom = rcExpect->top + TbarData->ItemHeight + 8;
            return 0;
        }

		case MSG_SIZECHANGED:
		{
			RECT* rcWin = (RECT*)wParam;
			RECT* rcClient = (RECT*)lParam;
			*rcClient = *rcWin;
			return 1;
		}

        case MSG_NCPAINT:
            return 0;

        case MSG_PAINT:
        {
            TbarData = (PCOOLBARCTRL) GetWindowAdditionalData2(hWnd);
            hdc = BeginPaint (hWnd);
            DrawCoolBox (hWnd, hdc, TbarData);
            EndPaint (hWnd, hdc);
            return 0;
        }

        case CBM_ADDITEM:
        {
            COOLBARITEMINFO* TbarInfo = NULL;
            COOLBARITEMDATA* ptemp;
            RECT rc;

            TbarData = (PCOOLBARCTRL) GetWindowAdditionalData2 (hWnd);
            TbarInfo = (COOLBARITEMINFO*) lParam;

            if (!(ptemp = (COOLBARITEMDATA*)calloc (1, sizeof (COOLBARITEMDATA)))) {
                return -1;
            }

            GetClientRect (hWnd, &rc);

            ptemp->id = TbarInfo->id;
            ptemp->Disable = 0;
            ptemp->ItemType = TbarInfo->ItemType;

            if (TbarInfo->ItemHint) {
                strncpy (ptemp->Hint, TbarInfo->ItemHint, LEN_HINT);
                ptemp->Hint [LEN_HINT] = '\0';
            }
            else
                ptemp->Hint [0] = '\0';

            if (TbarInfo->Caption) {
                strncpy (ptemp->Caption, TbarInfo->Caption, LEN_TITLE);
                ptemp->Caption [LEN_TITLE] = '\0';
            }
            else
                ptemp->Caption [0] = '\0';
             
            ptemp->Bmp = TbarInfo->Bmp;

            set_item_rect (hWnd, TbarData, ptemp); 

            ptemp->next = NULL;
            if (TbarData->nCount == 0) {
                TbarData->head = TbarData->tail = ptemp;
            }
            else if (TbarData->nCount > 0) { 
                TbarData->tail->next = ptemp;
                TbarData->tail = ptemp;
            }
            ptemp->insPos = TbarData->nCount;
            TbarData->nCount++;

            InvalidateRect (hWnd, NULL, TRUE);
            return 0;
        }

        case CBM_ENABLE:
            TbarData = (PCOOLBARCTRL)GetWindowAdditionalData2 (hWnd);
            if (enable_item (TbarData, wParam, lParam))
                return -1;

            InvalidateRect (hWnd, NULL, TRUE);
            return 0;

        case MSG_LBUTTONDOWN:
        {         
             int posx, posy;
             TbarData=(PCOOLBARCTRL) GetWindowAdditionalData2(hWnd);

             posx = LOSWORD (lParam);
             posy = HISWORD (lParam);

             if (GetCapture () == hWnd)
                break;
             
             SetCapture (hWnd);
                         
             if ((pTbid = GetCurTag (posx, posy, TbarData)) == NULL)
                break; 
             
             TbarData->iSel = pTbid->insPos;
             break;
        }

        case MSG_LBUTTONUP:
        { 
            int x, y;
            TbarData = (PCOOLBARCTRL)GetWindowAdditionalData2(hWnd);
            x = LOSWORD(lParam);
            y = HISWORD(lParam);
                      
            if (GetCapture() != hWnd)
               break;
            ReleaseCapture ();

            ScreenToClient (hWnd, &x, &y);

            if ((pTbid = GetCurTag(x, y, TbarData)) == NULL) {
                break;
            }
          
            if (TbarData->iSel == pTbid->insPos && !pTbid->Disable)
                NotifyParent (hWnd, GetDlgCtrlID(hWnd), pTbid->id);

            TbarData->iSel = -1;
            break;
        }

        case MSG_MOUSEMOVE:
        {  
            int x, y;
            TbarData = (PCOOLBARCTRL) GetWindowAdditionalData2(hWnd);
            x = LOSWORD(lParam);
            y = HISWORD(lParam);

            if (GetCapture() == hWnd)
                ScreenToClient (hWnd, &x, &y);
                
            if ((pTbid = GetCurTag (x, y, TbarData)) == NULL) {
                unhilight (hWnd);
                break;
            }

            if (TbarData->iMvOver == pTbid->insPos)
               break;

            unhilight (hWnd);
            TbarData->iMvOver = pTbid->insPos;
            hilight (hWnd, TbarData, pTbid);
            break;
        }
        
        case MSG_MOUSEMOVEIN:
            if (!wParam)
                unhilight (hWnd);   
            break;

        case MSG_NCLBUTTONDOWN:
        case MSG_KILLFOCUS:
            unhilight (hWnd);   
            break;
    }

    return DefaultControlProc (hWnd, message, wParam, lParam);
}
예제 #18
0
mini3d::OGL20BitmapTexture::~OGL20BitmapTexture(void)
{
	UnloadResource();
	UnloadBitmap();
	pGraphicsService->RemoveResource(this);
}
예제 #19
0
static int ModemWinProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
{
	HDC hdc;

	switch (message){
		case MSG_CREATE:
			InitModemWin(hWnd);
			ModemCurWnd = 0;
			SetFocusChild(ModemWnd[ModemCurWnd]);
			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, gOptions.LCDHeight, &ModemBkg);
				if(fGetDC){
					ReleaseDC(hdc);
				}

				return 0;
			}

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

		case MSG_KEYDOWN:
			SetMenuTimeOut(time(NULL));
			if(gOptions.KeyPadBeep)
				ExKeyBeep();

			if (LOWORD(wParam)==SCANCODE_CURSORBLOCKDOWN){
				if (ModemCurWnd == 11) {
					ModemCurWnd = 0;
				} else if (ModemCurWnd == 0 && module_type == MODEM_MODULE_EM660) {
					ModemCurWnd += 2;
				} else if (4 < ModemCurWnd && ModemCurWnd < 9) {
					ModemCurWnd = 9;
				} else {
					ModemCurWnd++;
				}
				SetFocusChild(ModemWnd[ModemCurWnd]);
				return 0;
			}

			if (LOWORD(wParam) == SCANCODE_CURSORBLOCKLEFT || LOWORD(wParam) == SCANCODE_CURSORBLOCKRIGHT ||
					(gOptions.TFTKeyLayout == 3 && LOWORD(wParam)  == SCANCODE_BACKSPACE)){
				if (ModemCurWnd == 0){
					if (SendMessage(ModemWnd[ModemCurWnd], CB_GETCURSEL, 0, 0)==0)
						SendMessage(ModemWnd[ModemCurWnd], CB_SETCURSEL, 1, 0);
					else
						SendMessage(ModemWnd[ModemCurWnd], CB_SETCURSEL, 0, 0);
					return 0;
				}

				if (4 < ModemCurWnd && ModemCurWnd < 8 && LOWORD(wParam) == SCANCODE_CURSORBLOCKRIGHT){
					ModemCurWnd += 1;
					SetFocusChild(ModemWnd[ModemCurWnd]);
				}

				if (5 < ModemCurWnd && ModemCurWnd < 9 && LOWORD(wParam) == SCANCODE_CURSORBLOCKLEFT){
					ModemCurWnd -= 1;
					SetFocusChild(ModemWnd[ModemCurWnd]);
				}

				if ((ModemCurWnd == 9 || ModemCurWnd == 10) && LOWORD(wParam) == SCANCODE_CURSORBLOCKRIGHT){
					ModemCurWnd += 1;
					SetFocusChild(ModemWnd[ModemCurWnd]);
					return 0;
				}

				if ((ModemCurWnd == 10 || ModemCurWnd == 11) && LOWORD(wParam) == SCANCODE_CURSORBLOCKLEFT){
					ModemCurWnd -= 1;
					SetFocusChild(ModemWnd[ModemCurWnd]);
					return 0;
				}
				if (ModemCurWnd == 9 && LOWORD(wParam) == SCANCODE_CURSORBLOCKLEFT){
					ModemCurWnd = 11;
					SetFocusChild(ModemWnd[ModemCurWnd]);
					return 0;
				}
				if (ModemCurWnd == 11 && LOWORD(wParam) == SCANCODE_CURSORBLOCKRIGHT){
					ModemCurWnd = 9;
					SetFocusChild(ModemWnd[ModemCurWnd]);
					return 0;
				}
			}

			if (LOWORD(wParam)==SCANCODE_CURSORBLOCKUP){
				if (ModemCurWnd == 0) {
					ModemCurWnd = 11;
				} else if (ModemCurWnd == 2 && module_type == MODEM_MODULE_EM660) {
					ModemCurWnd -= 2;
				} else if(ModemCurWnd == 9) {
					ModemCurWnd = 5;
				} else if (4 < ModemCurWnd && ModemCurWnd < 9) {
					ModemCurWnd = 4;
				} else {
					ModemCurWnd--;
				}
				SetFocusChild(ModemWnd[ModemCurWnd]);
				return 0;
			}


			if (LOWORD(wParam)==SCANCODE_F9 || ((gOptions.TFTKeyLayout == 0 || 
							gOptions.TFTKeyLayout == 4) && (LOWORD(wParam) == SCANCODE_F11))) {
				if ((ModemCurWnd > 1 && ModemCurWnd < 5) || (module_type != MODEM_MODULE_EM660 && ModemCurWnd == 1)) {
					T9IMEWindow(hWnd, 0, 200,gOptions.LCDWidth, gOptions.LCDHeight, 0);
				}
				return 0;
			}

			if (LOWORD(wParam)==SCANCODE_F8){
				CreateModemInfoWindow(hWnd);
				return 0;
			}

			if (LOWORD(wParam)==SCANCODE_ENTER){
				if (ModemCurWnd == 9){
					PostMessage(hWnd, MSG_COMMAND, IDOK, 0);
				}

				if (ModemCurWnd == 10){
					PostMessage(hWnd, MSG_COMMAND, IDCANCEL, 0);
				}

				if (ModemCurWnd == 11){
					CreateModemInfoWindow(hWnd);
				}

				return 0;
			}

			if (LOWORD(wParam)==SCANCODE_ESCAPE){
				PostMessage(hWnd, MSG_COMMAND, IDCANCEL, 0);
			}

			if (LOWORD(wParam)==SCANCODE_MENU){
				PostMessage(hWnd, MSG_COMMAND, IDOK, 0);
				return 0;
			}

			break;

		case MSG_COMMAND:
			switch(LOWORD(wParam)){
				case IDOK:
					if(isModemSettingChanged()){
						if(!ismenutimeout){
							SaveModemSetting(hWnd);
							PostMessage(hWnd, MSG_CLOSE, 0, 0);
						}
					}else{
						PostMessage(hWnd, MSG_CLOSE, 0, 0);
					}
					break;

				case IDCANCEL:
					if(isModemSettingChanged()){
						if(MessageBox1(hWnd, LoadStrByID(MID_SAVEDATA), LoadStrByID(MID_APPNAME),MB_OKCANCEL | MB_ICONQUESTION | MB_BASEDONPARENT) == IDOK)
						{
							if(!ismenutimeout){
								SaveModemSetting(hWnd);
								PostMessage(hWnd, MSG_CLOSE, 0, 0);
							}
						}
						else
						{
							if(!ismenutimeout)
								PostMessage(hWnd, MSG_CLOSE, 0, 0);
						}
					}else{
						PostMessage(hWnd, MSG_CLOSE, 0, 0);
					}
					break;

			}
			break;

		case MSG_CLOSE:
			UnloadBitmap(&ModemBkg);
			//MainWindowCleanup(hWnd);
			DestroyMainWindow(hWnd);
			return 0;
	}

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

}
예제 #20
0
static int ControlOneLogWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
{

	HDC hdc;
	HWND statushWnd;
	static char keyupFlag=0;
	switch (message)
	{
		case MSG_CREATE:
			{
				LoadBitmap(HDC_SCREEN,&onequerybmp,GetBmpPath("warningsmall.gif"));

				if (gfont1==NULL) {
					logqyfont = CreateLogFont (NULL,"fixed","GB2312",FONT_WEIGHT_REGULAR, FONT_SLANT_ROMAN, 
							FONT_SETWIDTH_NORMAL,FONT_SPACING_CHARCELL, FONT_UNDERLINE_NONE, FONT_STRUCKOUT_NONE,12, 0);
					logqyfont1 = 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 {
					logqyfont1=gfont1;
					logqyfont=gfont1;
				}
				if (gOptions.ShowState){
					g_celcount=5;
				} else {
					g_celcount=4;
				}
				statushWnd = createStatusWin1(hWnd , 250 , 50 , LoadStrByID(MID_APPNAME) , LoadStrByID(MID_WAIT));
				ProcessFindLog(hWnd,oneuserpin,onesttm,oneedtm);
				destroyStatusWin1(statushWnd);
				SetFocusChild(hOneLogWnd);
				SendMessage(hOneLogWnd,LVM_CHOOSEITEM,0,0);
				processlogstateandvf(hWnd);
				return 0;
			}
			/*
			   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, 210, 32, 32, &onequerybmp);
			   if (fGetDC)
			   ReleaseDC (hdc);
			   return 0;
			   }
			   */
		case MSG_PAINT:
			SetMenuTimeOut(time(NULL));
			hdc=BeginPaint(hWnd);
			//FillBoxWithBitmap (hdc, 10, 217, 24, 24, &onequerybmp);
			FillBoxWithBitmap (hdc, 10+gOptions.GridWidth, 215, 24, 24, &onequerybmp);
			EndPaint(hWnd,hdc);
			return 0;

		case MSG_COMMAND:
			if (wParam == IDCANCEL){
				SendMessage (hWnd, MSG_CLOSE, 0, 0L);
				break;
			}

			if ((LOWORD(wParam)==IDC_LISTVIEW) &&(HIWORD(wParam)==LVN_SELCHANGE)){
				processlogstateandvf(hWnd);
			}
			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;
				}
			}

			if (gOptions.KeyPadBeep) {
				ExKeyBeep();
			}

			if ( LOWORD(wParam)==SCANCODE_ESCAPE ) {
				SendMessage (hWnd, MSG_CLOSE, 0, 0L);
			}

			if(LOWORD(wParam)==SCANCODE_F12) {
				SendMessage(hOneLogWnd,MSG_KEYDOWN,SCANCODE_PAGEDOWN,0);
				processscrollview(hOneLogWnd,1,10);
			}

			if(LOWORD(wParam)==SCANCODE_F11) {
				SendMessage(hOneLogWnd,MSG_KEYDOWN,SCANCODE_PAGEUP,0);
				processscrollview(hOneLogWnd,0,10);
			}
			break;
		case MSG_CLOSE:
			UnloadBitmap(&onequerybmp);
			if (gfont==NULL) {
				DestroyLogFont(logqyfont);
				DestroyLogFont(logqyfont1);
			}
			DestroyMainWindow(hWnd);
			return TRUE;

	}
	return DefaultMainWinProc (hWnd, message, wParam, lParam);
}
예제 #21
0
static int Delwinproc(HWND  hWnd, int message, WPARAM wParam, LPARAM lParam)
{
	HDC hdc;
	int id, nc;
	int mcard = 0;
	int posX1;
	static char keyupFlag=0;
	int focus = 0;
	int tmpvalue=0;

	switch (message)
	{
		case MSG_CREATE:
			//LoadBitmap(HDC_SCREEN,&delbmp,GetBmpPath("submenubg.jpg"));
			LoadBitmap(HDC_SCREEN,&delhintbmp,GetBmpPath("delhint.gif"));
			InitWindow(hWnd);
			UpdateWindow(hWnd,TRUE);
			//SetFocusChild(btndelall);

			/*dsl 2012.4.17*/
			//if (TEST_ONLY_ENROLL_PRIVILLEGE) {
			//	SendMessage(btndelall, MSG_ENABLE, 0, 0);
			//} else {
			//	focus = 1;
			//	SetFocusChild(btndelall);
			//}
			//change by zxz 2013-04-19
			focus = 1;
			SetFocusChild(btndelall);

			if (deluser.Password[0]){
				nopwd=0;
			} else {
				nopwd=1;
			}
			if (nopwd) {
				SendMessage(btndelpwd,MSG_ENABLE,0,0);
			} else if (focus==0){
				focus = 1;
				SetFocusChild(btndelpwd);
			}

			if(!gOptions.IsOnlyRFMachine) {
				if(FDB_GetTmpCnt(deluser.PIN)>0){
					nofp=0;
				} else {
					nofp=1;
				}
				if (nofp) {
					SendMessage(btndelfp,MSG_ENABLE,0,0);
				} else if (focus==0){
					focus = 1;
					SetFocusChild(btndelfp);
				}

			}
#ifdef FACE
			if(gOptions.FaceFunOn) {
				if(FDB_GetFaceTmp(deluser.PIN,0,NULL)) {
					noface=0;
				} else {
					noface=1;
				}

				if(noface) {
					SendMessage(btndelface,MSG_ENABLE,0,0);
				} else if (focus==0){
					focus = 1;
					SetFocusChild(btndelface);
				}
			}
#endif

			if(gOptions.RFCardFunOn) {
				memcpy(&mcard,deluser.Card,4);
				if(mcard) {
					nohid = 0;
				} else {
					nohid = 1;
				}
				if (nohid) {
					SendMessage(btndelhid,MSG_ENABLE,0,0);
				}else if (focus==0){
					focus = 1;
					SetFocusChild(btndelhid);
				}

			}

			if (gOptions.CameraOpen)
			{
				int ret;
				dellist = FDB_GetPhotoToList(0, 0, deluser.PIN2, 1, &ret, 0);
				if (ret) {
					nophoto = 0;
				} else {
					nophoto = 1;
				}
				if (nophoto) {
					SendMessage(btndelphoto, MSG_ENABLE, 0, 0);
				} else if (focus==0){
					focus = 1;
					SetFocusChild(btndelphoto);
				}
			}
			break;

		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_CURSORBLOCKUP) || (LOWORD(wParam)==SCANCODE_CURSORBLOCKDOWN))
			{
				SelectNext(hWnd,wParam);
				return 0;
			}
			else if (LOWORD(wParam)==SCANCODE_ESCAPE)
			{
				PostMessage (hWnd, MSG_CLOSE, 0, 0L);
				return 0;
			}
			break;

		case MSG_CLOSE:
			//UnloadBitmap(&delbmp);
			UnloadBitmap(&delhintbmp);
			DestroyMainWindow(hWnd);
			//MainWindowCleanup(hWnd);
			return 0;

		case MSG_COMMAND:
			id = LOWORD(wParam);
			nc = HIWORD(wParam);
			switch (id) {
				case ID_EXIT:
					SendMessage (hWnd, MSG_CLOSE, 0, 0L);
					break;
				case ID_CKBASE:
					if (!ProcessDeluser(delpin,hWnd,0))	UpdateWindow(hWnd,TRUE);
					break;
				case ID_CKFP:
					if (!ProcessDeluser(delpin,hWnd,1))	UpdateWindow(hWnd,TRUE);
					break;
				case ID_CKPWD:
					if (!ProcessDeluser(delpin,hWnd,2))	UpdateWindow(hWnd,TRUE);
					break;
				case ID_CKHID:
					if (!ProcessDeluser(delpin,hWnd,3))	UpdateWindow(hWnd,TRUE);
					break;
				case ID_CKPHOTO:
					if (!ProcessDeluser(delpin, hWnd, 4))	UpdateWindow(hWnd,TRUE);
					break;
#ifdef FACE
				case ID_CKFACE:
					if (!ProcessDeluser(delpin,hWnd,5))     
					{
						UpdateWindow(hWnd,TRUE);
					}
					break;
#endif
			}
			break;

		case MSG_ERASEBKGND:
			{
				HDC hdc = (HDC)wParam;
				const RECT* clip = (const RECT*) lParam;
				BOOL fGetDC = FALSE;
				RECT rcTemp;
				char textstr[100];

				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, get_submenubg_jgp());
				FillBoxWithBitmap (hdc, 250+gOptions.ControlOffset, 0, 0, 0, &delhintbmp);

				if (deluser.Name[0])		//modify by jazzy 2008.07.26
				{
					unsigned char mynamename[100];

					memset(mynamename,0,100);
					Str2UTF8(tftlocaleid,(unsigned char *)deluser.Name, mynamename);

					sprintf(textstr,"%s:%s   %s:%s",LoadStrByID(MID_ACNO),deluser.PIN2,
							LoadStrByID(MID_NAME),mynamename);
				}
				else
					sprintf(textstr,"%s:%s", LoadStrByID(MID_ACNO), deluser.PIN2);

				tmpvalue=SetBkMode(hdc,BM_TRANSPARENT);
				SetTextColor(hdc,PIXEL_lightwhite);

				if (fromRight==1)
				{
					TextOut(hdc, 50+gOptions.ControlOffset, 10, textstr);
					posX1=10+gOptions.ControlOffset;
				}
				else
				{
					TextOut(hdc, 10+gOptions.ControlOffset, 10, textstr);
					posX1=220+gOptions.ControlOffset;
				}
				if (delret==2)
				{
					TextOut(hdc, posX1, h_fp, LoadStrByID(MID_FPHADDEL));
					if (pwddelhint) TextOut(hdc, posX1, h_pwd, LoadStrByID(MID_PWDHADDEL));
					//For face
					if (facedelhint)TextOut(hdc, posX1, h_face, LoadStrByID(MID_FACEHADDEL));
					//end face
					if (hiddelhint)	TextOut(hdc, posX1, h_hid, LoadStrByID(MID_HIDHADDEL));
					if (photodelhint) TextOut(hdc, posX1, h_pic, LoadStrByID(MID_DELPHOTO_HINT));
					pwddelhint=0;	hiddelhint=0;	photodelhint=0;	fpdelhint=0;	//add by jazzy 2008.12.03
					facedelhint=0;
				}
				if (delret==3)
				{
					if (fpdelhint) TextOut(hdc, posX1, h_fp, LoadStrByID(MID_FPHADDEL));
					TextOut(hdc, posX1, h_pwd, LoadStrByID(MID_PWDHADDEL));
					if (facedelhint)TextOut(hdc, posX1, h_face, LoadStrByID(MID_FACEHADDEL));
					if (hiddelhint)	TextOut(hdc, posX1, h_hid, LoadStrByID(MID_HIDHADDEL));
					if (photodelhint) TextOut(hdc, posX1, h_pic, LoadStrByID(MID_DELPHOTO_HINT));
					pwddelhint=0;   hiddelhint=0;   photodelhint=0; fpdelhint=0;	//add by jazzy 2008.12.03
					facedelhint=0;
				}
				if (delret==4)
				{
					if (fpdelhint) TextOut(hdc, posX1, h_fp, LoadStrByID(MID_FPHADDEL));
					if (pwddelhint)	TextOut(hdc, posX1, h_pwd, LoadStrByID(MID_PWDHADDEL));
					if (facedelhint)TextOut(hdc, posX1, h_face, LoadStrByID(MID_FACEHADDEL));
					TextOut(hdc, posX1, h_hid, LoadStrByID(MID_HIDHADDEL));
					if (photodelhint) TextOut(hdc, posX1, h_pic, LoadStrByID(MID_DELPHOTO_HINT));
					pwddelhint=0;   hiddelhint=0;   photodelhint=0; fpdelhint=0;	//add by jazzy 2008.12.03
					facedelhint=0;
				}
				if (delret==5)
				{
					if (fpdelhint) TextOut(hdc,posX1, h_fp, LoadStrByID(MID_FPHADDEL));
					if (pwddelhint) TextOut(hdc,posX1, h_pwd, LoadStrByID(MID_PWDHADDEL));
					if (facedelhint)TextOut(hdc, posX1, h_face, LoadStrByID(MID_FACEHADDEL));
					if (hiddelhint) TextOut(hdc, posX1, h_hid, LoadStrByID(MID_HIDHADDEL));
					TextOut(hdc, posX1, h_pic, LoadStrByID(MID_DELPHOTO_HINT));
					pwddelhint=0;   hiddelhint=0;   photodelhint=0; fpdelhint=0;	//add by jazzy 2008.12.03
					facedelhint=0;
				}
				if (delret==6)
				{
					if (fpdelhint)
					{
						TextOut(hdc,posX1, h_fp, LoadStrByID(MID_FPHADDEL));
					}
					if(pwddelhint)
					{
						TextOut(hdc,posX1, h_pwd, LoadStrByID(MID_PWDHADDEL));
					}
					TextOut(hdc, posX1, h_face, LoadStrByID(MID_FACEHADDEL));
					if (hiddelhint)
					{
						TextOut(hdc, posX1, h_hid, LoadStrByID(MID_HIDHADDEL));
					}
					if (photodelhint)
					{
						TextOut(hdc, posX1, h_pic, LoadStrByID(MID_DELPHOTO_HINT));
					}
					pwddelhint=0;
					hiddelhint=0;
					photodelhint=0;
					fpdelhint=0;
					facedelhint=0;
				}
				ReleaseDC (hdc);
				return 0;
			}
	}
	return DefaultMainWinProc(hWnd,message,wParam,lParam);
}
예제 #22
0
static int CoolIndicatorCtrlProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
{
    HDC              hdc;
    PCOOL_INDICATOR_CTRL TbarData;
        
	//db_msg("message is %s, wParam: 0x%x, lParam: 0x%lx\n", Message2Str(message), wParam, lParam);
    switch (message) {
    case MSG_CREATE:
		{
			DWORD data; 
            DWORD dwStyle;

			//db_info("Cool Indicator ctrl proc\n");
            if ((TbarData = (COOL_INDICATOR_CTRL*) calloc (1, sizeof (COOL_INDICATOR_CTRL))) == NULL)
                return 1;

            TbarData->nCount = 0;
            TbarData->head = TbarData->tail = NULL;
            TbarData->BackBmp = NULL;
            TbarData->iSel = 0;
            TbarData->hToolTip = 0;

            //ExcludeWindowStyle (hWnd, WS_BORDER);

            dwStyle = GetWindowStyle (hWnd);
            if (dwStyle & CBS_BMP_CUSTOM) {
                data = GetWindowAdditionalData (hWnd);
                TbarData->ItemWidth = LOWORD (data);
                TbarData->ItemHeight = HIWORD (data);
				int screenW,screenH;
				getScreenInfo(&screenW,&screenH);
                TbarData->ItemHeight = 	screenH/8;
            }
            else {
                TbarData->ItemWidth = 16;
                TbarData->ItemHeight = 16;
            }

            SetWindowAdditionalData2 (hWnd, (DWORD)TbarData);
		}
		break;

	case MSG_DESTROY:
        { 
            COOL_INDICATOR_ITEMDATA* unloaddata, *tmp;
            TbarData = (PCOOL_INDICATOR_CTRL) GetWindowAdditionalData2(hWnd);
            if (TbarData->hToolTip != 0) {
                DestroyCdrToolTipWin(TbarData->hToolTip);
                TbarData->hToolTip = 0;
            }

            if (TbarData->BackBmp) {
                UnloadBitmap (TbarData->BackBmp);
                free (TbarData->BackBmp);
            }

            unloaddata = TbarData->head;
            while (unloaddata) {
                tmp = unloaddata->next;
                free (unloaddata);
                unloaddata = tmp;
            }

            free (TbarData);
        }
        break;
	
	case MSG_SHOWWINDOW:
		{
			if(wParam == SW_SHOWNORMAL) {
				enable_hint = TRUE;
			} else {
				enable_hint = FALSE;
			}
		}
		break;

	case MSG_SIZECHANGING:
        {
            const RECT* rcExpect = (const RECT*)wParam;
            RECT* rcResult = (RECT*)lParam;

            TbarData = (PCOOL_INDICATOR_CTRL) GetWindowAdditionalData2(hWnd);

            rcResult->left = rcExpect->left;
            rcResult->top = rcExpect->top;
            rcResult->right = rcExpect->right;
            rcResult->bottom = rcExpect->top + TbarData->ItemHeight + 14;
            return 0;
        }
		break;

	case MSG_SIZECHANGED:
		{
			RECT* rcWin = (RECT*)wParam;
			RECT* rcClient = (RECT*)lParam;
			*rcClient = *rcWin;
			return 1;
		}
		break;

	case MSG_FONTCHANGED:
		{
            TbarData = (PCOOL_INDICATOR_CTRL) GetWindowAdditionalData2(hWnd);

			PLOGFONT logfont = GetWindowFont(hWnd);
			//db_msg("MSG_FONTCHANGED, type :%s, familyt: %s, charset: %s\n", logfont->type, logfont->family, logfont->charset);
			if(TbarData != NULL && TbarData->hToolTip != 0) {
				SetWindowFont(TbarData->hToolTip, logfont );
			}
		}
		break;

    case MSG_NCPAINT:
        return 0;

	case MSG_PAINT:	//todo: why MSG_PAINT is received early than MSG_CREATE?
        {
            TbarData = (PCOOL_INDICATOR_CTRL) GetWindowAdditionalData2(hWnd);
			if (TbarData == NULL) {
				break;
			}
            hdc = BeginPaint (hWnd);

			PLOGFONT logfont = GetWindowFont(hWnd);

			SelectFont(hdc, logfont );
            DrawCoolBox (hWnd, hdc, TbarData);
            EndPaint (hWnd, hdc);
            return 0;
        }
		break;

	case CBM_ADDITEM:
        {
            COOL_INDICATOR_ITEMINFO* TbarInfo = NULL;
            COOL_INDICATOR_ITEMDATA* ptemp;
            RECT rc;

            TbarData = (PCOOL_INDICATOR_CTRL) GetWindowAdditionalData2 (hWnd);
            TbarInfo = (COOL_INDICATOR_ITEMINFO*) lParam;

            if (!(ptemp = (COOL_INDICATOR_ITEMDATA*)calloc (1, sizeof (COOL_INDICATOR_ITEMDATA)))) {
                return -1;
            }

            GetClientRect (hWnd, &rc);

			//db_msg("add item id is %d\n", TbarInfo->id);
            ptemp->id = TbarInfo->id;
            ptemp->Disable = 0;
            ptemp->ItemType = TbarInfo->ItemType;
			ptemp->sliderColor = TbarInfo->sliderColor;

           // if (TbarInfo->ItemHint) {
            //    strncpy (ptemp->Hint, TbarInfo->ItemHint, LEN_HINT);
            //    ptemp->Hint [LEN_HINT] = '\0';
            //}
           // else
                ptemp->Hint [0] = '\0';

            if (TbarInfo->Caption) {
                strncpy (ptemp->Caption, TbarInfo->Caption, LEN_TITLE);
                ptemp->Caption [LEN_TITLE] = '\0';
            }
            else
                ptemp->Caption [0] = '\0';
             
            ptemp->Bmp = TbarInfo->Bmp;

            set_item_rect (hWnd, TbarData, ptemp); 

            ptemp->next = NULL;
            if (TbarData->nCount == 0) {
                TbarData->head = TbarData->tail = ptemp;
            }
            else if (TbarData->nCount > 0) { 
                TbarData->tail->next = ptemp;
                TbarData->tail = ptemp;
            }
            TbarData->nCount++;

            InvalidateRect (hWnd, NULL, TRUE);
            return 0;
        }
		break;

	case CBM_CLEARITEM:
		{
            COOL_INDICATOR_ITEMINFO* TbarInfo = NULL;
            COOL_INDICATOR_ITEMDATA *ptemp1, *ptemp2;

            TbarData = (PCOOL_INDICATOR_CTRL) GetWindowAdditionalData2 (hWnd);
            TbarInfo = (COOL_INDICATOR_ITEMINFO*) lParam;

			ptemp1 = TbarData->head;
            while (ptemp1) {
                ptemp2 = ptemp1->next;
				ptemp1->next = NULL;
                free (ptemp1);
                ptemp1 = ptemp2;
            }
			TbarData->head = TbarData->tail = NULL;
            TbarData->nCount = 0;
			TbarData->iSel = 0;
		}
		break;

	case CBM_SWITCH2NEXT:
		{
			TbarData = (PCOOL_INDICATOR_CTRL) GetWindowAdditionalData2 (hWnd);

			TbarData->iSel++;
			if(TbarData->iSel >= TbarData->nCount) {
				TbarData->iSel = 0;
			}
			db_info("switch to next, iSel is %d\n", TbarData->iSel);
            InvalidateRect (hWnd, NULL, TRUE);
		}
		break;

	case CBM_ENABLE:
		{
            TbarData = (PCOOL_INDICATOR_CTRL)GetWindowAdditionalData2 (hWnd);
            if (enable_item (TbarData, wParam, lParam))
                return -1;

            InvalidateRect (hWnd, NULL, TRUE);
            return 0;
		}
		break;
	default:
		break;
	}

    return DefaultMainWinProc(hWnd, message, wParam, lParam);
}
static int
ControlTestWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
{
    static BITMAP folder;
    
    switch (message)
	{
	case MSG_CREATE:
	{

	    create_ctrls (hWnd);
	    hRightMenu = create_rightbutton_menu ();
	    
	    LoadBitmapFromFile (HDC_SCREEN, &folder, "./res/folder.bmp");
	    
	    hChildWnd1 = CreateWindow (CTRL_GRID, "GRID",
				       WS_CHILD | WS_VISIBLE | WS_VSCROLL |
				       WS_HSCROLL | WS_BORDER, IDC_GRID, 20, 20, 350,
				       200, hWnd, 0);
	    
	}
	break;
	
	case MSG_COMMAND:
	{
	    int id = LOWORD (wParam);
	    //int code = HIWORD (wParam);
	    int nSel, col, row;
	    char buffer[101];
	    
	    GetWindowText (GetDlgItem(hWnd, IDC_EDIT), buffer, 100);
	    nSel = atoi(buffer);
	    
	    switch (id) {
            case IDC_CTRL1:
                row = SendMessage(hChildWnd1, GRIDM_GETHEADHEIGHT, 0,0);
                sprintf(buffer, "%d", row);
                SetWindowText(GetDlgItem(hWnd, IDC_EDIT), buffer);
                break;

            case IDC_CTRL2:
                col = SendMessage(hChildWnd1, GRIDM_GETHEADWIDTH, 0,0);
                sprintf(buffer, "%d", col);
                SetWindowText(GetDlgItem(hWnd, IDC_EDIT), buffer);
                break;

            case IDC_CTRL3:
                col = SendMessage(hChildWnd1, GRIDM_GETCOLCOUNT, 0, 0);
                SendMessage(hChildWnd1, GRIDM_ADDCOL, (WPARAM)col, 0);
                break;

            case IDC_CTRL4:
                col = SendMessage(hChildWnd1, GRIDM_GETCOLCOUNT, 0, 0);
                SendMessage(hChildWnd1, GRIDM_DELCOL, (WPARAM)(col-1), 0);
                break;

            case IDC_CTRL6:
                break;

            case IDC_CTRL7:
                break;

            case IDC_CTRL8:
                break;

            case IDC_CTRL9:
                break;

            case IDM_FILE ... IDM_FILE+4:
                MessageBox (hMainWnd, "In Construction ...", "Sorry", MB_OK);
                break;
	    }
	    
	}
	break;
	
	case MSG_DESTROY:
	    UnloadBitmap (&folder);
	    DestroyMenu (hRightMenu);
	    DestroyAllControls (hWnd);
	    hMainWnd = HWND_INVALID;
	    return 0;
	    
	case MSG_CLOSE:
	    DestroyMainWindow (hWnd);
	    MainWindowCleanup (hWnd);
	    return 0;
	    
	}
    return DefaultMainWinProc (hWnd, message, wParam, lParam);
}
예제 #24
0
static int procmainstatekey(HDC hdc,HWND hWnd)
{
	int i,j;
	BITMAP bmp;
	int x,y;
	//HDC hdc;
	unsigned char temp[30]={0};
	int num=0;
	int tmpvalue = 0;
	//hdc=GetClientDC(hWnd);
	tmpvalue = SetBkMode(hdc,BM_TRANSPARENT);
	for(i=0;i<8;i++)
	{
		TSHORTKEY mystkey;
		memset(&mystkey,0,sizeof(TSHORTKEY));

		if(i<4)
		{
			x=0;
			//y=70+i*133;
			y=20+i*60;
		}
		else
		{
			//x=705;
			//y=70+(i-4)*133;
			x=160;
			y=20+(i-4)*60;
		}
		if(FDB_GetShortKey(i+1, &mystkey)!=NULL)
		{
			if(i==putkey)
				LoadBitmap(hdc,&bmp,GetBmpPath("status2.gif"));
			else
				LoadBitmap(hdc,&bmp,GetBmpPath("status.gif"));
			if(mystkey.keyFun)
				FillBoxWithBitmap(hdc,x,y,160,35,&bmp);
			UnloadBitmap(&bmp);
			memset(temp,0,sizeof(temp));
			strncpy((char *)temp,mystkey.stateName,STATE_NAME_LEN);
			//10
			for(j=0;j<STATE_NAME_LEN;j++)
			{
				if(temp[j]==0x0)
					break;
				if(temp[j]<0xa0)
					num++;
			}
			//if((num%2)&&(strlen((char *)temp)==10)&&temp[9]>=0xa0)
			if((num%2)&&(strlen((char *)temp)==STATE_NAME_LEN)&&temp[STATE_NAME_LEN-1]>=0xa0)
				temp[STATE_NAME_LEN-1]=0x0;

			//TextOut(hdc,x+(95-strlen(temp)*8)/2,y+20,temp);
			TextOut(hdc,x+(160-strlen((char *)temp)*8)/2,y+10,(char *)temp);
			num=0;
		}

	}
	//ReleaseDC(hdc);
	return 0;
}
예제 #25
0
static int DialogProc(HWND hDlg, int message, WPARAM wParam, LPARAM lParam)
{
	switch(message) {
	case MSG_INITDIALOG:
		{
			tipLabelData_t* tipLabelData;

			tipLabelData = (tipLabelData_t*)lParam;
			if(!tipLabelData) {
				db_error("invalid tipLabelData\n");
				return -1;
			}
			SetWindowAdditionalData(hDlg, (DWORD)tipLabelData);

			if(tipLabelData->pLogFont) {
				SetWindowFont(hDlg, tipLabelData->pLogFont);
			}
			if(tipLabelData->full_screen == 1){
				SetWindowBkColor(hDlg,FULL_BLACK);			
			}else{
				SetWindowBkColor(hDlg, tipLabelData->bgc_widget);			
			}
			if(tipLabelData->full_screen == 1){
				SetWindowElementAttr(GetDlgItem(hDlg, IDC_TITLE), WE_FGC_WINDOW, PIXEL2DWORD(HDC_SCREEN, FULL_BLACK) );
				SetWindowElementAttr(GetDlgItem(hDlg, IDC_TEXT), WE_FGC_WINDOW,  PIXEL2DWORD(HDC_SCREEN, FULL_BLACK) );
			}else{
				SetWindowElementAttr(GetDlgItem(hDlg, IDC_TITLE), WE_FGC_WINDOW, PIXEL2DWORD(HDC_SCREEN, tipLabelData->fgc_widget) );
				SetWindowElementAttr(GetDlgItem(hDlg, IDC_TEXT), WE_FGC_WINDOW,  PIXEL2DWORD(HDC_SCREEN, tipLabelData->fgc_widget) );
			}		
			SetTimerEx(hDlg, TIMEOUT_TIMER, tipLabelData->timeoutMs / 10, timerCallback);
		}
		break;
	case MSG_PAINT:
		{
			RECT rect;
			HDC hdc; 
			tipLabelData_t* tipLabelData;

			hdc = BeginPaint(hDlg);

			tipLabelData = (tipLabelData_t*)GetWindowAdditionalData(hDlg);
			GetClientRect(GetDlgItem(hDlg, IDC_TITLE), &rect);
			if(tipLabelData->full_screen == 1){
				SetPenColor(hdc, FULL_BLACK);
			}else{
				SetPenColor(hdc, tipLabelData->linec_title );	
			}
			Line2(hdc, 0, RECTH(rect) + 2, RECTW(rect), RECTH(rect) + 2);
			#if 0
			char *filepath=(char *)"/etc/res/others/wifi.png";
			LoadBitmapFromFile(HDC_SCREEN, &tipLabelData->bitImage, filepath);
			FillBoxWithBitmap(hdc,0,0,320,240,&tipLabelData->bitImage);		
			#endif
			//ShowWindow(hDlg,SW_SHOWNORMAL);
			EndPaint(hDlg, hdc);
		}
		break;
	case MSG_FONTCHANGED:
		{
			PLOGFONT pLogFont;		
			pLogFont = GetWindowFont(hDlg);
			if(pLogFont) {
				SetWindowFont(GetDlgItem(hDlg, IDC_TITLE), pLogFont);
				SetWindowFont(GetDlgItem(hDlg, IDC_TEXT), pLogFont);
			}
		}
		break;
	case MSG_KEYUP:
		{	
			switch(wParam) {
			case CDR_KEY_RIGHT:
				EndDialog(hDlg, 0);
				break;
			case CDR_KEY_LEFT:
			case CDR_KEY_OK:
			case CDR_KEY_MODE:
				break;
			}			
		}
		break;
	case MSG_KEYDOWN:
		{	
		
			//EndDialog(hDlg, 0);
		}
		break;
	case MSG_CLOSE_TIP_LABEL:	
		tipLabelData_t* tipLabelData;

		tipLabelData = (tipLabelData_t*)GetWindowAdditionalData(hDlg);
		db_info("MSG_CLOSE_LOWPOWER_DIALOG\n");
		if(IsTimerInstalled(hDlg, ONE_SHOT_TIMER) == TRUE) {
			KillTimer(hDlg, ONE_SHOT_TIMER);
		}
		if(IsTimerInstalled(hDlg, TIMEOUT_TIMER) == TRUE) {
			KillTimer(hDlg, TIMEOUT_TIMER);
		}
		if (tipLabelData->bitImage.bmBits != NULL){
			UnloadBitmap(&tipLabelData->bitImage);
		}
		EndDialog(hDlg, 0);
		break;
	}
	return DefaultDialogProc(hDlg, message, wParam, lParam);
}