Where Ultra@VNC store its ‘host’ list

Short answer

HKCU\Software\ORL\VNCviewer\MRU

Long answer

In UltraVNC it keeps a list of the host you connected to before in its little drop down.

image

Over time it tends get cluttered with one time use entries making it more difficult to pick the right one.  After it became enough of a burden I opened up Process Monitor to see what I could see.

image

After dialing in the filtering so I was only looking at vncviewer.exe I can see its writing to the registry in a directory called setting – that sounds promising.  Opening that up and routing around a bit reveals this.

image

Which looks suspiciously like the dropdown.  Basically you have some name/value pairs for the host names.   And index specifces their order.  And you can just delete any entries you want provided you also remove it from index.

And now I can sit back and enjoy my clutter free pull down.

I love DataTemplates

I have been playing around with WPF and  started writing a little game to experiment with.   So far I think my favorite thing about WPF has been data templates.  I defined a data template for a Gem Card, one of the game pieces.

<DataTemplate DataType="{x:Type game:GemCard}">
    <Border Style="{DynamicResource CardBorder}" Background="Green">
    <Border Style="{DynamicResource CardHighlight}">
        <Grid>
            <Label Content="{Binding Value}" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="5" FontSize="18.667"/>
            <Label Content="{Binding Value}" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="5" FontSize="18.667"/>
            <Path Stretch="Fill" Stroke="Black" Data="m0,0 l1,1 -1,1 -1,-1z" Fill="Red" HorizontalAlignment="Center" VerticalAlignment="Center" Width="40" Height="60"/>
            <Label Content="{Binding Gems}" FontSize="18.667" HorizontalAlignment="Center" VerticalAlignment="Center"/>
        </Grid>
    </Border>
    </Border>
</DataTemplate>

And when I put a GemCard in a content control in my game it looks something like this

image

I like this approach a lot because I can just tell WPF how I want my classes to be presented and then I can just start putting them in listboxes with out having to worry about how the will look.

List.Pop

I started writing a little WPF card game and kept coming up against having to remove and store an item from the list – essentially a pop operation.  So I wrote the following extension method.

public static class ListPopper
{
    public static T Pop<T>(this IList<T> list)
    {
        T value = list.FirstOrDefault();

        list.Remove(value);

        return value;
    }
}

I eventually decided to switch to a Stack for the card game – but I think the extension method may come in handy for other projects.