Cjwdev.WindowsAPI (.NET Windows API Library) – Version 2.1 Available

July 29, 2010 — 3 Comments

Well getting the power scheme APIs working on Windows 7 and Vista is taking a little longer than expected so I thought I would bring this new version out without the power related methods so that people can use the other new methods sooner rather than later. Download link for new version is at the end of this post, but I encourage you to read the full post to see what has changed in this version.

First of all, if you don’t know what this .NET Windows API Library is or what the previous version contained, have a read of this post.

See below for a list of all of the new methods in this version:


The ShareExistingFolder method signatures have been amended to follow conventions used in the rest of the library and in the .NET framework. The changes are only minor and should make it easier to use but anyone upgrading to this version after having used version 2.0 will find that if they have code using the ShareExistingFolder method they will need to alter the order of the arguments that they pass in. The intellisense prompts will make it clear which arguments should go where.


NEW      ReleaseIpAddresses
Releases all IPv4 addresses acquired via DHCP

NEW      RenewIpAddresses
Renews all IPv4 addresses acquired via DHCP

NEW      UserProfilesDirectory
Gets the path where all user profiles are stored

NEW      EmptyRecycleBin
Empties the recycle bin

NEW      GetRecycleBinItemcount
Returns the number of items in the recycle bin

NEW      GetRecycleBinSize
Gets the total size of the items in the recycle bin

NEW      RenameComputer
Renames the local computer and corresponding domain account

NEW      GetWindowFromTitle
Gets a NativeWindow instance for the window with the specified title

NEW      GetWindowsFromPartialTitle
Same as GetWindowFromTitle but finds windows with the specified string anywhere in their title (useful if you do not know the full title of a window)

NEW      GetWindowSize
Gets the size in pixels of any window

NEW      GetActiveWindow
Gets the currently active window (aka foreground window)

NEW      MakeWindowTopMost
Makes the specified window a topmost window (i.e it stays at the foreground even when not in focus, like task manager)

NEW    MakeWindowNotTopMost
Stops a window from being a topmost window if it currently is one

NEW    SetParentWindow
Makes the specified window a child of another window

NEW      DeleteUserProfile
Removes the specified user’s windows profile and settings

UPDATE    Overloaded version of GetTopLevelWindows now has the option to include invisible windows

UPDATE    Added the Change permission to the SharePermission Enum so you can now grant/deny Change permissions when sharing a folder via the ShareExistingFolder method

FIX     XML/intellisense description for JoinToDomain method is now visible

and here is a list of the new Windows APIs included in the ApiDefinitions class in this version:


You can download the new version (for free of course) using this link: http://cjwdev.co.uk/…/Cjwdev.WindowsApi.zip and just make sure you extract both the DLL and XML file to the same directory, otherwise you wont get the intellisense descriptions/comments when you use methods from the DLL.

As always, let me know any feedback you have (good or bad) and I hope the new methods are useful to people. If you have any suggestions for APIs that you would like to see included in the next version then let me know ā€“ cwright@cjwdev.co.uk



3 responses to Cjwdev.WindowsAPI (.NET Windows API Library) – Version 2.1 Available


    This is awesome. One question though, will you have any sort of documentation for this once it is final?
    Still kinda new to the .net relm and can kinda figure most of it out but even a little documentation would make things alot more clear and easier to pick up.

    Other than that …. sweeeet


      Hey thanks for the nice comments – as for documentation, that is something I’ve been meaning to put together but to be honest it would be pretty similar to what I’ve already put in the XML file (which is what you will see in intellisense when you use anything from my DLL). The only difference would be that there might be some examples but I guess that might be quite helpful for some people.

      Oh and what did you mean by “once it is final” ? You can download and use it now šŸ™‚


    Thanks for sharing useful material. I have Window C# Form on which I have created a context menu which have option to display previous Focused/Active window. So I want to display previous window which have focus before my window C# form. I googled and find following call.
    GetWindow(this.Handler, GW_HWNDNEXT);

    When I am calling this method it is giving me wrong handler (which I guess is context menu handler). How can I get the actualy previous window (say Notepad) handler or name?
    Any Help?

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