Windows 2008Windows Vista.NET 1.0Windows 2003.NET 1.1.NET 3.0Windows 2000架构师高级Windows XP.NET 2.0.NET 3.5C# 2.0C# 3.0中级开发WindowsC++.NETC#
使用 C++ 和 C# 的应用程序的 Vista 徽标认证






4.71/5 (13投票s)
这个库提供了 TC8、9 和 30 的 Vista 徽标 API 实现。它还描述了 TC1 和 TC32。
引言
关于 Vista 徽标认证的文章有很多。但我认为我还有更多可以写的东西。在这里,我提供了一个 DLL,它涵盖了与 Vista 徽标认证相关的几乎所有实现方面。该包包含:libvl.zip,DLL 源代码,libvl.dll-Document.zip,使用说明文档,HelloLogoC#.rar,在 C# 中使用 DLL 的示例,以及 HelloLogoC++.zip,在 C++ 中使用 DLL 的示例。请按照文档学习如何使用此 DLL。
背景
我们知道 Vista 徽标有 32 个测试用例。要获得 Vista 徽标认证,应用程序必须通过所有测试用例。不用担心,获得徽标并不难。应用程序只需要实现以下测试用例:TC1、TC2、TC3、TC8、TC9、TC30、TC31 和 TC32。其余测试用例与安装程序相关。实际上,您只需要通过代码实现 TC1、TC8、TC9 和 TC30。这个 DLL 将为您涵盖这些。这段代码已经过测试和实现。
使用代码
请参考文档以获得更好的理解。只需要从 DLL 调用两个方法:isSuccess(…)
和 isRestartMessage (…)
。在这里,我只演示如何在 C# 应用程序中使用 DLL。
[DllImport("libvl.dll", CharSet = CharSet.Auto)]
public static extern int isSuccess( string aExeName,
string aWndText,
string aCmdLine,
bool aSupportConcurrentUser,
bool aSupportRemoteDesktop);
[DllImport("libvl.dll", CharSet = CharSet.Auto)]
static void Main(string[] argv)
{
try
{
if (!File.Exists("Libvl.dll"))
{
MessageBox.Show("The following Libvl.dll is missing " +
"please reinstall the application");
return;
}
runMain(argv);
}
catch (Exception ex)
{
throw; //*** DON'T "Throw ex" here! *** FOR TC 32
}
}
//
static void runMain(string[] argv)
{
String lStrWndTxt = "HelloLogo";//This is the title of the
if (isSuccess(“HelloLogo.exe”,lStrWndTxt,
"CommandLine",false,true) != 0)
return;
//
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new HelloLogo());
}
[DllImport("libvl.dll", CharSet = CharSet.Auto)]
public static extern int isRestartMessage(int aMessage, IntPtr lParam);
//WINDOW MESSAGE HANDLER
protected override void WndProc(ref Message m)
{
base.WndProc(ref m); // call default p
if (isRestartMessage(m.Msg, m.LParam) > -1)//TC 30
{
//This application is about to be shut down, so save state...
if (this.InvokeRequired)
this.BeginInvoke(new MethodInvoker(this.saveState));
else
this.saveState();
}
}
private void saveState()
{
//Write code in here to save the state
//of the application just before a restart
Process.GetCurrentProcess().Kill();
return;
}
历史
尚未进行更新。