调用的时候只要将按钮的FlatStyle设置为System,然后采用如下的代码就可以了,最后一项如果设为0的话则会取消显示UAC的盾牌图标。
::SendMessage(((CButton *)GetDlgItem(IDC_BTN_TEST3))->m_hWnd, BCM_SETSHIELD, 0, 1);
UAC盾牌的系统图标的ID是77
highestAvailable按当前账号能获取到的权限执行,而requireAdministrator则是以具有完整权限的管理员运行。如果当前账户是管理员账户的话,那么两者都是可以的通过提升权限来获取到管理员权限的;而如果当前账户是Guest的话,那么highestAvailable则放弃提升权限而直接运行,而requireAdministrator则允许输入其他管理员账户的密码来提升权限。
字符串分割函数
AfxExtractSubString :
获取后缀名,如file.txt,返回.txt
PathFindExtension
Removes the file extension from a path, if one is present.输入C:\\TEST\\sample.txt,输出C:\TEST\sample
void PathRemoveExtension(LPTSTR pszPath);
Replaces the extension of a file name with a new extension. If the file name does not contain an extension, the extension will be attached to the end of the string.
输入C:\\TEST\\sample.txt和.log,输出C:\\TEST\\sample.log
BOOL PathRenameExtension(LPTSTR pszPath, LPCTSTR pszExt);
获取全路径中的目录,如输入C:\TEST\sample.txt,调用后为C:\TEST
CStringW strTmp(wcPathName);//C:\TEST\sample.txt
::PathRemoveFileSpecW(strTmp.GetBuffer());
strTmp.ReleaseBuffer();//C:\TEST
获取文件名
LPTSTR PathFindFileName(LPCTSTR pPath);
获取ini文件中结构体
GetPrivateProfileStruct
::SendMessage(((CButton *)GetDlgItem(IDC_BTN_TEST3))->m_hWnd, BCM_SETSHIELD, 0, 1);
UAC盾牌的系统图标的ID是77
highestAvailable按当前账号能获取到的权限执行,而requireAdministrator则是以具有完整权限的管理员运行。如果当前账户是管理员账户的话,那么两者都是可以的通过提升权限来获取到管理员权限的;而如果当前账户是Guest的话,那么highestAvailable则放弃提升权限而直接运行,而requireAdministrator则允许输入其他管理员账户的密码来提升权限。
字符串分割函数
AfxExtractSubString :
获取后缀名,如file.txt,返回.txt
PathFindExtension
Removes the file extension from a path, if one is present.输入C:\\TEST\\sample.txt,输出C:\TEST\sample
void PathRemoveExtension(LPTSTR pszPath);
Replaces the extension of a file name with a new extension. If the file name does not contain an extension, the extension will be attached to the end of the string.
输入C:\\TEST\\sample.txt和.log,输出C:\\TEST\\sample.log
BOOL PathRenameExtension(LPTSTR pszPath, LPCTSTR pszExt);
获取全路径中的目录,如输入C:\TEST\sample.txt,调用后为C:\TEST
CStringW strTmp(wcPathName);//C:\TEST\sample.txt
::PathRemoveFileSpecW(strTmp.GetBuffer());
strTmp.ReleaseBuffer();//C:\TEST
获取文件名
LPTSTR PathFindFileName(LPCTSTR pPath);
获取ini文件中结构体
GetPrivateProfileStruct