转载自we-hjb的BLOG,原文地址:http://www.cnblogs.com/we-hjb/archive/2010/03/05/1679472.html
本文将以模拟器为例,简单介绍如何定制WinCE的启动界面,实现动画效果。在实际硬件平台上一般在BOOTLOADER中定制开机界面。如果BOOT从Flash加载NK到内存的时间较长,通常也会加一个进度条显示。如果从NK加载完成到进入CE桌面的时间也很长,那加一个开机动画也是不错的。
首先在backlight驱动中添加相关代码,实现动画效果,代码如下。
void slash()
{http://files.cnblogs.com/we-hjb/BOOT_LOGO.rar
char *logo[2];
int i;
HANDLE hEvent;
DWORD dwRet;
char *pLCDBuf;
pLCDBuf = (char*)VirtualAlloc(NULL,0x100000,MEM_RESERVE,PAGE_NOACCESS);
VirtualCopy(pLCDBuf, (void *)(0x33f00000/256), 0x100000, PAGE_READWRITE | PAGE_PHYSICAL | PAGE_NOCACHE);
logo[0] = (char*)gImage_gbug;
logo[1] = (char*)gImage_hb;
hEvent = CreateEvent(NULL,FALSE,FALSE,_T("STOPSLASH"));
i = 0;
while (1)
{
dwRet = WaitForSingleObject(hEvent,810);
if (dwRet == WAIT_OBJECT_0)
{
break;
}
else if(dwRet == WAIT_TIMEOUT)
{
memcpy(pLCDBuf,logo[i],640*480*2);
i = !i;
}
}
}
DWORD
BKL_Init( DWORD /*registryPath*/ )
{
CreateThread(0,0,(LPTHREAD_START_ROUTINE)slash,0,0,NULL);
return 1;
}
写一个简单的应用程序并设置为开机自启动。在应用程序中,添加如下代码,结束背光驱动中显示动画的线程。
HANDLE hEvent = CreateEvent(NULL,FALSE,FALSE,_T("STOPSLASH"));
SetEvent(hEvent);
CloseHandle(hEvent);