23 Feb, 2009
A console application should always be designed to do whatever it is supposed to do and then exit without asking the user to press any key. The reason for this is that console applications are often used within scripts to automate several tasks. Obviously, you don’t want one console application launched by the script to wait until the user presses any key because that would be against the whole purpose of writing that script in the first place. However, sometimes it might be useful to pause the console application right before exiting. I wrote a small article that explains a way to add this support to your application elegantly without breaking support for scripting.
The article also shows how to detect that a new console was spawned on Windows. When you have a console application on Windows and you launch it by double-clicking its icon in Windows Explorer, a new console will be created but will disappear at the end of the execution and you probably won’t be able to read anything from the console. However, when you run your console application by typing the command in an existing console, your application will write all its output to that console and, when finished, you will be returned to the console prompt without the console being closed. There is a trick that can be used on Windows to automatically detect whether a new console window was opened or if your application was started from inside an existing console. The trick is to find out the cursor position in your console at the very beginning of your program. If the cursor position is (0,0), it is highly likely that a new console window was spawned. The article contains some source code to demonstrate this trick.
Read the full article.
23 Feb, 2009
Windows 7
Windows Vista comes with a built-in buffered animation API. This API makes it easy to make animations without flickering(*). I wrote a new article on CodeGuru that explains how to use this Buffered Animation API with C++.
The article comes with an example application to illustrate the Windows Vista buffered animation technique. The example will draw a new colored random rectangle in the window each time you press the spacebar. The new rectangle will smoothly fade onto the window. The buffered animation is used for this fading effect.
Read the full article.
(*) Note: While writing the article, I found an issue with the DWM in Windows Vista. After discussing with someone from Microsoft, it seems the buffered animation API is relying on some buffering from the DWM; however, on Windows Vista this is causing some flickering. They also told me that the buffered animation was not designed for big or full-screen animations but rather for small animations like fading buttons. To reduce the flickering as much as possible, only use the buffered animation on small rectangles and use a short animation interval, for example 500 milliseconds, which is more than enough for GUI related animations anyway.
The good news is that I tested the application on Windows 7 Beta and it works without any flickering. So, it seems that the DWM issue has been fixed on Windows 7.
23 Feb, 2009
Windows 7
The solution to fixing flickering issues when drawing graphics is to use double buffering. Double buffering basically means that an off-screen buffer is created. Everything is rendered to this off-screen buffer and, when drawing is completed, this off-screen buffer is copied to the screen. The end result is that you do not see any flickering and you do not see the drawing being created part by part. A little unknown fact is that Windows Vista has built-in support for double buffering, so managing off-screen buffers, copying data, and so forth are all managed by Windows for you. I wrote an article including an example on how to use this built-in support for double buffering with C++. This article has been published on CodeGuru.
Read the full article.
1 Feb, 2009
The following new features have been implemented in Wallpaper Cycler:
- You can now rotate any image by 90°, 180° or 270°.
- The N/A that was rendered to the desktop when something went wrong with processing a news feed can now be disabled in the global WPC settings. When disabled, WPC will not render any text when a news feed error happens.
- Also allow F2 and Slow Double Click to rename wallpapers, however, in that case a dialog pops up in which you do the renaming, because a warning message has to be displayed.
- You can now press CTRL+C in the EXIF data dialog to copy the selected EXIF data to the clipboard.
- A new option in Tools > Program Settings > Miscellaneous to disable the error balloons that are shown when something goes wrong while downloading a news feed.
- Added a button to the toolbar to quickly change the cycling settings (delay between wallpapers).
- Added a button to the toolbar to quickly change the cycling sound.
I made the following bug fixes for Wallpaper Cycler:
- Error messages during rendering appeared behind main WPC window, causing confusion.
- Calendar template “Bright” has 2 times the year at the top.
- Cycling is working now on Windows 7 🙂
- The “Random” screensaver transition effect was not that ‘random’ + sometimes a bit slow.
- Wallpaper Cycler can rerender the wallpaper automatically when the screen resolution has changed. This is an old feature, but is now enabled by default.
- The “Spiral In” and “Box In” screensaver transition effects left a 3-5 pixel horizontal line in the middle of the screen when running at 1440×900.
- Link targets didn’t work on wallpaper objects, calendar objects and frame objects.
- Removed font references to Californian in templates since that’s not a font installed by default on Windows.
- The text object renderer in a layout again properly calculates the bounding box.
- WPC would crash when a layout contained a calendar object that was too small to render all days.
- WPC would crash when a layout contained an object with a width or height of 0.
- Rendering of gradients was broken after adding the rotation option to wallpapers.
- The small preview image in the OSD was sometimes cut off.
- The pick background/text color dialogs now correctly keep aspect ratio of the image.
- The info panel will now allow you to quickly check if a wallpaper is linked to a layout either directly or indirectly through one of its parent categories.
- The RSS feeds again show a brief description of a feed entry and not the entire entry.
- View Details/Thumbnails now have an icon in the Wallpapers menu.
- Open a wcl, then go to File>Open, click Cancel, previous WCL was closed.
- Removed dots behind “move layout up…”, “move layout down…” menu items.
- An issue with resizing the main window and the tiling combo box in the Info Panel.
26 Jan, 2009
I went to Mostar in Bosnia and Herzegovina for work. Mostar is a nice city and I think it would be great in the summer. I was there only for 2 days and after work it was already dark, but I still managed to go to the Old Bridge and take some pictures from the old part of the city.
(Note: all pictures are copyrighted by me, Marc Gregoire. Please contact me if you want to use one.)

