This is a preview version of Cyotek's blog and may be missing functionality and/or unstable. Please visit for the current version of the blog.
If you encounter any problems using this preview site, please contact us with the details.

Getting a window rectangle without the drop shadow

c# api win32 2 Comments

In my last article, I describe how to use the Win32 API to capture screenshots of the desktop. There was one frustrating problem with this however - when capturing an image based on the value of the Bounds property of a Form unexpected values were returned for the left position, width and height of the window, causing my screenshots to be too big.

I thought that was odd but as I wanted to be able to capture unmanaged windows in future then using Form.Bounds wasn't going to be possible anyway and I would have to use GetWindowRect. I'm sure that deep down in the Windows Forms code base it uses the same API so I was expecting to get the same "wrong" results, and I wasn't disappointed.

Read More

Capturing screenshots using C# and p/invoke

c# api win32 screenshot 2 Comments Downloads

I was recently updating some documentation and wanted to programmatically capture some screenshots of the application in different states. This article describes how you can easily capture screenshots in your own applications.

This article makes use of a number of Win32 API methods. Although you may not have much call to use them directly in day to day .NET (not to mention Microsoft wanting everyone to use universal "apps" these days), they are still extraordinarily useful and powerful.

Read More

Writing custom Markdig extensions

c# markdig markdown 0 Comments Downloads

Markdig, according to its description, "is a fast, powerful, CommonMark compliant, extensible Markdown processor for .NET". While most of our older projects use MarkdownDeep (including an increasingly creaky, current projects use Markdig and thus far it has proven to be an excellent library.

One of the many overly complicated aspects of is that in addition to the markdown processing, every single block of content is also ran through a byzantine number of regular expressions for custom transforms. When is updated to use Markdig, I definitely don't want these expressions to hang around. Enter, Markdig extensions.

Read More

Announcing MantisSharp, a .NET client for using the MantisBT REST API

c# api rest mantisbt mantissharp 3 Comments

I've released a new open source project named MantisSharp, a simple .NET client for working with the recently introduced REST API for Mantis Bug Tracker.

The library is just getting started and is missing various functions (hello documentation!) but it seems to be usable - as well as the WinForms sample browser that I was using for development testing, I also tested it in an ASP.NET MVC application, both locally and then remotely using the development version of

Read More

Restoring missing Authorization header when using PHP with Apache

php apache 3 Comments

I was recently looking into using our Mantis Bug Tracker instance to automatically generate product road-maps - now that we are actually starting to properly plan product updates and as keeping them up to date manually isn't really working.

I spent a fair amount of fruitless time sending requests to Mantis via Postman only for every single request to fail with 401 API Token required - despite the fact I'd created a limited access user and generated an API token associated with that.

Read More

Translating text with Azure cognitive services

c# api azure rest translate localization 1 Comments Downloads

Some time ago, I used the Bing Translator API to help create localization for some of our products. As Microsoft recently retired the Data Market used to provide this service it was high time to migrate to the replacement Cognitive Services API hosted on Azure. This article covers using the basics of Azure cognitive services to translate text using simple HTTP requests.

I'm going to assume you've already signed up for the Text Translation Cognitive Services API. If you haven't, you can find a step by step guide on the API documentation site. Just as with the original version, there's a free tier where you can translate 2 million characters per month.

Read More

Using custom type converters with C# and YamlDotNet, part 2

c# convert yaml type 0 Comments Downloads

Recently I discussed using type converters to perform custom serialization of types in YamlDotNet. In this post I'll concentrate on expanding the type converter to support deserialization as well.

I'll be reusing a lot of code and knowledge from the first part of this mini-series, so if you haven't read that yet it is a good place to start.

Read More

Using custom type converters with C# and YamlDotNet, part 1

c# convert yaml type 0 Comments Downloads

One of our internal tools eschews XML or JSON configuration files in favour of something more human readable - YAML using YamlDotNet. For the most part the serialisation and deserialisation of YAML documents in .NET objects is as straight forward as using libraries such as but when I was working on some basic serialisation there were a few issues.

For this demonstration project, I'm going to use a pair of basic classes.

Read More

Writing Microsoft RIFF Palette (pal) files with C#

c# color palette riff 0 Comments Downloads

A short follow up and sample program which demonstrates how to write a RIFF palette with ease.

I covered the basics of the RIFF specification and how to read palettes in my previous article.

Read More

Loading Microsoft RIFF Palette (pal) files with C#

c# color palette riff 0 Comments Downloads

At the start of 2014, I published an article describing how to read colour palettes from BBM/LBM files. At the end of that article I noted that Microsoft palette files used a similar format, but I didn't investigate that at the time. Since then I followed up with articles on reading and writing Adobe's Color Swatch and Color Exchange format files and I also posted code for working with JASC, Gimp and a couple of other palette formats.

Now, finally, I decided to complete the collection and present an article on reading Microsoft's palette files. These files are RIFF forms containing colour data, similar to a BBM palette being an IIF form.

Read More