Tuesday, September 25, 2012

.NET Framework in Windows 8

The only version included in Windows 8 by default is .NET Framework 4.5 which is new version of .NET Framework just appeared in 2012. The only version which you can install on Windows 8 machine is .NET Framework 3.5. What about earlier versions of .NET Framework and applications based on them?

.NET Framework 1.1 is considered fully deprecated in Windows 8, it can't be installed and applications with it can't be used any more - it should be OK since it is really deprecated long ago.

.NET Framework 2.0 and .NET Framework 3.0 is a different case. Since they are parts of .NET Framework 3.5, the applications which use them can be run successfully on Windows 8 but you should install .NET Framework 3.5 instead of 2.0 or 3.0. You can install .NET Framework through installer or you can enable it through Control Panel, more details are here:


Installers for .NET Framework 2.0 and 3.0 were removed from Microsoft site.

In one of our previous posts we described a function in Inno Setup installer which could check .NET Framework 3.0 presence on the machine, now it should be updated in such a way:
en.dotnetmissing=Our program needs Microsoft .NET Framework 3.0. Would you like to download and install it now?
function InitializeSetup(): Boolean;
    ErrorCode: Integer;
    netFrameWorkInstalled : Boolean;
    isInstalled: Cardinal;
    result := true;
    isInstalled := 0;
    netFrameworkInstalled := RegQueryDWordValue(HKLM, 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0\Setup',
  'InstallSuccess', isInstalled);
    if ((netFrameworkInstalled)  and (isInstalled <> 1)) then netFrameworkInstalled := false;   
    if netFrameworkInstalled = false then
        if (MsgBox(ExpandConstant('{cm:dotnetmissing}'),
            mbConfirmation, MB_YESNO) = idYes) then
        result := false;
The only difference is that URL for downloading of .NET Framework should point to .NET Framework 3.5 now, not 3.0. 

Please note that registry key 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0\Setup' should not be changed since .NET 3.5 installer proceeds this key in the correct way also.

Friday, September 21, 2012

Range-based For Loops in Visual Studio 2012

C++ 11 added a feature for easy iteration over a list of elements which is called range-based for:
int simpleArray[5] = {1, 2, 3, 4, 5};
for (int x : simpleArray)
    cout << x;
This is similar to 'foreach' statement in other languages. GCC added support of this feature in version 4.6 and now Microsoft added support in Visual Studio 2012 and in Visual C++ 11.

It is possible to modify contents of container making loop variable a reference:
vector<double> v;

for (double &y : v)
    y *= 2;
Range-based for loop will work automatically with array or with std::vector or other STL containers. You can also make your own data structures iterable in the new way, you can find exact requirements and example of such a class here:


Friday, September 14, 2012

Ribbon is now available in WPF!

With .NET Framework 4.5 and Visual Studio 2012 standard Ribbon control is finally available for WPF applications. We don't need to search for 3d controls any more!

To use ribbon you need to add reference to System.Windows.Controls.Ribbon in your WPF application.

After that you should be able to write XAML code like that:
<Window x:Class="TestRibbon.MainWindow"
        Title="MainWindow" Height="350" Width="525">
      <RibbonTab x:Name="Home" Header="Home">
        <RibbonButton x:Name="HomeButton" Label="Home"/>
      <RibbonTab x:Name="FTP" Header="FTP">
        <RibbonButton x:Name="UploadButton" Label="Upload"/>
        <RibbonButton x:Name="DownloadButton" Label="Download"/>
This will allow you to see the simple ribbon. Set SmallImageSource and LargeImageSource properties to make your ribbon buttons look nice.

Tuesday, September 4, 2012

Qt 5 Beta Release News

Qt 5 Beta release is available since August 30, 2012. Final release is expected by November 2012. It is, of course, an important event for C++ developers and we can get much more details here: 

Being introduced in Qt 4.7 (September 2010) QML and Qt Quick will play major role in Qt 5 release. Qt Quick gives us a declarative way of building user interfaces and it is intended to be used widely for mobile devices. Declarative scripting language is called QML. 

A good thing is that they say it will be easy to make Qt 4 applications to work on Qt 5, no special efforts will be required for that.

Another good thing is that more features of current C++ standard (C++ 11) will be supported in Qt 5. You can read about some of the features here:

A little bit earlier (August 9, 2012) Digia signed an agreement with Nokia that it is Digia who is responsible for Qt activities now:

It is especially interesting that they are planning make Qt available on Android, iOS and Windows 8 platforms very soon.