24 Jan, 2009
Windows 7
When the beta of Windows 7 was released, I obviously had to install it to test Wallpaper Cycler on it. Wallpaper Cycler started fine, so that was a good start 🙂 However, when I wanted to cycle the wallpaper on the desktop, it changed the tiling setting on the desktop properly, but the wallpaper itself was not changed, bummer 🙁
Since Windows 7 comes by default with a very basic wallpaper cycler built-in, I thought that Microsoft had maybe changed the programming interface to change the wallpaper. I started to search on the internet for information regarding this, but didn’t find anything. So, I started debugging… Read the rest of this entry »
11 Jan, 2009
Windows Windows 7
With the release of the first beta of Windows 7, obviously I had to download it and try it out. I tested it on an older P4 2GHz with only 512MB of memory. I normally run Vista on that machine and 512MB of memory is a little bit on the low side for Vista. When Windows 7 first started I immediately noticed how much smoother and how much more responsive everything feels compared to Vista on the same box. I was really impressed.
In this post I want to explain a new maximizing feature that is currently in the Windows 7 beta. Suppose you start with a Wordpad window in the middle of your screen. On a side note, you can also see that Wordpad finally received a GUI update and now includes a ribbon.

Now, grab the Wordpad window and move it to the far left of your screen. Windows 7 will draw a translucent rectangle with the size of half your screen.

When you now release your mouse button, Windows 7 will maximize the window to half your screen as in the following screenshot.

