Showing posts with label Windows. Show all posts
Showing posts with label Windows. Show all posts

Thursday, 8 April 2021

Installer tip

I'm really enjoying RAD Studio 10.4.2, but my journey with it got off to a less than wholesome start. I'd installed from the .iso download and put just a basic Windows platform support in. Shortly thereafter I wanted more target platforms installed so I chose Tools, Manage Platforms... and was disturbed to see this message:


O NOES!!11111!1!!!one!! (or some other geeky response)

Fortunately there was no corruption. This post is simply to pass on the tip of what to do if you happen to see this, instead of following the knee-jerk reaction of immediately uninstalling and reinstalling.

The issue here is misinformation. It's not necessarily corrupted at all - the installer displays this message if it cannot find the installation database file. When you installed RAD Studio the location of the installer file is written to the registry within this key:

HKEY_CURRENT_USER\SOFTWARE\Embarcadero\BDS\21.0\CatalogRepository

The value ServicePath in that key points to a .gof file, in my case F:\radstudio_10_4_esd_104203a.gof. The thing is, I installed from a .iso file, which I mounted to a drive (F:) at the time and had since unmounted, ∴ that path no longer reached anything. Unfortunately the installer responded inappropriately: misinformation.

I gather this issue will be fixed for the 10.5 installer, but hopefully this saves someone the trouble of an uninstall and reinstall at some point.


Wednesday, 7 April 2021

SAPI (Microsoft Speech API) problems with the IDE

Every few months or so someone sends me an email telling me they've speech-enabled their application with SAPI (the Microsoft Speech API) after having read my old coverage (specifically that for SAPI 5.1) from conferences in 2002 and before. It's always good to hear that stuff you've worked on is being found useful, even long after you did it, in this case frighteningly close to 2 decades ago (Ͼ˳Ͽ)..!!!

Sometimes the communications are asking how to do specific things with SAPI - unfortunately those are typically a dead end, as I haven't used SAPI in anger for a long while.

Sometimes, though, people are stuck on the basics and I was recently contacted by someone with a fairly current version of RAD Studio saying they couldn't get started at all. It turns out that the current version of SAPI, SAPI 5.4, cannot be imported into RAD Studio!

Uh-oh. Time to investigate...

Tuesday, 20 October 2020

Deleaker: memory / resource leak detection and identification

As I've made clear many times in conference talks I’m a big fan of FastMM4, the full version Delphi’s built-in memory manager (I haven’t yet tried out FastMM5, which is fully rewritten but now has either a GPL or a commercial license). FastMM4 is great for identifying memory leaks, memory corruption, interface misuse and so on, and locating the source of the problem via a call stack. However it is true that the business of working through the FastMM4 reports is somewhat manual – reports and call stacks are sent out via debug strings or log flies and then you have to pore over the details and work things backward to the source of the problem. It does the job, but takes a back seat once the details have been discovered.

Some while back I got pointed in the direction of another leak detection tool, Deleaker from Softanics, of which I hadn't heard at that point. It’s taken me a while to clear my desk sufficiently to check it out but I’m pleased to have done so, as it’s a very nice and helpful tool.

I should mention up front that this is a commercial tool, like FastMM5 (when not used with the GPL license) and unlike FastMM4, Delphi LeakCheck, MemCheck 1 and TCondom 2. It costs $99 for a home license and $399 for a single developer license.

Some key points about Deleaker:

  • It is not just a tool for EMBT development languages: it supports Delphi, C++Builder, Visual C++ and Qt Creator
  • It’s not just a memory leak detector, but also supports resource leak detection for a pleasing array of resource types
  • It is not just a library, but offers a full UI experience, either integrated into the IDE (RAD Studio, Visual Studio, Qt Creator) or standalone, or even controlled through a command-line utility for use in Continuous Integration setups
  • It supports Win32 and Win64 targets

If you and/or your development team happens to dabble in C++Builder or Visual C++ then this tool would be a common weapon to deploy against leaks of all sorts.

The list of entity types that can be tracked looking for leaks is impressive:

Sunday, 6 September 2020

Delphi and the WinRT API

WinRT

The WinRT (Windows Runtime) API was introduced with Windows 8, although it’s fair to say that most of us have tried our level best to forget that particular Windows release and pretend it never happened. Anyway, Microsoft has been trying to convince us that new Windows APIs will be introduced in the WinRT API and what we normally refer to as the Windows API might well remain as it is. We’ll see how true that becomes. The WinRT API reference can be found documented here.

The nice thing about WinRT is that it is not another step on the .NET journey; indeed it is nothing to do with .NET whatsoever. WinRT is implemented as native code and it is made available to whatever language wishes to consume it by language projections. Microsoft offers a C# language projection to consume it in .NET but it also offers a native C++ language projection (C++/WinRT).

Each WinRT class implements various interfaces to offer up methods and properties to call. There may also be static methods (i.e. class methods) and factory methods through which you can create an instance of the class. The Microsoft language projections make all the methods implemented through all the supported interfaces directly available once you create an instance of a WinRT class.

WinRT metadata

Anyone else can make their own language projections by analysing the API metadata (which are available in .winmd files in the C:\Windows\System32\WinMetadata folder). Metadata files are rather like COM type libraries in that they describe all the WinRT classes and methods etc., but they are actually files that share the same format as Win32 executables and .NET assemblies: PE files. You can find detailed information on these files from Microsoft here. Microsoft’s C++ .winmd file parser is open-sourced and available on github.

WinRT and Delphi

Embarcadero folks started looking at how to consume the WinRT API back in 2011 and Thom Gerdes wrote a few posts on how got on. He talks about these metadata files in this old post available on the Wayback Machine.

So, do we have a Delphi language projection? Well, kinda... We have import units that pull in a good chunk of the WinRT API, but things aren’t quite as transparent and trivial to use as they are in C++and C#. However, depending on how persistent we are we can get results. Indeed there are some uses of the WinRT API in the Delphi / C++Builder RTL; it is used for Windows desktop notifications and for share contracts.

This post looks into how we might use the WinRT API directly to perform a simple task, namely to trigger a Windows notification message. This might seem an odd thing to do, given the RTL already covers this quite nicely in the TNotificationCenter class but it serves as a simple, visual example.

Friday, 14 February 2020

25 Delphi Tips for 25 Years of Delphi

It seems funny to think Delphi is 25 years old, and yet sure enough the celebrations are ongoing for the 25th Anniversary of its unveiling on 14th February 1995.

As it happens I've been part of the Delphi world for around 26 years now, as I used to work at Borland and was involved with testing and experimenting with and working with the pre-release versions.

What can I say other than Happy Birthday, Delphi? You've been a good friend to me over this last quarter of a century and I've been happy to be part of your world.

