本文将以模拟器为例,简单介绍如何定制WinCE的启动界面,实现动画效果。在实际硬件平台上一般在BOOTLOADER中定制开机界面。如果BOOT从Flash加载NK到内存的时间较长,通常也会加一个进度条显示。如果从NK加载完成到进入CE桌面的时间也很长,那加一个开机动画也是不错的。
首先在backlight驱动中添加相关代码,实现动画效果,代码如下。
1 void slash()
2 {https://files.cnblogs.com/we-hjb/BOOT_LOGO.rar
3 char *logo[2];
4 int i;
5 HANDLE hEvent;
6 DWORD dwRet;
7
8 char *pLCDBuf;
9 pLCDBuf = (char*)VirtualAlloc(NULL,0x100000,MEM_RESERVE,PAGE_NOACCESS);
10 VirtualCopy(pLCDBuf, (void *)(0x33f00000/256), 0x100000, PAGE_READWRITE | PAGE_PHYSICAL | PAGE_NOCACHE);
11 logo[0] = (char*)gImage_gbug;
12 logo[1] = (char*)gImage_hb;
13
14 hEvent = CreateEvent(NULL,FALSE,FALSE,_T("STOPSLASH"));
15
16 i = 0;
17 while (1)
18 {
19 dwRet = WaitForSingleObject(hEvent,810);
20 if (dwRet == WAIT_OBJECT_0)
21 {
22 break;
23 }
24 else if(dwRet == WAIT_TIMEOUT)
25 {
26 memcpy(pLCDBuf,logo[i],640*480*2);
27 i = !i;
28 }
29 }
30 }
31
32 DWORD
33 BKL_Init( DWORD /*registryPath*/ )
34 {
35 CreateThread(0,0,(LPTHREAD_START_ROUTINE)slash,0,0,NULL);
36 return 1;
37 }
2 {https://files.cnblogs.com/we-hjb/BOOT_LOGO.rar
3 char *logo[2];
4 int i;
5 HANDLE hEvent;
6 DWORD dwRet;
7
8 char *pLCDBuf;
9 pLCDBuf = (char*)VirtualAlloc(NULL,0x100000,MEM_RESERVE,PAGE_NOACCESS);
10 VirtualCopy(pLCDBuf, (void *)(0x33f00000/256), 0x100000, PAGE_READWRITE | PAGE_PHYSICAL | PAGE_NOCACHE);
11 logo[0] = (char*)gImage_gbug;
12 logo[1] = (char*)gImage_hb;
13
14 hEvent = CreateEvent(NULL,FALSE,FALSE,_T("STOPSLASH"));
15
16 i = 0;
17 while (1)
18 {
19 dwRet = WaitForSingleObject(hEvent,810);
20 if (dwRet == WAIT_OBJECT_0)
21 {
22 break;
23 }
24 else if(dwRet == WAIT_TIMEOUT)
25 {
26 memcpy(pLCDBuf,logo[i],640*480*2);
27 i = !i;
28 }
29 }
30 }
31
32 DWORD
33 BKL_Init( DWORD /*registryPath*/ )
34 {
35 CreateThread(0,0,(LPTHREAD_START_ROUTINE)slash,0,0,NULL);
36 return 1;
37 }
写一个简单的应用程序并设置为开机自启动。在应用程序中,添加如下代码,结束背光驱动中显示动画的线程。
1 HANDLE hEvent = CreateEvent(NULL,FALSE,FALSE,_T("STOPSLASH"));
2 SetEvent(hEvent);
3 CloseHandle(hEvent);
2 SetEvent(hEvent);
3 CloseHandle(hEvent);