本工具网络下载地址:http://download.csdn.net/download/friendan/4613034
本工具VS2008 源码:http://download.csdn.net/download/friendan/4613054
//程序截图如下
说明:
前前后后,花了一个下午,终于完成了本工具的编写。本工具在Win7旗舰版32位系统下
测试通过。使用本工具,你可以改变Win7登录系统时的背景图片。本工具源码参考了网上某童鞋
的代码,我对其进行了改进,增加了检测文件大小的功能,使其更加稳定,不容易出错,
代码相比之下,也更清晰,容易阅读和理解了,在此感谢这位不知名的朋友。
程序原理:
1)找到注册表项:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background
2)将Background下的OEMBackground的双字节值(假如没有,可本身 新建一个)设置为1
3)然后将某张jpg图片命名为:backgroundDefault.jpg
4)将backgroundDefault.jpg复制到C:\Windows\System32\oobe\info\backgrounds,重启系统即可看到效果了
5)恢复默认的系统图片时,将OEMBackground的双字节值设置为0即可
//本工具只是将1到5用程序写出来而已,原理很简单啦^_^!...
//截图如下
//浏览按钮 void CWin7LoginFaceModifyDlg::OnBnClickedBtnBrowse() { CFileDialog dlg(true,NULL,NULL,OFN_OVERWRITEPROMPT,_T("Chart Files(*.jpg)|*.jpg||"),NULL); if(IDOK==dlg.DoModal()) { GetDlgItem(IDC_EDT_JpgPath)->EnableWindow(TRUE); SetDlgItemText(IDC_EDT_JpgPath,dlg.GetPathName()); GetDlgItem(IDC_EDT_JpgPath)->EnableWindow(FALSE); } //启用修改和恢复按钮 GetDlgItem(IDC_BTN_Modify)->EnableWindow(TRUE); GetDlgItem(IDC_BTN_Recover)->EnableWindow(TRUE); } //修改Win7登录界面按钮 void CWin7LoginFaceModifyDlg::OnBnClickedBtnModify() { //判断文件大小是否大于或等于250KB CFileStatus status; CString jpgFile; GetDlgItemText(IDC_EDT_JpgPath,jpgFile); CFile::GetStatus(jpgFile,status); UINT fileSize=status.m_size/1024; if(fileSize>=250) { AfxMessageBox(_T("Sorry!图片大小不能大于或等于250KB,请重新选择jpg文件!...")); return; } //获取系统目录X:\Windows\System32,其中X为系统盘 TCHAR Sys32Path[256]; ::GetSystemDirectory(Sys32Path,256); //创建目录X:\Windows\System32\oobe\info\backgrounds //该目录用于存放Win7登录界面的背景图片,其中X为系统盘 //SHCreateDirectoryEx当目录存在时什么也不做,目录不存在时 //就新建一个目录,用它可以新建多级目录, //如果创建的文件夹目录有的中间目录不存在,SHCreateDirectoryEx可以建立, //而CreateDirectory(Ex)则做不到这一点。 CString bckPath; bckPath.Format(_T("%s\\oobe\\info\\backgrounds"),Sys32Path); SHCreateDirectoryEx(AfxGetMainWnd()->m_hWnd,bckPath,NULL); //将背景图片复制到X:\Windows\System32\oobe\info\backgrounds //其中X为系统盘 bckPath+=_T("\\backgroundDefault.jpg"); CString jpgPath; GetDlgItemText(IDC_EDT_JpgPath,jpgPath); ::CopyFile(jpgPath,bckPath,FALSE); //修改注册表 HKEY hkey; DWORD y=1; RegOpenKey(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Authentication\\LogonUI\\Background"), &hkey); RegSetValueEx(hkey,_T("OEMBackground"),0,REG_DWORD,(BYTE*)&y,sizeof(DWORD)); RegCloseKey(hkey); //锁定屏幕查看效果 WinExec("cmd /c \"%windir%\\system32\\Rundll32.exe User32.dll,LockWorkStation\"",SW_HIDE); } //恢复默认登录界面按钮 void CWin7LoginFaceModifyDlg::OnBnClickedBtnRecover() { //修改注册表 HKEY hkey; DWORD y=0; RegOpenKey(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Authentication\\LogonUI\\Background"), &hkey); RegSetValueEx(hkey,_T("OEMBackground"),0,REG_DWORD,(BYTE*)&y,sizeof(DWORD)); RegCloseKey(hkey); //锁定屏幕查看效果 WinExec("cmd /c \"%windir%\\system32\\Rundll32.exe User32.dll,LockWorkStation\"",SW_HIDE); } //退出程序按钮 void CWin7LoginFaceModifyDlg::OnBnClickedBtnExit() { SendMessage(WM_CLOSE); }