Welcome to MSDN Blogs Sign in | Join | Help

Browse by Tags

Write simple Debug helpers to help you debug and maintain your code

Much of my time is spent using the Visual Studio debugger examining code to figure out how it works and how to fix it. When stepping through a function, the values the function uses are very useful for code understanding. The debugger shows these values
Posted by Calvin_Hsia | 1 Comments

You can use HWndHost to host a Win32 HWnd window inside a WPF element

Suppose you have some old code lying around that creates a Win32 window with an HWnd (perhaps ATL , MFC , or just C/ C++). For example, if you type some erroneous code into a VB application in Visual Studio: Dim x=4: catch ex As Exception The “Exception”
Posted by Calvin_Hsia | 0 Comments
Filed under: , ,

Dynamically load a DLL from a runtime specified path

When running VB.Net or C# code, often it’s useful to call native code. One way is using PInvoke. (for other ways, see How fast is interop code? ) For example, you can call GetWindowText to get the title of a window. To get it’s managed signature, you
Posted by Calvin_Hsia | 0 Comments
Filed under: ,

Synchronize your files across machines with Mesh

I have a collection of almost 30,000 pictures and videos. When I add new pictures to the collection, I had been running a script file to synchronize the collection across various machines. for %%s in (\\calvinh6\e$ \\calvinh3\e$ \\calvinh4\e$) do ( robocopy
Posted by Calvin_Hsia | 4 Comments
Filed under: , ,

Magnify your pictures using a PictureBox so that you can zoom with the Mouse Wheel

Today’s digital cameras take pictures with much higher resolution than many computer screens. My Canon PowerShot SD800 IS camera takes pictures at 3072 x 2204 resolution. One of my laptops died recently, and I noticed that local laptop retailers have
Posted by Calvin_Hsia | 12 Comments
Filed under: , ,

Make your code more maintainable: The evils of the Return statement

What does it mean to make code more maintainable? Certainly obfuscated code is hard to understand, by definition. A big part of maintainability is making it easier for others to read and understand what the code is doing. Your code may have been working

Cellular Automata: The Game of Life

I remember my dad getting a copy of Scientific American magazine every month when I was a kid. He kept back issues on a shelf in our living room. I remember being fascinated by the issue (Oct 1970) which described John Conway’s Game of Life . A few decades
Posted by Calvin_Hsia | 2 Comments
Filed under: ,

A WPF version of the Typing Tutor game

In my prior post I show a Windows Form version of the typing tutor game. Here is a WPF version. Start Visual Studio 2008. Choose File->New->Project->VB->WPF Application. Dbl-Click the form in the designer to open the code window. Paste in
Posted by Calvin_Hsia | 2 Comments
Filed under: ,

The VB WinForm version of the typing tutor game

In this post, Create your own typing tutor! is code to create a game for learning the letters of the keyboard by typing the letters that fly across the screen. As times goes by, they fly faster. Below is a VB version of the game. Can you score higher
Posted by Calvin_Hsia | 4 Comments
Filed under:

Use a dictionary to help create a mnemonic

I was using a program that was yet another TLA and I wanted to create a mnemonic to help me remember what it was. One of the letters was “k”, so I wanted to find a word that starts with “k” Simple: load a dictionary, search for words starting with “k”

How fast is interop code?

How fast is interop code? If you’re in one kind of code and your calling another, what is the cost of the interop? For example, .Net code can call native C++ code (like Windows APIs) and vice versa. Similarly with Foxpro and C++ code. .Net code is often

How to interrupt your code

I received a question: Simply, is there a way of interrupting a vfp sql query once it has started short of closing down the process ? I am running some complex queries on very large datasets which can sometimes take many minutes to complete. Typically,
Posted by Calvin_Hsia | 6 Comments

Examine .Net Memory Leaks

Writing programs using .Net is very productive. One reason is because much of memory management is “managed” for you. In C, C++ and other “native” languages, if you allocate memory, you’re responsible for freeing it. There were stopgap measures, like

Persist user form size and location settings per session

My prior post ( Create your own Test Host using XAML to run your unit tests ) shows how to create a form and present it to the user. The user can resize and reposition the form, even on a 2 nd monitor. When the user exits the form, we can persist or remember

Create your own Test Host using XAML to run your unit tests

A few days ago, somebody came into my office and plopped down a box. It seemed very light. He said that it was a new PC. I thought hmmm…. The box seems empty…Why am I getting a new PC?. Apparently an inventory was made and my current hardware was at the
More Posts Next page »
 
Page view tracker