I recently encountered a problem creating new logins with SQL Server. Something that has worked for years suddenly stopped with the following error:

Password validation failed. The password does not meet Windows policy requirements because it is too short.

Since SQL Server was using Windows local security policy I went and checked that at Security Settings > Account Policies > Password Policy in Local Security Policy (available under Administrative Tools in Control Panel or by opening secpol.msc). As expected, these contained setting that I was not expecting, which were probably changed from the network by a system administrator.

However, I wanted to be able to enter shorter passwords, like 8 characters instead of 10, but this was disabled. Even if I was running as administrator, the option of changing this was disabled.

It is however still possible to modify these settings even if you cannot do it from the management console. You can do it from a command prompt as administrator.

  1. Open a command prompt running as administrator
  2. Run the following command to export the settings to a file. In my example, the target path is c:\temp\local.cfg, but it can be anything.

  3. Edit the file with notepad or another editor. The file is an INI file with sections and key-value pairs. The password settings are available under the [System Access] section. For changing the minimum length of the passwords modify the MinimumPasswordLength key.
  4. Save the file and run the following command to import the settings from the modified file.

  5. Close and open the Local Security Policy console again and check the settings.
, , , , Hits for this post: 1730 .

Several CTPs for Visual Studio 2014 have been released so far. The 3rd and 4th CTPs can be actually used with a Windows Azure Virtual Machine. If you have a Windows Azure account you can go ahead and create a VM. If you are an MSDN Subscriber or you have a trial account, you have a number of free hours that you can use, so you won’t have to pay anything to run VS2014 CTP in the clound.

NOTE: Details about the limits and cost in Windows Azure are available here (also see this article).

Below is a step-by-step walk through of how to create and start a VM for Visual Studio 14 CTP 4.

Step 1: Log to Windows Azure.

Step 2: Create a new virtual machine.

In the Azure portal press the New button.

Select Compute > Virtual Machine > From Gallery

Choose the Visual Studio 2014 CTP 4 Image

Select the virtual machine configuration



Step 3: Wait until the virtual machine starts up.

This may take a few minutes.


Step 4: Connect remotely to the virtual machine.

See How to Log on to a Virtual Machine Running Windows Server.

Note: You have to authenticate with the username (make sure you use the format machinename\username) and the password you have created, not the account you are initially prompted in the RDP window.


Step 5: Launch and use Visual Studio 2014 CTP.


, , , , Hits for this post: 18584 .

My first Windows Store app (for Window 8.1) is now available in Windows Store. It’s called Your Chemical Name and shows names (and text) using chemical elements symbols in the Breaking Bad style.


The application allows to:

  • customize the appearance of text, colors, background
  • customize the position of the text on the background
  • save image to a file
  • post image on a facebook album
  • share image with other apps




You save the images to disk or share them on facebook or with apps supporting the Windows Share Charm.


Here are a few screenshots:



More about the application here.

Download Your Chemical Name from Windows Store.

, , , , , , , Hits for this post: 27606 .

Windows 8 features a Settings charm to display both application (the top part) and system (the bottom part) settings (you get it from swiping from the side of the screen). The system provides two entry points, Permissions and Rate and Review, the later only for applications installed through the store.

You can customize the settings charm by adding new entry points. For instance, you may want to add an About pane. If your application uses network capabilities then you have to add a privacy policy, otherwise your application will not pass the Windows Store Certification.

charms settingscharm6

In this post I will show how you can add new entries to the settings charm for Windows 8.1 applications (this won’t work for Windows 8 applications). We have to use two classes:

  • SettingsPane: enables the app to control the Settings Charm pane. The app can add or remove commands, receive a notification when the user opens the pane, or open the pane programmatically.
  • SettingsFlyout: represents a control that provides in-context access to settings that affect the current app. This class is new to Windows 8.1

The following code adds a new entry to the settings pane called Privacy policy and provides a handler for the command. In the handler we create a new instance of a SettingsFlayout and show it.

The text of the privacy policy is kept in a text file under the Settings folder. We asynchronously open and read the content of the file and when the text is available we create a new TextBlock control and use it as the content of the flyout content control.

Then we have to initialize the settings pane when the application starts.

When you start the application and swipe the right edge of the screen the charms bar shows up. Opening the Settings charm will now show two entries for the application: Privacy Policy and Permissions.
settingscharm2 settingscharm3

The next sample shows how to add an About page. It’s very similar actually.

Notice that the entries in the settings charm appear in the order they where added.
settingscharm4 settingscharm5

The content of the flyout can be any visual object (the simple TextBlock is used only for demo purposes). It is also possible to customize the flyout header, icon, background, etc. Here is the same About page with additional flyout settings.


Here is some additional reading: Guidelines for app settings (Windows Store apps).

, , , , , Hits for this post: 35717 .

Many years ago I published on my blog a helper class for working with the Windows console that was wrapping the Windows console API. Looking back at it I realized it was a pretty naive implementation. So I decided to start a new and make something more flexible and easier to use. Hopefully, I was more successful. The result is a small C++ template library called cppconlib, available on codeplex.

