Category Archives: API

Set another application’s size and position in C#

When I write books, there is usually a maximum size that a screen shot can be. I wrote this program to make it easy to set an example program to exactly that size. This program uses the FindWindow API function … Continue reading

Posted in API, miscellany, system | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , | 5 Comments

Find a target window and minimize, maximize, or restore it in C#

This is the first in a series of posts that allow one application to manipulate a target window in another application. Note that this isn’t something that Microsoft really wants you to do. In general one application should not fiddle … Continue reading

Posted in API, miscellany, system | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , | 4 Comments

Simulate mouse movement and clicks in C#

This program uses the mouse_event API function to simulate mouse movement and to simulate a mouse click. The program’s Paint event handler draws some circles around a target point so you can see where it is. // The mouse’s target … Continue reading

Posted in API, miscellany, user interface | Tagged , , , , , , , , , , , , | 1 Comment

Remove the Close button from a form’s system menu in C#

C# doesn’t have a built-in way to manipulate the system menu that appears when you click the upper left corner of a form, but it’s not too hard to use API functions to remove some or all of those buttons. … Continue reading

Posted in API, forms, system | Tagged , , , , , , , , , , | 2 Comments

Close Mozilla Firefox popups in C#

Some browser tools try to block advertising popups, but lately some have been sneaking through on my system so I wrote this program to close Firefox popups when they appear. Start Firefox and create the windows that you want. Then … Continue reading

Posted in API, system | Tagged , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

List desktop windows in C#

This program uses several API functions to list the windows running on the system’s desktop. To make reusing the code easier, I made the key routines static in a static class so you don’t need to instantiate the class to … Continue reading

Posted in API, system | Tagged , , , , , , , , , , | 1 Comment

Add a UAC shield to controls in C#

In Windows Vista and later versions of Windows, you are supposed to add a UAC (user access control) shield to buttons that launch processes that require privilege elevation. Unfortunately Microsoft hasn’t made this easy to do. Adding the shield to … Continue reading

Posted in API, controls, graphics, menus, system | Tagged , , , , , , , , , , , , , | 5 Comments

Flush click events in C#

If a button starts a long task, you probably don’t want the user to be able to click the button again (or perhaps not anything in the application) until the task finishes. The following code shows a straightforward attempt to … Continue reading

Posted in API, controls, events, syntax, system, threading | Tagged , , , , , , , , , , , , , | 12 Comments

Change video quality in C#

(Note that this example was written in Visual Studio 2010.) This post shows how you can load and save a video with a given video quality. Lately I’ve been recording screencast videos for my next book. Unfortunately I recorded several … Continue reading

Posted in animation, API, multimedia | Tagged , , , , , , , , , , , , , , , , , , | 2 Comments

A plea for help: Tell me what you want to see in my blog!

I get remarkably little feedback from my blog. I track post views and know that I have 857 Twitter followers, but people rarely let me know if they particularly like or dislike a post. That makes it hard for me … Continue reading

Posted in ADO.NET, algorithms, animation, API, challenges, combinatorics, controls, cryptography, curve fitting, database, extension methods, files, fonts, fractals, games, geometry, globalization, graphics, internationalization, LINQ, localization, mathematics, Office, phone, printing, reflection, registry, serialization, threading, transformations, user interface, Word, wpf, XAML, XML | 15 Comments