Skip to main content

Detecting Classic Start Menu or Start Menu

On some of our regression tests, we need to check that all shortcuts that our product created under Windows Start Menu is working. One of the challenge this one presents is that user can set it to either "Classic Start Menu" or the new XP style Start Menu. Since our organization likes to use Visual Tests, I was looking for a way to detect what is the current style of Start Menu, hence the script below was born:

'Refs
'http://www.themssforum.com/VisualBasic/SHGetSetSetting-SHELLFLAGSTATESHELLSTATE/
'http://msdn.microsoft.com/en-us/library/bb762200(VS.85).aspx
'http://msdn.microsoft.com/en-us/library/bb759788(VS.85).aspx

Option
Explicit
Private
Declare Sub SHGetSetSettings Lib "shell32" _
(ByRef lpSS As Byte, ByVal dwMask As Long, ByVal bSet As Long)
Const SSF_STARTPANELON =
&H200000

Public Function IsXpMenuStyleOn() As
Long
   
'SHELLSTATE is 36 byte structure
    IsXpMenuStyleOn =
0
    
    Dim Buf(0 To 35) As
Byte
    
    SHGetSetSettings Buf(0), SSF_STARTPANELON,
0
    If Buf(28) = 2
Then
        IsXpMenuStyleOn =
1
   
Else
        IsXpMenuStyleOn =
0
    End
If
End
Function

 

You can put this in Common project under Shared Module or Module. For my case I saved it to Module asset named DesktopUtilities. Now to use this, create a test script that looks like the following:

Sub Main()
    Include
"Common.DesktopUtilities"
        
    bXpStyleOn = DesktopUtilities.IsXpMenuStyleOn()
End Sub

 

Note that you need to define bXpStyleOn as TP output variable, and then you need to get the return value into a Visual Test variable. Once you know what is the current Window Menu Style you can create a decision logic to run different Visual Test script depending on the returned value.

 

Happy Test Partner coding !!!

 

~ts

Comments

Popular posts from this blog

The following add-ins could not be started MonoDevelop.GnomePlatform

Installing MonoDevelop in OpenSUSE 12.2 from its repository was very easy. When running it for the first time though I got the message: The following add-ins could not be started: The root of the trace shows MonoDevelop.GnomePlatform,2.8 A quick search shows that MonoDevelop depends on libgnomeui . This should have been part of dependencies when installing the application but well.... Below is the screen shot of the error message. References: http://software.1713.n2.nabble.com/MonoDevelop-and-openSUSE-12-1-td7462957.html [2013/04/09] - Same issue observed in OpenSUSE 12.3 and also the same fix. [2014/11/02] - Same issue observed in OpenSUSE 13.3, mondevelop 3.0.6 and the same fix.

Error! Could not locate dkms.conf file install VirtualBox 4.1.8 on Ubuntu 11.10

Tried to update my Ubuntu host today and it did pickup that new version of VirtualBox is available (4.1.8). All other packages installed properly except that VirtualBox installation was complaining about missing dkms.conf file, see error message below. $: sudo /etc/init.d/vboxdrv setup * Stopping VirtualBox kernel modules [ OK ] * Uninstalling old VirtualBox DKMS kernel modules Error! Could not locate dkms.conf file. File: does not exist. [ OK ] * Trying to register the VirtualBox kernel modules using DKMS [ OK ] * Starting VirtualBox kernel modules [ OK ] Though it looks like installation was fine but I am concerned about its effects to VirtualBox functionality. To fix this, do: $: cd /var/lib/dkms/vboxhost $: sudo rm -r 4.1.4 $: sudo /etc/init.d/vboxdrv setup Of course you have to re