cppconlib is built with C++11 features and requires Visual Studio 2012 or newer. The library is available in a single header called conmanip.h and provides a set of helper classes, functions and constants for manipulating a Windows console (using the Windows console functions). The library features the following components:

  • console_context<T>: represents a context object for console operations; its main purpose is restoring console settings; typedefs for the three consoles are available (console_in_context, console_out_context and console_err_context)
  • console<T>: represents a console objects providing operations such as changing the foreground and background colors, the input mode, screen buffer size, title, and others; typedefs for the three consoles are available (console_in, console_out and console_err)
  • manipulating functions that can be used with cout/wcout and cin/wcin: settextcolor()/restoretextcolor(), setbgcolor()/restorebgcolor(), setcolors(), setmode()/clearmode(), setposx()/setposy()/setpos().

The library can be downloaded from here. Detailed documentation is available here.



The following example prints some text in custom colors and then reads text in a different set of colors.


The following code prints a rhomb to the console:


For more details and updates check the project at codeplex: https://cppconlib.codeplex.com.

UPDATE: A NuGet package for cppconlib is available.

, , , , , , , Hits for this post: 35086 .

Trying to figure out in which process a particular DLL is currently loaded, I have found two solutions (perhaps there are more).

Solution 1: tasklist.exe

Solution 2: listdlls.exe (from sysinternals)

It might be that listdlls is more reliable than tasklist. I have ran into cases when tasklist failed to list processes that had a specific dll loaded, while listdlls was showing them.

, , Hits for this post: 24417 .

Microsoft has made available the release candidates for the new Windows and the new Visual Studio tool set. Some of the products have been renamed:

  • Windows Server 2012 is the new name for Windows 8 “Server”
  • Visual Studio 2012 is the new name for Visual Studio 11

MSDN subscribers can download them from their account. If you’re not a subscriber you can use the following links:

You can read more about these releases here:

The only thing I’d like to mention at this point is that after butchering the Windows logo (no, I don’t believe in the ingenuity of the light blue rectangle) someone felt the need to do the same with the Visual Studio logo. And if I could live with the new Windows logo (the color is awful) the new Visual Studio logo is huge failure, in my opinion.

Yes, that’s right, the one in the right is the new VS2012 logo.

After seeing the things Microsoft has done to Windows and Visual Studio UI (especially the colors in Windows that knock you in the head and, the opposite, the lack of colors in VS) it looks like all UI experts left to Apple.

, , , , , Hits for this post: 35162 .

Windows Runtime, or shortly WinRT, is a new runtime (siting on top of the Windows kernel) that allows developers to write Metro style applications for Windows 8, using a variety of languages including C/C++, C#, VB.NET or JavaScript/HTML5. Microsoft has started rolling out information about Windows 8 and the new runtime at BUILD.

(source www.zdnet.com)

WinRT is a native layer (written in C++ and being COM-based) that is intended as a replacement, or alternative, to Win32, and enables development of “immersive” applications, using the Metro style. Its API is object oriented and can be consumed both from native or managed languages, as well as JavaScript. At the same time the old Win32 applications will continue to run just as before and you can still (and most certainly will) develop Win32 applications.

Microsoft has created a new language called C++ Component Extension, or simply C++/CX. While the syntax is very similar to C++/CLI, the language is not managed, it’s still native. WinRT components built in C++/CX do not compile to managed code, but to 100% native code. A good news for C++ developers is that they can use XAML now to build the UI for immersive applications. However, this is not available for classical, Win32 applications.

You can get a glimpse of the new system and the tools by downloading and installing the Windows Developer Preview with tools, that includes the following:

  • 64-bit Windows Developer Preview
  • Windows SDK for Metro style apps
  • Microsoft Visual Studio 11 Express for Windows Developer Preview
  • Microsoft Expression Blend 5 Developer Preview
  • 28 Metro style apps including the BUILD Conference app

Notice this is a pre-beta release and you might encounter various problems.

Before you start here are several additional articles that you might want to read:

There are also several new forums available on MSDN forums for developing Metro style applications, which you can use for addressing technical questions. Hopefully thee will be answers from Microsoft people working in this area.

, , , , , , , , , Hits for this post: 68430 .

Throughout January I have published on codeguru.com a series of articles about developing Silverlight applications for Windows Phone 7. Here is the list of articles:

If you want to develop for WP7 you need to install the Windows Phone 7 Developer Tools. They are available to download for free at AppHub, or using this direct link. You might also want to install the Silverlight for Windows Phone Toolkit that provides additional controls (such as WrapPanel, DatePicker, TimePicker, etc.) and higher-level support for touch.

Here is a list of recommended additional readings:

Enjoy the tutorials!

, , , Hits for this post: 25757 .

In my previous post I wrote about a feature called “god mode” available in Windows 7 and Vista. By creating a folder with a specific name you get one entry point to all the commands available in Control Panel. It was reported that several such shortcuts exits. Below is an image with the 16 folders that are god modes.

All 16 god modes

You can create them all by making and running (from the desired parent folder) a .cmd or .bat file with the following content:

(You can get the GUIDs of the folders from the above listing).

You can read more about this here.

, , , Hits for this post: 26464 .