Results 1 to 40 of 61

Thread: My Windows API Library - New version available for download

Threaded View

  1. #1

    Thread Starter
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    My Windows API Library - New version available for download

    EDIT (29/07/2010) : The latest version of this library is available here: http://cjwdev.wordpress.com/2010/07/...2-1-available/

    I've been doing a fair amount of work with Windows APIs recently for one reason or another and every time I get one working I add it to a class library that I started months ago and add a managed .NET method that 'wraps' the API and makes it more .NET friendly and easier to reuse. Now that I'm starting to build up a bit of a collection, I thought it would be good to share this class library so that other people can use my managed .NET wrapper methods rather than having to mess about with the Windows APIs directly (I know a lot of people are not keen on doing that).

    So in summary: The basic idea is that a developer could add a reference to my DLL and then they would not have to use a lot of Windows APIs directly, they could just call my .NET methods that do all the API work for them. For example one of my wrapper methods named GetTopLevelWindows combines 6 different Windows APIs to return a list of all visible windows with their handle, title bar text, class name, owning process and window icon.


    So I'm just looking for some suggestions from people on any particular APIs that they would like to see included in this library. Anything that is a bit of a pain to use and would benefit from a managed version really

    Here is a list of what I've got so far: (EDIT: Updated 29/07/2010)

    Managed Methods
    RefreshDevices - Causes the OS to refresh its list of connected devices, equivalent to doing "scan for hardware changes" in device manager
    GetFreeDiskSpace - Returns the amount of space free on a remote disk, specified via UNC path
    GetParentProcess - returns a Process object for the process that started the specified process (aka the parent process)
    MapNetworkDrive - creates a network drive mapped to the specified UNC path
    RemoveNetworkDrive - deletes an existing mapped network drive
    GetUncPathFromNetworkDrive - Returns the UNC path that the specified network drive is mapped to
    DoesNativeMethodExist - Determines whether or not a specified method exists in an unmanaged DLL
    ShareExistingFolder - shares a folder and assigns the specified share permissions
    Is64BitOperatingSystem (property) - Returns true if the OS is 64 bit, even if the process calling this property is running in 32 bit emulation mode.
    GetAllIcons - Returns a List(Of Icon) for all of the icons in the specified dll, exe or ico file
    GetIconAtIndex - Returns the icon at the specified index in the specified dll, exe or ico file
    GetTopLevelWindows - Returns a list of all visible windows with their handle, class name, title bar text, owning process, and window icon
    GetChildWindows - Returns a list of all child windows of a specified window, in the same format as GetTopLevelWindows
    IsWow64Process - determines whether or not the specified process is a 32 bit process running on a 64 bit OS
    ReleaseIpAddresses - releases all IPv4 addresses that were acquired via DHCP
    RenewIpAddresses - renews the DHCP lease for all IPv4 addresses that were acquired via DHCP
    JoinToDomain - Joins the computer to the specified domain
    RemoveFromDomain - Removes the computer from the domain it is joined to (can also be run against a remote computer)
    GetStringResource - gets a string from a DLL resource address (e.g @%Systemroot%\system32\wbem\wmisvc.dll,-203)
    ReadMemory - reads a specified amount of bytes from another process's virtual memory
    GetCommandLineArgs - gets the command line arguments that were passed to any currently running process when it was started (even if it was not started by your program)
    GetServices - gets a list of all services that are in the specified state (running, stopped etc) with their process IDs
    GetServicesFromProcess - pass in a process and get back a list of any services that are running in that process
    FlashWindow - Causes the specified window to flash to get the user's attention
    SetWindowState - Make a specified window hide, minimize, maximize, etc
    InstallService - Creates a Windows Service with the specified parameters on the local machine or a remote machine
    DeleteService - Removes the specified Windows Service from the local machine or a remote machine
    EmptyRecycleBin - Empties the recycle bin
    GetRecycleBinItemcount - Returns the number of items in the recycle bin
    GetRecycleBinSize - Gets the total size of the items in the recycle bin
    RenameComputer - Renames the local computer and corresponding domain account
    GetWindowFromTitle - Gets a NativeWindow instance for the window with the specified title (NativeWindow instance includes title, owning process, icon, handle etc)
    GetWindowsFromPartialTitle - Same as GetWindowFromTitle but finds any windows with the specified string anywhere in their title
    GetWindowSize - Gets the size in pixels of any window
    GetActiveWindow - Gets the currently active window (aka foreground window)
    MakeWindowTopMost - Makes the specified window a topmost window (i.e it stays at the foreground even when not in focus, like task manager)
    MakeWindowNotTopMost - Stops a window from being a topmost window if it currently is one
    SetParentWindow - Makes the specified window a child of another window
    DeleteUserProfile - Removes the specified user's windows profile and settings

    Native APIs
    GetFreeDiskSpaceEx
    WNetCancelConnection
    WNetAddConnection2
    NetShareAdd
    InitializeSecurityDescriptor
    SetEntriesInAcl
    SetSecurityDescriptorDacl
    IsValidSecurityDescriptor
    SystemParametersInfo
    NetShareAdd
    WNetGetConnection
    GetProfileType
    GetForegroundWindow
    ShowWindow
    RegisterHotKey
    UnregisterHotKey
    CM_Reenumerate_DevNode
    NtQueryInformationProcess
    ExtractIconEx
    DestroyIcon
    DoesWin32MethodExist
    IsWow64Process
    GetModuleHandle
    GetProcAddress
    EnumWindows
    EnumChildWindows
    GetWindowTextLength
    GetWindowText
    IsWindowVisible
    GetWindowThreadProcessID
    GetClassName
    SetParent
    SendMessage
    GetWindowLong
    GetClassLong
    IpReleaseAddress
    IpRenewAddress
    GetInterfaceInfo
    NetJoinDomain
    NetUnjoinDomain
    LoadLibrary
    FreeLibrary
    LoadString
    CloseHandle
    OpenProcess
    ReadProcessMemory
    CreateProcess
    CreatePipe
    PeekNamedPipe
    WaitForMultipleObjects
    ReadFile
    WriteFile
    DuplicateHandle
    FlashWindowEx
    OpenSCManager
    EnumServicesStatusEx
    CloseServiceHandle
    CreateService
    DeleteService
    OpenService
    StartService
    SetWindowPos
    GetWindowRect
    DeleteProfile
    SetComputerNameEx
    NetRenameMachineInDomain
    SHQueryRecycleBin
    SHEmptyRecycleBin
    GetProfilesDirectory
    EnumPwrSchemes
    SetActivePwrScheme
    GetActivePwrScheme


    So yeah... any suggestions that you would like me to add?

    Cheers
    Chris
    Last edited by chris128; Jul 29th, 2010 at 01:38 PM.
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width