Use the power of Reflection to create and manipulate managed objects

When you create a Windows Presentation Foundation (WPF) project in Visual Studio, references to WPF libraries, like PresentationFrameworks.dll, PresentationCore.dll, WindowsBase.dll, are automatically added, from which you can create types and invoke members. That makes the code to create a couple controls and show them in a window quite simple. (A WPF application already creates a…

0

Big numbers

When I first started learning about numbers I remember marveling at what infinity means. How many integers are there? Are there more real numbers than integers? How many numbers are there between zero and 1? Then I remember thinking about how these numbers get to be so big… so many digits. Then I started playing…

0

Drawing old playing card images for bridge

About 11 years ago I wrote a blog about Contract bridge card distributions. When you play bridge, with a normal 52 card deck, it helps to know about how often a particular suit distribution might occur. For example, if you and your partner have 9 Spades, then the opponent’s spade holding of 4 spades might…

1

Examining a crash dump

A crash dump is very helpful for diagnosing a problem with software. It can contain enough information to recreate a debug session, almost as if you’re debugging the problem live on the repro machine. Last time I showed some code to create a crash dump with various settings. You can choose to include many different…

1

Create your own crash dumps

Sometimes programs will crash on your machine. Windows Error Reporting can send problem reports back to Microsoft. You can use the Windows Event log to see more detail about prior crashes. Some crashes will send crash dumps to Microsoft so that the crash can be fixed, perhaps in an update. Thousands of bugs in products,…

1

Blinking Lights are useful

A while ago, computers had blinking lights on a front panel. I recognized various patterns of blinking lights as indicating various operating modes: idle, waiting for teletype input, typing on the teletype machine, reading a paper tape, busy with high CPU usage. This is similar to the technology of the computer that‘s still running on…

3

Execute tasks in parallel using async and await to speed up computation

Suppose you have five tasks you want your computer to execute and that each takes 1 second to execute. In the old days, one would figure that each task would be executed sequentially, resulting in a total execution time of 5 seconds. Even today, many programmers would write a program to execute these tasks sequentially….

0

Create your own Process Explorer

I was playing around with showing some resizable content in a WPF window. I wanted 2 variable sized Lists, one on top of the other. The lists had various lengths, but also various widths: the user could adjust the size of the columns. This smelled like a GridSplitter. That means I need 3 rows in…

0

Wireless HeadPhone Adventures

I wanted to get wireless headphones to listen to music. At the office I have 3 desktops, with a range of power. The most powerful has 3 monitors connected. The next has 1, while a 3rd doesn’t have any (I Remote Desktop to it). I run various flavors of Windows Server 2012 and host many…

2

Write native to managed interop code: reg free COM

If you followed the steps of the last post (Call C# code from your legacy C++ code), then your C++ program simply started the CLR (Common Language Runtime), invoked a C# method that returned the length of the passed in string argument. Not very exciting. Let’s spice it up a little. We’d like to allow…

0