Cascading windows

In Photoshop we often work with multiple windows open. They can be cascaded to more easily be able to view the different windows and tell them apart. There's an API function that does the same to any windows you specify, you can even define the rectangle where they should be cascaded within.

Read the complete 1751 bytes...

Digg it | Kick it | Dzone it | Reddit


Animating windows

Let's be a bit more graphic. This time I'll show you how to use the Windows API to make your forms fade in/out, slide in from the side or do various other animations. For this example we'll have to use a Windows Forms project as we have to utilize a Form object in the example.

Read the complete 2369 bytes...

Digg it | Kick it | Dzone it | Reddit


Activating windows

Now we'll see how to activate windows and sending them to the foreground. I will be using the WindowFinder class that I introduced in the blog Finding specific windows.

Read the complete 2420 bytes...

Digg it | Kick it | Dzone it | Reddit


Getting key state

Here's an example of how to retrieve the state of any keyboard key.

Read the complete 2718 bytes...

Digg it | Kick it | Dzone it | Reddit


Minimizing and maximizing windows

This time I will show how to maximize and minimize windows. I will be using the WindowFinder class that I introduced in the blog Finding specific windows.

Read the complete 2459 bytes...

Digg it | Kick it | Dzone it | Reddit


Modifying window location and size

Last time we saw how to obtain a windows location and size. This time I'll show how to change a windows size and location. I will be using the WindowFinder class that I introduced in the blog Finding specific windows.

Read the complete 2862 bytes...

Digg it | Kick it | Dzone it | Reddit


Getting window location and size

This time I'll show how to obtain the size and location of a window. I will be using the WindowFinder class that I introduced in the blog Finding specific windows.

Read the complete 4252 bytes...

Digg it | Kick it | Dzone it | Reddit


Finding specific windows

Last time I made an example of how to enumerate windows. This time I present to you a class that greatly simplifies the process of searching for specific windows, types of windows, windows belonging to a specific process, having a specific text. You can search for any number of these parameters at the same time, using regular expressions for all string matches to provide optimal flexibility.

Read the complete 7688 bytes...

Digg it | Kick it | Dzone it | Reddit


Enumerating windows

Until now we've seen how to retrieve basic properties of windows as well as how to interact with them by sending keypresses. Up until now we've had to find the handle by using Winspector or a similar program. This time I'll present a way of finding the handles programmatically.

Read the complete 3973 bytes...

Digg it | Kick it | Dzone it | Reddit


Sending keypresses to a window

Now to complete the toolset required to make a great spyware / browser hijacking application, we'll make Internet Explorer navigate to the address we set.

Read the complete 2149 bytes...

Digg it | Kick it | Dzone it | Reddit


Set text by handle

This time we won't be reading the text from a window, we'll be setting it.

Read the complete 1377 bytes...

Digg it | Kick it | Dzone it | Reddit


Getting text from handle

This time we want to retrieve the text from a given window, represented by a handle. Like last time, open an Internet Explorer instance. Now open Winspector and select the address field, ensure that it is the address field itself (class = Edit) and not the ComboBox that you select.

Read the complete 2705 bytes...

Digg it | Kick it | Dzone it | Reddit


Getting a process from a handle

So we have a handle, what process does it belong to? Our goal is to obtain a .NET System.Diagnostics.Process object that corresponds to the owner process of the handle we input.

Read the complete 1842 bytes...

Digg it | Kick it | Dzone it | Reddit


The basics

First of all, to manipulate and use the Win32 API, we must know about the system itself, the windows, the controls and so forth. Visual Studio comes bundled with Spy++ which enables us to identity the various windows and controls of application, but honestly, it's pretty bad. Instead you should download Winspector.

Read the complete 1600 bytes...

Digg it | Kick it | Dzone it | Reddit