Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / C#

Vista logo certification for applications using C++ and C#

4.71/5 (14 votes)
6 Apr 2009CPOL1 min read 26K   107  
This library provides the Vista logo API implementation for TC8, 9, and 30. It also describe about TC1 and TC32.

Introduction

There are so many articles on Vista Logo certification. But I think I have something more to write about it. Here, I have provided a DLL that covers almost everything from the implementation point of view related to Vista Logo certification. The package contains: libvl.zip, the DLL source, libvl.dll-Document.zip, the document for how to use, HelloLogoC#.rar, the example using the DLL in C#, and HelloLogoC++.zip, an example for using the DLL in C++. Please follow the document to learn to use this DLL.

Background

We know there are 32 test cases in Vista Logo. To obtain the Vista Logo certification, the application has to pass all the test cases. Don't worry, it is not so hard to get the logo. The application only needs to implement the following test cases: TC1, TC2, TC3, TC8, TC9, TC30, TC31, and TC32. The remaining test cases are related to the installer. Actually, you need to implement only TC1, TC8, TC9, and TC30 by code. This DLL will cover this for you. This code has already been tested and implemented.

Using the code

Please follow the document for better understanding. Only two method needs to be called from the DLL: isSuccess(…) and isRestartMessage (…). Here I will only show how to use the DLL in a C# application.

C#
[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;
}

History

No updates done yet.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)