Some number of posts ago I wrote up 10 Tips for Delphi Users. When I checked I was horrified to find this was 7 years ago! (My, my, how time flies when you're having fun...) Anyway, I thought I'd take that list and build upon it, expanding it up to 25 tips for Delphi users, which is what we have here. So without further ado let's get straight into the list.

Tuesday, 22 November 2016

Debug logging in FireMonkey – CodeRage XI Lightning Talks

During CodeRage XI I had a couple of Lightning Talks broadcast on a subject I’ve been intending to write up for quite a long time, but haven’t quite managed to achieve: how to emit debug log messages on the various FireMonkey platforms.

I made a 10 minute video for Delphi and one for C++ looking at all the target platforms, Win32/Win64, OS X/macOS, Android and iOS, showing the logging options and then looking at how to view log output.

Unfortunately I got a bit caught up in some work and didn’t publicise this ahead of the conference, so I think not many people were aware of them.

Sunday, 3 January 2016

Some Delphi and C++Builder articles

My blog editor of choice is proving to be a little quisquous at the moment.

Historically I have used Windows LiveWriter, part of Windows Essentials (whose development stopped in 2012, but was still available here (web installer) and here (offline installer)). This worked well, but at some point over the summer it stopped working with the uprated authentication requirements of Google’s Blogger. Fortunately though, it has just been open-sourced and is now available as Open Live Writer here.

However while one issue I immediately hit with this new version has been fixed, I have still yet to successfully connect to my blog with Open Live Writer. Fingers crossed….

So until the initial set of issues are worked out I’ll post articles and link to them by short manually entered blog entries here.

This post is mostly to point at a short article I’ve put together that brings to the attention of those who are interested the easy means to lessen the size of your Windows application’s executable file.

You can find the article here: Trimming The Fat - Smaller Windows .exe Sizes With Delphi And C++Builder.

[Update 20150105: I've made some changes to the advice in the Trim the Fat article (clearly marked) after some input came through from a helpful reader.]

Before signing off I want to mention a couple of other posts that recently caught my eye:

Daniele Spinetti has very recently worked out the solution to a bug he encountered with Android background services in Delphi 10 Seattle, which meant that the TLocationSensor component doesn’t function when used in an Android service data module. The problem has been identified and described in his (very) recent post. This will be a useful addition to those trying to use Android services to accompany Jim McKeeth’s offerings:

Daniele also has a post showing how to use AdMob insterstitial adverts in Android apps as an alternative to regular banner ads.

Some posts from Chee Wee also stood out as interesting:

Happy New Year!

Wednesday, 11 September 2013

Delphi for Android (aka Delphi XE5 aka RAD Studio XE5) has appeared

Delphi Android dude

Blimey, that took me by surprise (again)! I figured it was coming fairly soon, but I didn’t realise quite that soon.

Anyway, Delphi XE5 is here (as is RAD Studio XE5 and siblings), as Tim Del Chiaro on his Delphi Insider blog.

The Trial Edition is up and available for download and those with Software Assurance should have access to the full version.

You can get a run down of what’s new in the XE5 doc wiki – specifically the What’s New page, but there’s also a general What’s New page. However the thrust of this release is all about adding Android to the portfolio of supported target platforms, with the suggestion that you can get applications compiling for both iOS and Android from a single source base.

But before getting bogged down in Android it’s worth mentioning these new features:

  • the REST client library, a new cross-platform framework for easy access of REST-based web services
  • REST debugger
  • the full integration of FireDAC
  • IDE support for MacinCloud
  • Extendible IDE mobile design devices
  • the awesome IDE Insight functionality (Ctrl+. or F6) is no longer a modal dialog but is now a search box
  • style support for the freshly released iOS 7
  • swipe to delete feature on mobile platforms
  • TListView search filtering support
  • the removal of the long defunct WebSnap and InternetExpress (with the suggestion to use IntraWeb and WebBroker instead for similar functionality)

Also there have been a bunch of iOS fixes along the way, as you’d expect.

The full Delphi range of platform targets now covers:

  • 32-bit Windows
  • 64-bit Windows
  • 32-bit OS X
  • iOS Simulator (Intel)
  • iOS (ARM)
  • Android (ARM)

This is achieved with this half dozen compilers:

  • dcc32 – Embarcadero Delphi for Win32 compiler version 26.0 – your regular Win32 Delphi, the latest version updated over many versions since Delphi 2
  • dcc64 – Embarcadero Delphi for Win64 compiler version 26.0 – the 64-bit Windows targeting compiler
  • dccosx – Embarcadero Delphi for Mac OS X compiler version 26.0 – the Delphi compiler that generates 32-bit OS X apps
  • dccios32 – Embarcadero Delphi Next Generation for iPhone Simulator compiler version 26.0 – the NextGen Delphi compiler that builds Intel executables that run in the iOS simulator
  • dcciosarm - Embarcadero Delphi Next Generation for iPhone compiler version 26.0 – the NextGen Delphi compiler that builds ARM executables that run on iOS devices
  • dccaarm – Embarcadero Delphi for Android compiler version 26.0 – the NextGen Delphi compiler that builds ARM executables that run on Android emulators and devices

Android requirements

Because the Delphi compiler generates native machine instructions, its output is processor-specific. In other words it doesn’t target the Dalvik Virtual Machine, where regular Android applications reside, which are basically Java p-code applications that are executed by a variant of the Java VM. Instead it generates raw machine code, as all the current wave of Delphi compilers do (the long gone Delphi for .NET was the exception to this general rule). So because it’ a compiler compiling native machine instructions Delphi’s Android support has the following requirements:

  • there must be a GPU
  • the CPU must be ARMv7 with NEON instruction support
  • the OS on the target device must be one of:
    • GingerBread: Android 2.3.3+ (MR1 or later), which is API level 10
    • Ice Cream Sandwich: Android 4.0.3+ (MR1 or later), which is API level 15
    • Jelly Bean: Android 4.1+ (release, MR1, MR2 or later), which are API levels 16, 17 and 18
  • you can run the app on an Android emulator if:
    • the emulator is set to use the host GPU
    • the emulator is running Ice Cream Sandwich (MR1 or later) or Jelly Bean (release or later)
    • the emulator is not running in a Virtual Machine

These requirements appear here and there in the documentation, mostly concurring with itself: 1, 2, 3. [Update: the 3rd link is new and also lists various devices that FireMonkey apps have been tested on]

[Edit: It should be noted that the Android emulator is an *emulator* – it emulates ARM instructions when set up as an ARM emulated device. This is in contrast to the iOS simulator, which simulates an iOS device by running an Intel code version of the app, where the real iOS app again will be built with ARM instructions for the iOS device ARM chip. The implication of this is that the performance is atrocious and extremely disappointing for most. As Warren Postma details in XE5 Trial Download and Install Experience, you would really be advised to get a cheap Android tablet to test on, and use the emulator as a last resort.]

[Edit: I should add that if you are going to get a cheap Android device to test your apps then you should most definitely take steps to ensure it meets the minimum specifications required by a Delphi application – it must have an ARMv7 chip that supports NEON instructions and be running an appropriate OS version. Thanks for the reminder on that, Jolyon]

How do you find out if your device is supported? Well, the OS version you can find out in the Settings. The path and menu items may vary but goes roughly like this: Settings, About phone (or tablet), Software information, Android version.

To check the CPU details you’ll need to run one of the tools from the Android SDK against your connected device. Delphi installs the Android SDK and NDK if you don’t tell it you have it pre-installed. The Android SDK gets installed into a directory something like: C:\Users\Public\Documents\RAD Studio\12.0\PlatformSDKs\adt-bundle-windows-x86-20130522\sdk. In the platform-tools subdirectory from there is the Android Debug Bridge, adb.exe.

To run a command against your device it needs to be connected, typically by USB. This requires you to install an appropriate USB driver for your device as the ones located by Windows typically don’t do the job. Refer to the helpful The Delphi Geek blog post on the matter, XE5 and USB Drivers, for more information and links to drivers for the more common Android phone manufacturers.

When your phone is connected you’ll need to launch a command prompt and run an adb command. This may be easiest if you change directory to the platform-tools subdirectory (or Shift+right-click on the platform-tools folder in Windows Explorer and choose Open command window here). Firstly run the command:

adb devices

just to prove that your device can be seen by the Android tool chain. Assuming it can, run:

adb -d shell cat /proc/cpuinfo

This will show you CPU information something like this:

Processor       : ARMv7 Processor rev 0 (v7l)
processor       : 0
BogoMIPS        : 13.52

processor       : 1
BogoMIPS        : 13.52

processor       : 2
BogoMIPS        : 13.52

processor       : 3
BogoMIPS        : 13.52

Features        : swp half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpv4

CPU implementer : 0x51
CPU architecture: 7
CPU variant     : 0x1
CPU part        : 0x06f
CPU revision    : 0

Hardware        : UNKNOWN
Revision        : 0003
Serial          : 0000000000000000

Check the Processor line to ensure you are running ARMv7. In the Features line check that neon is included in the CPU feature list

Product Launch

There have been various events worldwide over recent fays and more coming in the days ahead, spreading the word about the new Android support in Delphi XE5. Today I attended the London event, which was held in a theatre in the Natural History Museum.

NHM

Embarcadero’s JT was over to help with the launch, and also on stage were Jason Vokes and Steve Ball.

I was a long way back in the audience with the zoom on my telephone’s camera on maximum. But this was the theme for the day.

Delphi.Android

Addenda

If you are keen to try out Delphi’s Android support, go right ahead and start downloading and installing. However I would urge you to read up on how Android development works whilst the download/install process takes place. There are many docwiki pages that help you get a handle on how it all fits together with the main entry point here: Android Mobile Application Development. A whole bunch of subtopics are listed here.

Recent posts about Delphi’s Android support, which pre-dated today’s launch, include the following:

In a previous blog post I discussed the Objective-C Bridge, available when building iOS apps. This is part of the RTL that allows Delphi code to interact with Objective-C API code. Objective-C code is compiled native code and Delphi code is compiled native code, so the bridge allows the two sets of code to get along. You can define Delphi versions of iOS classes (rather akin to how you can declare Delphi versions of Win32 API functions in classic Delphi), create instances of Objective-C classes, inherit from Objective-C classes and generally do what is necessary to access parts of the CocoaTouch API that are not consumed and surfaced by FireMonkey or parts of the API that do not have similar behaviour exposed by FireMonkey.

Oh, I should mention it’s not so much called FireMonkey now. It seems to be getting referred to more and more as the FM Application Platform. I suspect the latter sounds a little more “business”-y.

Anyway, the Android support offers a similar API bridge called the Java Bridge. Now the Android SDK classes are Java classes living in the world of the Dalvik VM. Delphi code is machine code running on the CPU. This is different to the iOS case. So the Java Bridge uses JNI to communicate across the native/managed boundary but basically offers broadly similar behaviour. You can declare Delphi versions of Android classes, create instances of them and communicate with them. So aspects of the Android API that do not get employed by regular Delphi apps can be accessed for the most part.

One shortcoming of the Java Bridge is that you cannot inherit from a Java class, which makes certain things rather tricky. However I’m going to write up my understanding of the Java Bridge and Objective-C Bridge in additional fuller articles with various examples over coming months, and try and offer ways around the Java Bridge shortcomings. Watch this space. Well, ok, you’d do better to read up on all the Android backgrounders in docwiki while downloading and installing XE5 :o)

Here are some more Embo pages for you to chew over and apply due consideration to:

Delphi Android dude

Thursday, 30 May 2013

Oxygene 6 now includes Oxygene for Cocoa

Ah, it’s been released… The May 2013 release of Oxygene, released on 27th May 2013, brings us Oxygene 6.0, and Oxygene 6.0 brings us the official release of Oxygene for Cocoa.

The Oxygene language now gives ways of coding for all the currently interesting platforms using the three available editions of Oxygene:

  • Oxygene for .NET (formerly also known as Delphi Prism) – targets the .NET platform, allowing you to build Windows applications, Windows phone applications, Silverlight applications and so on, using the relevant .NET frameworks. Also targets the Mono platform, allowing applications to go to the many places where Mono goes, such as Mac and Linux and also Android and iPhone/iPad using Xamarin.Android (aka Mono for Android) and Xamarin.iOS (aka MonoTouch) using those frameworks.
  • Oxygene for Java – targets the Java runtime, allowing you to build Java apps, Java servlets, Java applets and also, perhaps most interestingly, Android apps. Java apps will use your chosen Java frameworks and Android apps use the Android SDK framework.
  • Oxygene for Cocoa – targets iOS and OS X allowing native ARM applications to be built for iPhone and iPad as well as 64-bit native OS X applications. Applications are built against the native OS X Cocoa and iOS CocoaTouch frameworks.

Oxygene is hosted in Visual Studio 2012 (support for Visual Studio 2010 has now been phased out in Oxygene 6.0). If you don;t have a copy of Visual Studio 2012 the Oxygene installer can set up the Visual Studio 2012 shell first.

For existing users of Oxygene for .NET and/or Oxygene for Java there are some new features added to Oxygene 6.0, including a spate of new conditional defines to help distinguish which compiler built your code or which platform you are targeting:

Oxygene 6.0 edition Edition define Platform define GC/ARC define
.NET ECHOES DOTNET GC
Java COOPER JAVA GC
Cocoa NOUGAT COCOA ARC

However the main thrust of the release is Oxygene for Cocoa, which works in conjunction (if you want) with Apple’s UI designer to support visual UI design via nib (.xib) files or storyboard files. It also understands and fully supports multi-part method names so that it fits in directly with the Objective-C naming system and can represent and refer to any existing methods. It support the iOS Simulator, supports debugging there and on-device and offers all the options needed to sign and provision your apps. It supports ARC (automatic reference counting), understands bridging and uses an LLVM back-end to generate good ARM and 64-bit Intel code.

It ships with all the standard frameworks imported and has a tool that allows you to import any additional libraries you need to work with. Because Oxygene always uses the frameworks that natively exist on the target platforms, there is not an awful lot to learn specific to Oxygene when building Mac or iOS apps. Anything you learn on the Internet about how to build aspects of Mac/iOS apps applies directly – it’s just a case of expressing the various local API calls in the Oxygene syntax, which is a very familiar Object Pascal based syntax.

During pre-release development Oxygene for Cocoa was called Project “Nougat” and I worked with it a lot to keep tabs on how it progressed. I’ve built a whole bundle of test apps to keep on top of (mostly) iOS application development techniques by simply following various online Objective-C tutorials, and just entering the code in Pascal instead of in Objective-C.

I’m delighted Oxygene for Cocoa is now released as I’ve been productive with the tool for quite a long time now. I’ve wanted to make blog posts about how I do thing with it, but given it’s just a syntax shift there hasn’t really been much of a need for it. I guess maybe I’ll do one at some point to show the basics of building up an iOS app in the Visual Studio IDE and getting it launching in iOS Simulator, but after that it’s just writing code in the same way any other iOS developer does; just in Pascal.

On June 17th I’ll be demonstrating the product with a talk at a Developers Group meeting in Maidenhead, UK.

You can find more information about Oxygene for Cocoa at these links:

Buying Oxygene is reasonably pocket-friendly. If you’re new to it then $699 gets you all three versions. Otherwise there is a $499 renewal price for existing Oxygene for Java or Prism customers, a $599 cross-grade price for any users of Embarcadero Delphi or of older Embarcadero Prism versions (XE2 and below) and also a $99 academic price.

If you want to see how you get on with Oxygene 6.0 without committing you can always pull down a trial version first.

Thursday, 23 May 2013

Windows Tools

I’ve long been a fan of the SysInternals looks from Mark Russinovich, available from Microsoft Technet (or this shorter alias: sysinternals.com). These include:

  • Process Explorer – a Task Manager replacement that gives oodles of information about running processes
  • Process Monitor – a tool that shows live file, registry and network access
  • AutoRuns – a tool that shows all the things that have set themselves up to auto-start with your system

Use of these tools has helped solve many a problem. But I’ve just bumped into another splendid process analysis tool called Process Hacker. This one is open source and accessible from SourceForge. It can drill down and show additional information that Process Explorer misses, such as showing programs with active network connections, management of services and real time disk access.

This looks great; a very useful addition to the problem-solving arsenal!

Monday, 22 April 2013

Delphi for iOS (aka Delphi XE4 aka RAD Studio XE4) has appeared

We’ve heard lots of noises about Embo’s pending Delphi support for iOS over the last 6 months or more and now the wait is over.

RAD Studio XE4 Installer

The iOS support has arrived, but not as the largely expected add-on to XE3, but instead as a new version: XE4 (available with or without iOS support). Delphi XE4 has arrived (along with C++Builder XE4 and RAD Studio XE4) and now targets:

  • 32-bit Windows
  • 64-bit Windows
  • 32-bit OS X
  • iOS Simulator (Intel)
  • iOS (ARM)

There is a flurry of activity about this new release over the blogosphere and here’s a summary of the key points regarding information about the product and regarding the product itself.

Information

Product details

The main thrust of this release is the Delphi support for iOS, specifically two new cross-compilers that support targeting the iOS simulator (Intel) and native iOS (ARM) called dccios32.exe and dcciosarm.exe.

As you might expect there have been a raft of changes in FireMonkey to support this wider platform range and improve the existing platform support. Indeed FireMonkey has now changed from being known as FM2 to now being FM3. The online help has much information on the changes to FireMonkey.

The IDE has new mobile form designers (no longer floatable although see François’ post here if you really want a floating designer for VCL development) and new target platforms to get your app on the simulator or iOS device. Of course FireDAC is in the box too.

InterBase ToGo is now supplied as an option for an embedded database in your application, including iOS applications. Note that InterBase ToGo requires a license to be bought, whereas IBLite does not (and also does not support encryption, more than 1 core, more than 1 connection, etc.). More info on InterBase ToGo is available in this quick-start guide.

iOS support has been added for SQLite, IBExpress and the MIDAS client components (notably TClientDataSet).

The iOS compilers introduce the Next Generation Delphi language, which some of you will have seen hints of in the Delphi XE3 source code via the NEXTGEN conditional compilation symbol that is checked for in many places. This Next Generation Delphi support is currently only available in the iOS compilers, though it’s a safe bet we’ll also see it in the Android compiler, whenever that appears.

The Next Generation Delphi compiler takes the opportunity to off-load some aspects of the Delphi language that are a little archaic and at the same time bring in some new helpful features.

Things that have gone/changed include:

  • Some of the many string types have gone (AnsiString, UTF8String, RawByteString, WideString, AnsiChar, PAnsiChar, PWideChar, OpenString, ShortString) leaving just the basic type string , an alias for UnicodeString.
  • Pointer support is gone. For interfacing with external library APIs there is a new TMarshaller record, which works with the TPtrWrapper record.
  • Strings are 0-indexed instead of 1-indexed by default. It is recommended you employ TStringHelper (introduced in XE3) to work with strings as it knows about the string indexing on the different platforms.
  • Strings are to be considered immutable. Currently you can change string contents but will get a warning for your trouble. This is to encourage you to change the code to use a TStringBuilder to build a new string. Future versions may change the warning to an error.
  • Inline assembler support is gone.
  • You are advised to rewrite code that uses with as this is likely to be removed in future versions. I can see the benefit in enforcing this, as I have bumped into so many scope errors caused by over-zealous with usage over the years…

New things include:

  • Automatic Reference Counting (ARC) for objects.
  • Weak references
  • Atomic intrinsic functions:
  • New predefined conditional symbols (* the content of this table is subject to change based on proper testing - the corresponding documentation page is incomplete/incorrect, so some educated guesswork has gone on thus far):
    Symbol:

    Defined:

    For compilers:
    AUTOREFCOUNT if ARC is available dcciosarm, dccios32
    CPUARM if the CPU is ARM-based dcciosarm
    EXTERNAL_LINKER for compilers with an external linker dcciosarm, dccios32
    IOS target platform is iOS dcciosarm, dccios32
    NEXTGEN for Next Generation Delphi compiler dcciosarm, dccios32
    UNDERSCOREIMPORTNAME for compilers that add leading underscores when importing libs dcc32, dccosx, dccios32
    WEAKREF for compilers that can use weak references dcciosarm, dccios32
    WEAKINSTREF when weak references are defined for instances dcciosarm, dccios32
    WEAKINTFREF when weak references are defined for interfaces dcciosarm, dccios32
  • New compiler directives:
    • {$ZEROBASEDSTRINGS ON/OFF} controls whether 0-based or 1-based string indexing is active. You can, for example, use this to force 1-based indexing in mobile code that you haven’t yet updated
    • {$EXTENDEDCOMPATIBILITY ON/OFF} allows use of Extended data type on platforms that do not normally support it (Win64 and iOS). The given support offers the expected 10 bytes storage but doesn’t offer the higher floating-point support that Win32 Extended gives.
  • New compiler attributes:
    • [volatile] to indicate the field may be changed by other threads (it’s a hint to the code optimiser).
    • [weak] to mark a weak reference.
    • [Ref] to ensure constant parameters are passed by reference rather than by value.

Given these changes there is a page that talks about how to migrate code from the desktop to iOS.

Taking all the above onboard, it looks currently like Embo offer a common component framework (also, slightly confusingly, referred to as a platform) to program against for different target platforms (Win32, Win64, OS X, iOS) in FireMonkey (aka FMX aka FM3). As for your Delphi code, however, it would currently appear that desktop code and mobile code will look a bit different, thanks to the string changes (1-indexing to 0-indexing and the push towards immutability) and of course the specific form factors of the UI on the respective platforms.

So, you build a mobile UI and you build a desktop UI. With the desktop UI you take great care to ensure the app looks like a Windows app when compiled for and running on Windows (menu layout, button order and placement on dialogs), and looks like a Mac app when compiled for and running on OS X.

Then when you come to build the code base, you write it once for the desktop using all the standard Delphi-desktop paradigms of creating objects and ensuring they are destroyed with try/finally/free/end. On the mobile side you skip all that and let objects be cleaned up by ARC, and ensure weak references are specified where appropriate.

I’m sure the desktop compiler will catch up with these changes at some point, but in the interim there is a requirement for quite a bit of conditional compilation, or making use of no-op calls in the mobile code. And if/when the desktop compiler catches up, that will potentially force a big hit in massaging desktop code into the new realm of Next Generation Delphi.

It’s all a bit up in the air as to how things will pan out, but to my eyes currently, the only common thing is the FireMonkey framework. Other than that, the coding and design looks to require dedication per platform targeted. Which is no bad thing. In my opinion, when targeting a given platform you should put some effort into making sure the application works gracefully and looks in keeping with its peers.

With that mindset in place, the iOS support looks pretty neat and the changes to the language make Delphi behave a little more like many of the other popular languages in existence. I’ve certainly got no issues with kicking out with and dropping to a single string type. Let’s just be careful to not play the “write once run anywhere” card too frequently, eh?

[Updates]

I added a link to François Piette’s article about re-enabling the floating form designer (only advisable if you develop solely for VCL).

I added a link to the QC fix list for XE4.

Friday, 8 March 2013

More on FireDAC

I’ve yet to pull down and start playing with FireDAC, but it was featured in an Embarcadero event in London yesterday (Thursday). Some points with it were clarified by DavidI, which I thought were quite enlightening:

  • As well as Embarcadero acquiring the intellectual property and all that goes with AnyDAC from DASoft, the original AnyDAC developer, Dmitriy Arefief, is now on a very long-term contract with Embarcadero to keep the development of the product moving forwards.
  • FireDAC is intended as the replacement for dbExpress (DBX). Ultimately dbExpress will be deprecated, but doubtless will still be available for many versions to come (after all, WebSnap is still shipped in the box and hasn’t been focused on for a long time).
  • DataSnap currently relies on dbExpress and Indy. Over time DataSnap will be worked on to make use of FireDAC instead of DBX.
  • FireDAC was attractive to Embarcadero as it covers a much wider range of databases when compared with DBX: Oracle, DB2, SQL Server, InterBase/Firebird, PostgreSQL, MySQL, SQLite, Sybase SQL Anywhere, Advantage DB and Access, along with support for ODBC and dbExpress drivers. It also has a number of useful features, including a performance monitor (ADMonitor), a database explorer (ADExplorer) and a migration tool to convert BDE apps to use FireDAC components.

Additionally, I see in the FireDAC FAQ that if you are not yet an XE3 user you can still make use of FireDAC in older IDEs by installing it with a particular command-line parameter. According to Marco Cantù the command-line for installation into XE2 is /IDE:DXE2. However I’m not sure how many versions back are supported.

[ Edit: there is now a support article showing how to install into any IDE using the installer’s /showide command-line switch ]

Another change with the AnyDAC –> FireDAC transition is the dropping of support for Lazarus/Free Pascal Compiler, so Linux targeting is now out of the question. If you’re a Delphi customer, this is unlikely to ruffle your feathers, but I guess Lazarus users might be more rightfully irked.

Thursday, 28 February 2013

Hello FireDAC

Yes, I’m sure you saw everyone else’s posts on the matter, but just to be sure, I thought I’d draw your attention to the newly launched FireDAC data access layer (just announced), the result of Embarcadero’s recent acquisition of DASoft’s AnyDAC.

It’s a free download if you have the Enterprise (or higher) version of Delphi, C++Builder or RAD Studio or can be purchased as an add-on (the FireDAC Client/Server Pack) if you have the Professional version (and yes, there’s an offer for current owners of AnyDAC or the XE2 Client/Server Pack.

Click here for the FireDAC FAQ and click here for the FireDAC documentation.

Wednesday, 10 October 2012

Embarcadero Developer Direct webinars return

After a good run of Developer Direct webinars over the summer, the Embo guys return with another ten 2 hour online sessions each Friday starting this coming Friday 12th October, 2012. The running times for the sessions are:

  • 10:00-12:00 London
  • 11:00-13:00 Frankfurt/Paris
  • 13:00-15:00 Moscow
  • 14:30-15:30 Mumbai/Bangalore

You can sign up to the series by using this link and that gets you access to any or all of the following sessions:

Episode Date Topic
1 12 October 2012 RAD Studio XE3 - The Story So Far!
2 19 October 2012 Be Agile Today! - Developer Workflow
3 26 October 2012 FM2 - FireMonkey in Action
4 02 November 2012 Language Focus (Object development, RTTI, 64 Bit)
5 09 November 2012 Mac Development for Windows Developers
6 16 November 2012 From Data to Business Information with RAD Studio XE3
7 23 November 2012 Web and Mobile apps using HTML5 and CSS3
8 30 November 2012 Multi-tier, Scalable Development and Deployment
9 07 December 2012 Windows 8 - Opportunities and Considerations for Developers
10 14 December 2012 Season Summary Session

Tuesday, 2 October 2012

Windows tips

I like to consider myself reasonably competent in using Windows having picked up a whole bunch of tips, techniques and shortcuts over the many years (approximately 21) I’ve been using and programming against various versions of it.

For example, I’m one of a shrinking number of people who know that in a multi-selection list box with extended selection enabled (as opposed to a list view, just to be clear) you can press Shift+F8 to enter keyboard-driven multiple selection mode where Space toggles the selection of the current item and Shift+F8 or Esc leaves this selection mode. And I’ve know this since the days of Windows 3, before Raymond Chen made it more widely known in a 2006 post. Whilst on the subject of list boxes it’s also no longer well known that Ctrl+/ and Ctrl+\ perform select all items and select current item respectively.

However I’m always happy to pick up new tricks. I’ve bumped into a few recently and would like to share them with you.

Thursday, 20 September 2012

Windows 8 Boot Manager – Goodbye

I’ve split my hard disk into a couple of partitions and am dual booting Windows 7 and Windows 8. Consequently I have the Windows boot manager pop up to give me a choice of OS to boot into for 30 seconds, before the default OS (Windows 8) is launched. One rather annoying thing I’ve discovered about Windows 8 is its new boot manager and the amount of time it takes to show up on power up or system restart.

Windows 8 boot manager

To be fair, the new boot manager looks much more appealing to the eye than the last one, which was old school text mode. It’s had quite some work done to it to ensure that it will be usable and appealing even on a keyboard-less Windows RT ARM device. You can read about the boot manager’s evolution on the Windows Team‘s blog post.

Windows 7 boot manager

The new one supports touch and sports the modern "Windows Store app" appearance(y'know, the "Metro" style...). It does certainly look pretty swish and makes the previous version look rather archaic. Additionally, when you choose Windows 8 from the boot menu, Windows 8 appears very quickly afterwards.

All good points for the Windows 8 boot manager, right? Right.

However, the boot manager itself takes a really long time to wind itself up and display the options. That's because it requires a good chunk of Windows 8 to be loaded up in order to do so, which of course then explains why Windows 8 can start so quickly after being chosen from its boot manager.

If I want to boot to Windows 7 then I have to wait for a good chunk of Windows 8 to load in order to be presented with the option of booting to Windows 7, which then results in the machine restarting, and popping out of the BIOS screen into the Windows 7 startup sequence.

So the question is: can I get my old, simple, text mode boot manager back?
The answer is: yes.

There's two approaches to sorting this. One is simply switching which the default boot OS is. When Windows 8 is the default OS to boot to you get the Windows 8 boot manager, when Windows 7 is the default OS to boot to you get the old Windows 7 boot manager. The other is to tell Windows 8 to use the 'legacy' boot manager instead of the 'standard' one, which then means the text mode boot manager appears regardless of which OS has been set to be the default.

Let's take a look at these two options.

Wednesday, 19 September 2012

Windows 8 ‘Camp In A Box’

For the last few months Microsoft has been running Windows 8 free developer events around the world (Dev Camps) called 'Windows 8 Camps'. They are still going on so do check the ongoing schedule on the Microsoft site.

If you've been along to one of them you'll have picked up a lot of information about Windows 8, its capabilities and how you take advantage of them in code. The hands-on labs from the Windows 8 Camp have been made available to anyone interested, but until recently the resources were still specific to pre-release versions.

As of a couple of days back the Windows 8 Camp In A Box is now available updated to the RTM version of Windows 8. You can either pull down a version for C# and XAML, or a version for JavaScript and HTML. Both are available at this download link and both come in at approximately 143MB.

This is definitely worth pulling down. It's an entirely self-contained training lab that takes you through all the steps of building up a nice, functional Windows 8 app. Enjoy!

[ UPDATE: this Camp-in-a-Box runs through the development of a Windows 8 cookbook application called the Contoso Cookbook, along with application. The installable also adds in a variety of useful presentations and resources.

It seems there is also a cut down version of the same kit without the presentations and additional resources at this download link, where the downloads are a little over 60 MB.

Finally, there is a mass of pre-fabricated Windows 8 sample apps set up to run with the RTM version of Visual Studio 2012, which can be pulled down for either C++, C#, JavaScript or VB.NET. Those are available from this link. ]

Monday, 17 September 2012

Visual Studio 2012 and those... CAPS

Anyone who’s glimpsed Visual Studio 2012 has seen it shouting at them and wondered why, given the luxury of having both lower and upper case available, Microsoft has chosen to go for all upper case in the menu bar. Well, if you really want to know, read the post on The Visual Studio Blog as that explains their reasoning.

I read it. To be honest it didn’t seem very convincing. There is mention of All Caps being a strong signature element of styling for navigation in Microsoft UIs. They do point at some upper case in a web site and on the Zune, but given the main UI thrust at the moment is Metro^H^H^H^H^H the Modern UI in Windows 8 and on Windows Phone and those don’t appear to focus on upper case I remain dubious.

I am aware that Office 2013 will also be using the upper case motif (you can see it here). This to me and to many who share a certain sensitivity of eyesight is somewhat regrettable.

Fortunately, with Visual Studio at least, you can instruct it to forget all about the upper case fad and just ‘be normal.’ This involves a little registry hackery. Run regedit.exe and in the HKEY_LOCAL_MACHINE hive navigate to the Software\Microsoft\VisualStudio\11.0\General subkey. Add in the DWORD SuppressUppercaseConversion and give it a value of 1. As you might expect, a value of 0 reverts to the short-sighted choice of upper case again.

This trick is getting reasonably well known around the Arpanet, but I’m posting it to help ensure the message is spread as far and as wide as feasible. I’ll cross my fingers that Office 2013 also offers up a trick available to turn off its SHOUTY MENUS.

Windows 8 keystrokes

If you’re an old school computer user then whilst getting the hang of Windows 8 you’ll bump into a whole heap of keystrokes that will help make it dance to your tune. Here’s the list of useful keystrokes I’ve found that work in Windows 8, for when you get around to upgrading from Windows 7 (the shortcut keys for that are listed here).

Note that this table uses the Windows key (or WinKey) character (ÿ). Since Unicode has no character for this image I’m explicitly referencing Microsoft’s WingDings font character 255 so it probably looks all yucky a Mac, given Macs don’t have the WingDings font available by default.

Some of the shortcut keystrokes have been redefined since Windows 7. For example the desktop peek keystroke was ÿ+Space but has now been re-mapped as ÿ+, and ÿ+Space now means something else. Also, ÿ+Space no longer invokes the Windows Mobility Centre but displays the Quick Link menu instead.

Also, some keystrokes have gone, such as ÿ+G, which is no longer required thanks to Windows Gadgets not being supported by Windows 8.

Shortcut    aka Meaning
Ctrl+Shift+Esc   Invoke Task Manager or whatever replacement you might have installed, such as Process Explorer from SysInternals
Alt+Tab   Cycle through "Metro" (Windows 8) and desktop apps
Alt+Shift+Tab   Cycle through "Metro" (Windows 8) and desktop apps in reverse order
Alt+Esc   Switch to next desktop app in Alt+Tab list
Alt+Shift+Esc   Switch to previous desktop app in Alt+Tab list
ÿ+B WinKey+b Give focus to Task Bar’s notification area so arrow keys can move between notification icons, Enter can select them (like clicking them with the mouse), Shift+F10 can show context menu, Shift+Tab can move focus to notification area etc.
ÿ+C WinKey+c Display the Charms bar. Equivalent to moving the mouse to the right edge of the screen or swiping in from the right edge of the screen.
ÿ+D WinKey+d Toggle show desktop
ÿ+E WinKey+e Windows Explorer
ÿ+F WinKey+f Open Search Charm and do a search on Files
ÿ+H WinKey+h Open Share Charm
ÿ+I WinKey+i Open Settings Charm
ÿ+J WinKey+j Switch the main app and snapped app
ÿ+K WinKey+k Open Devices Charm
ÿ+L WinKey+l Lock workstation
ÿ+M WinKey+m Minimise all desktop app windows
ÿ+Shift+M WinKey+Shift+m Restore all desktop app windows
ÿ+O WinKey+o Lock device orientation
ÿ+P WinKey+p Invoke the presentation menu to allow options of displaying on computer only, duplicating to external display, extending to external display or displaying on external display only
ÿ+Q WinKey+q Open Search Charm and do a search on Apps
ÿ+R WinKey+r Run a command
ÿ+T WinKey+t Give focus to Task Bar so arrow keys can move between Task Bar items, Enter can select them (like clicking them with the mouse), Shift+F10 can show context menu, Tab can move focus to notification area etc. Repeated presses of the keystroke cycles through the buttons on the Task Bar
ÿ+U WinKey+u Windows Ease of Access Centre
ÿ+V WinKey+v Cycle through notifications
ÿ+Shift+V WinKey+Shift+v Cycle through notifications in reverse order
ÿ+W WinKey+w Open Search Charm and do a search on Settings
ÿ+X WinKey+x Opens Quick Link menu
ÿ+Z WinKey+z Show app commands. Equivalent to right-clicking a general area of the application.
ÿ+Break WinKey+Break Windows System properties
ÿ+F1 WinKey+F1 Windows help
Prt Sc Print Screen Copy a screenshot to the clipboard
Alt+Prt Sc Alt+Print Screen Copy a screenshot of just the focused window to the clipboard
ÿ+Prt Sc WinKey+Print Screen Save a screenshot as a PNG in logged on user’s My Pictures folder
ÿ+Tab WinKey+Tab Cycle through "Metro" (Windows 8) apps
ÿ+Shift+Tab WinKey+Shift+Tab Cycle through "Metro" (Windows 8) apps in reverse order
ÿ++ WinKey+Plus Zoom in (via Magnifier, which autostarts)
ÿ+- WinKey+Minus Zoom out (via Magnifier)
ÿ+Esc WinKey+Escape Cancel zoom, if enabled
ÿ+. WinKey+Period Cycle through snapping an app to the right, to the left and unsnapping it
ÿ+Shift+. WinKey+Shift+Period Cycle through snapping an app to the left, to the right and unsnapping it
Alt+↑ Alt+Up Arrow In Windows Explorer navigate one folder up in the folder hierarchy
Ctrl+Shift+N   In Windows Explorer this creates a new folder
Alt+Enter   Equivalent of right-clicking an item in Windows Explorer and choosing Properties
Shift+right-click on an item in Windows Explorer Enables extended Send To menu (has many more items in it). Also adds Copy as Path to the context menu.
Shift+right-click on a folder Adds in context menu command: Open command window here. This starts cmd.exe with the current directory being the folder in question.
Ctrl+Shift+Enter   In Start screen's Apps search results launches app as Administrator
Shift+Alt+Prt Sc left Shift+left Alt+Print Screen Toggle High Contrast mode
Ctrl+Alt+↑ Ctrl+Alt+Up Arrow Rotate screen to default orientation default
Ctrl+Alt+→ Ctrl+Alt+Right Arrow Rotate screen orientation 90 degrees from default
Ctrl+Alt+↓ Ctrl+Alt+Down Arrow Rotate screen orientation 180 degrees from default
Ctrl+Alt+← Ctrl+Alt+Left Arrow Rotate screen orientation 270 degrees from default
ÿ+, WinKey+Comma Makes all windows transparent so you can see the desktop until you release the keys. Equivalent to (invisible) desktop peek button to right of Task Bar’s notification area. This was done by ÿ+Space in Windows 7
ÿ+↑ WinKey+Up Arrow Maximise window. Same as dragging window’s title bar to top of screen.
ÿ+↓ WinKey+Down Arrow Restore maximised window, or minimise restored window
ÿ+← WinKey+Left Arrow Alternately expand windows to fill left half of screen, expand to fill right half of screen or restore to previous size. Dragging window’s title bar to left edge of screen also expands window to fill left half of screen.
ÿ+→ WinKey+Right Arrow Alternately expand windows to fill right half of screen, expand to fill left half of screen or restore to previous size. Dragging window’s title bar to right edge of screen also expands window to fill right half of screen.
ÿ+Home WinKey+Home Minimise all but the active window. You can get the same effect by clicking on a window’s title bar and shaking it about (known as Aero Shake)
ÿ+Shift+↑ WinKey+Shift+Up Arrow Maximise window vertically (leave width unchanged). This is the same as double-clicking the window’s top or bottom resize border
ÿ+Shift+← WinKey+Shift+Left Arrow Move window to the monitor on the left
ÿ+Shift+→ WinKey+Shift+Right Arrow Move window to the monitor on the right
ÿ+PgUp WinKey+Page Up Move Start screen and "Metro" (Windows 8) apps to the monitor on the left
ÿ+PgDn WinKey+Page Down Move Start screen and "Metro" (Windows 8) apps to the monitor on the right
ÿ+<digit> WinKey+<a number> Start app pinned on the Task Bar at the position corresponding to the number pressed, or switch to it if already open
ÿ+Shift+<digit> WinKey+Shift+<a number> Start new instance of app pinned on the Task Bar at the position corresponding to the number pressed. Shift-clicking the item does the same.
Shift+click a Task Bar button   Same as ÿ+Shift+<digit>
ÿ+Ctrl+Shift+<digit> WinKey+Ctrl+Shift+<a number> Start new instance of app pinned on the Task Bar at the position corresponding to the number pressed running as administrator. Ctrl+Shift-clicking the item does the same.
Ctrl+Shift+click a Task Bar button   Same as ÿ+Ctrl+Shift+<digit>
ÿ+Ctrl+<digit> WinKey+Ctrl+<a number> Cycle through open windows of app pinned on the Task Bar at the position corresponding to the number pressed
ÿ+Alt+<digit> WinKey+Alt+<a number> Show the Jump List for the item on the Task Bar at the position corresponding to the number pressed
Shift+right-click a Task Bar button   Show XP-style Window menu
Ctrl+click a grouped Task Bar button   Cycle through the windows of the group
ÿ+Space WinKey+Space Switch input language and keyboard layout
ÿ+Ctrl+Space WinKey+Ctrl+Space Switch to previous input language and keyboard layout

Windows 7 keystrokes

Having recently settled into regularly using Windows 8 I’ve also just bumped into a new Windows 7 keystroke that I hadn’t previously been aware of. It seems that the enhanced Task Bar, which you can pin application shortcuts to, has shortcut keystrokes related to those pinned items: Windows key + a digit, where the digit represents the pinned item’s position on the Task Bar. For a pinned item that is not running, the shortcut launches that app. If the pinned item is already running the shortcut switches to that item.

For example, if you have Google Chrome pinned as the third item on your Task Bar, then Win+3 will either switch to Chrome, or launch it if it’s not already running. Simple.

Inspired by this I did some digging to check out what other keystrokes were introduced by Windows 7 (granted some of them may have come from Vista, but I’m not sufficiently interested to work out which – let’s just say they are new when compared to Windows XP). It seems there are quite a few. I’d encountered most of them before, but some of them were definitely new to me. You can see what I’ve found below – I’ve also added them all to my Commands and Keyboard Shortcuts page. I’ll look at the new Windows 8 keystrokes in a separate post.

Note that this table uses the Windows key (or WinKey) character (ÿ). Since Unicode has no character for this image I’m explicitly referencing Microsoft’s WingDings font character 255 so it probably looks all yucky a Mac, given Macs don’t have the WingDings font available by default.

Shortcut    aka Meaning
ÿ+Tab WinKey+Tab Glitzier version of Alt+Tab
ÿ+Shift+Tab WinKey+Shift+Tab Glitzier version of Alt+Shift+Tab
ÿ++ WinKey+Plus Zoom in (via Magnifier)
ÿ+- WinKey+Minus Zoom out (via Magnifier)
ÿ+Esc WinKey+Esc Turn off zoom, if active
ÿ+G WinKey+g Cycle between the Windows Gadgets on the desktop
Alt+↑ Alt+Up Arrow In Windows Explorer navigate one folder up in the folder hierarchy
Ctrl+Shift+N   In Windows Explorer this creates a new folder
Shift+right-click on an item Enables extended Send To menu (has many more items in it). Also adds Copy as Path to the context menu.
Shift+right-click on a folder Adds in context menu command: Open command window here. This starts cmd.exe with the current directory being the folder in question.
Ctrl+Shift+Enter   In Start menu's search box launches as Administrator
Prt Sc Print Screen Copy a screenshot to the clipboard
Alt+Prt Sc Alt+Print Screen Copy a screenshot of just the focused window to the clipboard
Shift+Alt+Prt Sc left Shift+left Alt+Print Screen Toggle High Contrast mode
Ctrl+Alt+↑ Ctrl+Alt+Up Arrow Rotate screen to default orientation default
Ctrl+Alt+→ Ctrl+Alt+Right Arrow Rotate screen orientation 90 degrees from default
Ctrl+Alt+↓ Ctrl+Alt+Down Arrow Rotate screen orientation 180 degrees from default
Ctrl+Alt+← Ctrl+Alt+Left Arrow Rotate screen orientation 270 degrees from default
ÿ+Space WinKey+Space Makes all windows transparent so you can see the desktop until you release the keys. Equivalent to desktop peek button to right of Task Bar’s notification area. This is known as Aero Peek.
ÿ+↑ WinKey+Up Arrow Maximise window. Same as dragging window’s title bar to top of screen.
ÿ+↓ WinKey+Down Arrow Restore maximised window, or minimise restored window
ÿ+← WinKey+Left Arrow Alternately expand windows to fill left half of screen, expand to fill right half of screen or restore to previous size. Dragging window’s title bar to left edge of screen also expands window to fill left half of screen.
ÿ+→ WinKey+Right Arrow Alternately expand windows to fill right half of screen, expand to fill left half of screen or restore to previous size. Dragging window’s title bar to right edge of screen also expands window to fill right half of screen.
ÿ+Home WinKey+Home Minimise all but the active window. You can get the same effect by clicking on a window’s title bar and shaking it about (known as Aero Shake)
ÿ+Shift+↑ WinKey+Shift+Up Arrow Maximise window vertically (leave width unchanged). This is the same as double-clicking the window’s top or bottom resize border
ÿ+Shift+← WinKey+Shift+Left Arrow Move window to the monitor on the left
ÿ+Shift+→ WinKey+Shift+Right Arrow Move window to the monitor on the right
ÿ+T WinKey+t Give focus to Task Bar so arrow keys can move between Task Bar items, Enter can select them (like clicking them with the mouse), Shift+F10 can show context menu, Tab can move focus to notification area etc.
ÿ+B WinKey+b Give focus to Task Bar’s notification area so arrow keys can move between notification icons, Enter can select them (like clicking them with the mouse), Shift+F10 can show context menu, Shift+Tab can move focus to notification area etc.
ÿ+P WinKey+p Invoke the presentation menu to allow options of displaying on computer only, duplicating to external display, extending to external display or displaying on external display only
ÿ+<digit> WinKey+<a number> Start app pinned on the Task Bar at the position corresponding to the number pressed, or switch to it if already open
ÿ+Shift+<digit> WinKey+Shift+<a number> Start new instance of app pinned on the Task Bar at the position corresponding to the number pressed. Shift-clicking the item does the same.
Shift+click a Task Bar button   Same as ÿ+Shift+<digit>
Ctrl+Shift+click a Task Bar button   Open program as administrator
ÿ+Ctrl+<digit> WinKey+Ctrl+<a number> Cycle through open windows of app pinned on the Task Bar at the position corresponding to the number pressed
ÿ+Alt+<digit> WinKey+Alt+<a number> Show the Jump List for the item on the Task Bar at the position corresponding to the number pressed
Shift+right-click a Task Bar button   Show XP-style Window menu
Ctrl+click a grouped Task Bar button   Cycle through the windows of the group