This feature is a pretty useful one in my opinion, especially on widescreen monitors that are getting more and more common.
1 Jan, 2009
Gelukkig Nieuwjaar
Happy New Year
Sretna Nova Godina
Bonne Année
May your dreams come true in 2009 🙂
13 Dec, 2008
I’ve hit a nasty bug in Wallpaper Cycler. One user previously reported to me a problem with the tiling of the wallpaper on the desktop on Windows Vista when Vista was configured with high DPI, for example 120 DPI. However, at that time I was unable to replicate the problem and since I only got the report from one user I thought it was an isolated case. Unfortunately, during the beta 2 phase of Wallpaper Cycler 3.6, one of the beta testers reported exactly the same problem. So, it’s not an isolated case. The bad thing is, I’m still unable to replicate the problem on my test Vista machines. Now, more and more users are starting to use the high DPI setting in Windows Vista because of the higher resolution monitors out there, especially notebook screens. Due to this, I really need to try to fix this for the final 3.6 release, but this means I probably won’t be able to release it before the end of the year 🙁
1 Dec, 2008
Axialis IconWorkshop allows you to easily create modern, great looking icons for your projects on Windows, Macintosh and Unix. It creates Windows icons up to 256×256 for Windows Vista and Macintosh icons up to 512×512 for Mac OS 10.5. Unix uses PNG icons. It also allows you to create image strips which can be used for your toolbars. Read the rest of this entry »
29 Nov, 2008
On Thursday 27th of November I have given my first presentation for a Microsoft event. The presentation was given during a Microsoft Community Osijek (Croatia) event. You can find more information about that community on their site. The presentation was a 45 minute “Introduction to C++”. It gave a brief overview of C++ and about the advantages of C++. It also explained how to decide when to use C++ and how to fuse the C++ and C# worlds. At the end, I gave a demo on how to call a C++ DLL from C#. Comments after the presentation were quite positive 🙂
22 Nov, 2008
I’m pleased to announce that Beta 2 of NuonSoft Wallpaper Cycler 3.6 is currently in the hands of our beta testers. 🙂
22 Nov, 2008
The following new features have been implemented in Wallpaper Cycler
- Rendering now happens in a separate thread, not blocking the main GUI thread.
- The rendering thread will be switched to low priority if the rendering was initiated by a timer.
- The rendering thread will stay at normal priority when the user forced WPC to cycle the wallpaper.
- On Windows Vista or later, the rendering thread will use low priority I/O in case the rendering was initiated by a timer.
- The fullscreen preview window now scales the image with the same high quality as when rendered to the desktop. This feature can be disabled to speed up the preview on slower systems. Can be enabled/disabled from the global WPC settings or by pressing Q in the fullscreen preview.
- The uninstaller will no longer remove the license information.
- A new toolbar button to quickly toggle between thumbnail view and details view.
- New option “Cycle once every day and exit at windows logon”.
- The info panel will now allow you to quickly check if a wallpaper is linked to a layout either directly or indirectly through one of its parent categories.
- New option to enable/disable the feature that WPC will automatically select the new wallpaper in the main window when cycling to the next or previous wallpaper.
- You can now rename a layout by slowly double clicking the layout or pressing F2 in the list in the main window of WPC
9 Nov, 2008
I made the following bug fixes for Wallpaper Cycler:
- The screensaver will now also either take a random wallpaper or cycle them sequentially depending on the cycling settings of Wallpaper Cycler.
- When you get an error regarding ChangeNotification or NextChangeNotification, it is explained in the messagebox what the result of that error is.
- In layout objects, the “Link Target On Single Click” would not always work properly.
- Handcursor over link target should be visible on Vista.
- When libexif.dll is not available, it doesn’t crash anymore.
- The libexif.dll is now only loaded once instead of loaded/unloaded on every use.
- When WPC is starting up, the tray icon now has gray arrows. Once the WCL has been loaded the arrows will become either red or blue depending on whether WPC is cycling or not.
- The IsHiddenSystemFolder check was only done when importing a new folder. Now it is also done during synchronization of folderlinks.
- Fixed a memory leak when loading JPEG2000 images.
- Some PCX files caused Wallpaper Cycler to crash.
- The HTML renderer for text objects in a layout has been changed. Hopefully this solves issues with rendering certain RSS feeds
- When the main window is opened and thumbnails are being loaded, they will now start loading from where the scrollbar is, instead of starting with thumbnail 1.
- The name of the month and days was wrongly capitalized on for example Croatian settings.
- The gadget was still displaying copyright 2007.
- The Info Panel will now remember whether it should display the full name or the short name.
8 Nov, 2008
I had to go to Nairobi in Kenya for a business meeting. It was only for 2 days, but luckily I was free for one day 🙂 During that day I did a mini safari in the Nairobi National Park. This is a national park just 15 minutes from Nairobi center with wild life. I saw a wild giraffe, lots of zebras, ostrich and some other. There are also wild lions, tigers, elephants … but I didn’t see them this time. Some pictures of the safari: Read the rest of this entry »
7 Nov, 2008
The CTP build of Visual C++ 2010 includes a new library to help you write native parallel code. Writing parallel code is getting more and more important with the broad availability of quad-core CPU’s at this time and the many-core CPU’s that will appear in the coming years. I will only be talking about the new concurrency library for native code. Of course, writing parallel code was already possible for a long time. However, you had to create and manage all threads by yourself and this could often be a complex task. Because of this, it requires quite a bit of time to parallelize a simple loop over multiple threads. The new native concurrency library makes this much easier. Read the rest of this entry »
29 Oct, 2008
Every version of Visual Studio comes with certain versions of Microsoft libraries, like the C runtime library, the MFC library and so on. For example, Visual Studio 2008 comes with version 9.0.21022.8 of the Microsoft C runtime library and version 9.0.21022.8 of the MFC library. Read the rest of this entry »
28 Oct, 2008
The Visual Studio 2010 and .NET Framework 4.0 CTP (Community Technology Preview) has been released.
Note that this is an early preview look. A number of walkthroughs are included. Features outside these walkthroughs might still not be finished.
C++ is not being forgotten 🙂 The CTP contains a preview of a new concurrency library for C++ to make it easier to write native parallel code. I definitely will be taking a closer look on that.
Find out more here.
21 Oct, 2008
On Saturday 18th of October I went to the Microsoft Community event called CodeCamp in Zagreb (Croatia). It was a one day event with presentations all with coding demos, so not just some slides 🙂
The day started with a presentation by Tomislav Bronzin about Exchange server and how to use the Microsoft Unified Communications platform to easily integrate support for contacts, emails, presence information … in your own applications. It looks like an interesting platform. However, using it requires quite a few lines of code.
The second presentation was about using the Windows Mobile 6 SDK to develop applications for mobile devices and was given by Andrej Radinger. Demonstrations included how to use the different emulators that are available. This also includes FakeGPS to fake a real GPS device and a tool (cellular emulator) to simulate sending/receiving of SMS messages, dailing phone numbers, receiving incoming calls, faking busy signals and so on.
Next it was a presentation about SQL Server 2008 by Dean Vitner, explaining and demonstrating things like support for encryption, compression and auditing.
The next presentation was about BizTalk by Josip Šaban, but I skipped that one since I had to leave for half an hour.
After that, Marko Čulo gave us a presentation called “Dirtiest SQL Tips & Tricks” with examples which showed important things to remember like the behavior of nested transactions.
The last presentation was about MS StyleCop by Bernard Katić. MS StyleCop is yet another tool to force coding standards. It will also check your code documentation so that it matches certain standards.
All in all, the presentations were interesting.
11 Oct, 2008
The following new features have been implemented in Wallpaper Cycler:
- The folder synchronization feature now will detect new sub folders and will create the appropriate categories for those new folders. System subfolders like the “recycle bin” and “System Volume Information” will be skipped automatically.
- The wallpaper will now automatically be rerendered when resuming from standy or hibernation.
- Nicer selection of items in the image list on the main window on Windows Vista.
- When you click on the My Wallpapers category, the wallpapers are only shown after double clicking a message. This is done to prevent performance issues with large wallpaper lists. An option has been added to disable this behaviour and to show the wallpapers immediately when clicking the My Wallpapers category.
- On a clean installation, the folder synchronization feature will by default skip *.db, *.ini, *.avi and *.lnk files. This behaviour can always be changed by adding/removing extensions in Tools > Program Settings > Global > Folder Synchronization > Skip Extensions
- Option to hide the message that says “Failed to install ChangeNotification on…” when the folder synchronization function could not be installed (for example: remote drives)
- A new Info Panel has been implemented that removes the Information Frame on the right of the main window.
- Every layout object now has an option called “visible” that can be used to hide an object from the desktop.
- You can now also pick a color from the selected wallpaper to use as text color, just as you were able to pick a color for the background.
- Hicolor toolbar and menu bitmaps.
- Two new options “Align Horizontal” and “Align Vertical” for a wallpaper object in a layout. These allow you to change the alignment of the wallpaper in that wallpaper object, so you can for example stretch to height + align to right or other combinations
I also made the following bug fixes for Wallpaper Cycler
- The new 3.6 installer will check if a previous version is installed and will ask to uninstall it. This is needed because quite a few new DLLs are being used and we want to get rid of the old ones.
- After uninstalling the previous version, the new 3.6 installer will automatically remove any oleacc.dl_ and/or dwmapi.dl_ files in the folder of the previous installation. These files were created by a Wallpaper Cycler Windows Vista patch and don’t get uninstalled by the uninstaller.
- The new 3.6 installer will save your registration username and serial number before running the uninstaller and will restore your username and serial number after installing the new version.
- Readme and license txt files are now fixed width, which reads easier on wide screen monitors and which is according to the RFC2822 regarding text documents.
- You could often not use the arrow keys and the spacebar key to check/uncheck items in the list on the right in Program Settings > Global > Miscellaneous.
- On a clean install, the main window will be bigger by default if you have a bigger monitor.
- Enlarged minimum window height due to new Info Panel.
- In new layout wizard, when you click the calendar template button, the Wallpaper Cycler calendar template folder will be opened by default.
- The zlib library has been updated to the latest version.
- When the folder synchronization kicks in in the background, no progressbar is shown anymore.
- F3 (Find Next) would not always work.