Cjwdev.WindowsAPI Update

July 9, 2010 — 1 Comment

Even though I only released my .NET Windows API library (Cjwdev.WindowsAPI) quite recently, I’m planning to release a new version pretty soon as there are still plenty of things I want to add to it. EDIT: New version is now available, see this post. I will be releasing updated versions fairly often rather than waiting until I have a large amount of new methods etc, so keep checking back on this blog for updates. This post describes the new methods and classes that I have added (or am planning to add) to the next release, along with the Windows APIs that the managed methods use. As always, let me know if there are any particular APIs you would like to see in here and I will try and get them in.

One of the main new features in this version will be the inclusion of some power management methods, held in a class named NativePowerScheme. So if you have ever wanted to manage or query windows power settings from your .NET app then this should help you out – in this version there may only be some basic power scheme methods but in future versions this will hopefully be expanded to include methods that let you completely customise the power settings, with the ability to create new power schemes and edit existing power configuration. Also, these power management methods will be compatible with Windows XP as well as Vista and Windows 7.

Anyway, here are the new methods – check back on this blog soon for the new version:

Gets a list of all power schemes, with basic information such as the name, description and index

Gets the currently active power scheme

Sets which power scheme is active

Renames the local computer to the specified new name. If the computer is part of a domain then the domain account for the computer is renamed as well

Deletes a user’s profile and all user related settings

NativeOperatingSystem.UserProfilesDirectory (property)
Returns the root directory path where all user profiles are stored (I dont think there is an environmental variable for this but if anyone knows of one then let me know and I wont bother including this)

Empties the recycle bin

Returns the number of items in the recycle bin

Returns the total size (in bytes) of the items in the recycle bin

Finds a window that has the specified title and creates a NativeWindow instance from it (which includes the title, handle, owning process and window icon)

Returns a list of all windows that have a title that contains the specified string – useful if you dont know the entire title of the window

Makes the specified window a "topmost" window so that it always appears on top of all other windows

Gets the window that currently has focus and creates a NativeWindow instance from it (so includes window title, owning process, handle etc)

Releases all v4 IP addresses that were acquired via DHCP

Renews all v4 IP addresses that were acquired via DHCP


Here are some of the Windows APIs that these new methods use (which are all available in the ApiDefinitions class in my DLL if you ever need to use them directly) :















Trackbacks and Pingbacks:

  1. Cjwdev.WindowsAPI API Pack Released « Cjwdev - July 19, 2010

    […] See this post for an idea of what to expect in the next […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s