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

Posts tagged with 'win32'

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