It’s easy to use Windows Hooks, even from C#

Microsoft Windows is based on showing windows of data to the user (duh). An application can create windows with which to interact with the user. Every window has a Window Handle, which is used just like an ID number. The Windows OS communicates with the application windows via Windows Messages. For example, when you type…

0

Automatically open Visual Studio Projects and Solutions using IMessageFilter

I wanted to learn more about what an IMessageFilter is and how it behaves. So I wanted to have some sample code that used it to demonstrate its behavior. So I wrote a program that starts Visual Studio, calls some properties and methods (like Get Version and MainWindow.Activate)  and then opens a solution of one…

0

Memory use of Dynamically expanding TreeView

I created a tool a few years ago that uses a WPF TreeView with huge numbers of nodes. The branching factor is pretty high (the number of branches per level), and the depth can be several hundred levels. Of course, creating the whole tree would consume huge amounts of memory and processing time. This is…

0

Visual Sorting Algorithms part II

In the days before the internet, email and cell phones: My ice hockey team was in the locker room talking about skating when the topic of a video showing me roller staking in Boston in 1980. https://www.youtube.com/watch?v=IxlV_lOLmrk see Visual Sorting Part I Below is the new version that uses a background thread to do the…

0

Create a Concordance for a Word Document from C# using Automation

I was talking to my son about some of his homework assignments. He had to write several essays. We talked about the power of Microsoft Word and how I had to count the words manually when writing a 5000 word essay on a typewriter, but Word shows the word count easily. Then we talked about…

1

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

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

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