⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lockscreen.c

📁 minigui PDA系统 可实现手机功能
💻 C
字号:
#include <stdio.h>
#include <minigui/common.h>
#include <minigui/minigui.h>
#include <minigui/gdi.h>
#include <minigui/window.h>
#include <minigui/control.h>
#include <minigui/mgext.h>
#define _ID_TIMER3 120
int Screenlockflag = FALSE;
BOOL Screenkey;
static BITMAP lockpic;
HWND LOCKSCREENHWND;
static int lockpro (HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
{


	HDC hdc;
	RECT rc;
	BOOL fGetDC;
	RECT rcTemp;
	const RECT* clip = (const RECT*) lParam;


	switch (message)

	{
		
   		 case MSG_CREATE:
			hdc = GetClientDC (hWnd);
	   		rc.left = 20; rc.top = 10;
			rc.right = 300; rc.bottom = 215;
		
			SetBkMode(hdc, BM_TRANSPARENT);

			//在rc指定的区域内居中显示"屏幕被锁定, 按'*'和'0'键解除锁定!"
			DrawText (hdc, "屏幕被锁定, 按'*'和'0'键解除锁定!", -1, &rc, DT_CENTER | DT_WORDBREAK);
		  
			ReleaseDC(hdc);
	   		return 0;	

		case MSG_ERASEBKGND:
			//printf ("BeginERASE.\n");
			hdc = (HDC)wParam;
	    		//const RECT* clip = (const RECT*) lParam;
	    		 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, 320,240, &lockpic);

	    		if (fGetDC)
				ReleaseDC (hdc);
			//printf ("EndERASE.\n");
			return 0;
		
  		 case MSG_CHAR:
			if(wParam == (WPARAM)0x2a)//'*'
			{
	        		  SetTimer(hWnd, _ID_TIMER3, 200);
				   Screenkey = TRUE;
			}
			else if((wParam == (WPARAM)0x30) && (Screenkey == TRUE))
			{
				   KillTimer(hWnd, _ID_TIMER3);
				   Screenlockflag = FALSE;
				   DestroyAllControls (hWnd);
	       		   DestroyMainWindow (hWnd);
	      			   PostQuitMessage (hWnd);   
	      			   return 0;

			}
			break;

		case MSG_TIMER:
	      {
		  	if(wParam == _ID_TIMER3)
                          Screenkey = FALSE;
             }
             break;
	}

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

}
int screenlockset(HWND hWnd)
{
    MSG Msg;
    HWND LockSetWnd;
    MAINWINCREATE CreateInfo;
    CreateInfo.dwStyle =  WS_VISIBLE |WS_DISABLED;
    CreateInfo.dwExStyle = WS_EX_NONE;
    CreateInfo.spCaption = "";
    CreateInfo.hMenu = 0;
    CreateInfo.hCursor = GetSystemCursor(IDC_ARROW);
    CreateInfo.hIcon = 0;
    CreateInfo.MainWindowProc =lockpro;
    CreateInfo.lx = 0; 
    CreateInfo.ty = 0;
    CreateInfo.rx = 320;
    CreateInfo.by = 240;
    CreateInfo.iBkColor = GetWindowElementColor (BKC_CONTROL_DEF);
    CreateInfo.dwAddData = 0;
    CreateInfo.dwReserved = 0;
    CreateInfo.hHosting = hWnd;
    //创建主窗口

    if (LoadBitmap (HDC_SCREEN, &lockpic, "image/background/bkgnd29.jpg"))
		return -1;
	
    LockSetWnd = CreateMainWindow (&CreateInfo);
    if (LockSetWnd == HWND_INVALID)
        return -1;
	LOCKSCREENHWND = LockSetWnd;
    Screenlockflag = TRUE;
    Screenkey = FALSE;

        
    ShowWindow(LockSetWnd, SW_SHOWNORMAL);

    while (GetMessage(&Msg, LockSetWnd)) {
        TranslateMessage(&Msg);
        DispatchMessage(&Msg);
    }
 
    MiniGUIExtCleanUp ();
    MainWindowThreadCleanup (LockSetWnd);
    return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -