Windows API Viewer for MS Excel

This is a guest post by Dennis Wallentin.

The Tool

Windows API Viewer for MS Excel is a standalone, powerful tool for creating Windows API code, with or without conditions, to be inserted into code modules. It offers several lists of APIs for both platforms, x86 and x64, that can easily be used in various solutions. If wanted, it can create conditional Windows API solutions. The two conditions that can be applied are Win64 and VBA7. More information about them can be found in the help files shipped with the tool. The tool is shipped with extensive help support; the help includes help files and web pages that are relevant about Windows API.

The following screen shot shows the main form:

It is very easy to use Windows API Viewer. Select the code options you want and then export them to the clipboard. That’s all! Since it’s a standalone tool it can be used with other development tools. But the Windows APIs here are selected for MS Excel in particular. The tool’s help file explains and shows the various output you can create. Before the code solution is exported to the clipboard you can preview it as the following screen shot shows:

If you want further information about the selected Windows API the tool offers use of Google to find out more as the below screen shot shows:

Download

The Windows API Viewer for MS Excel is available in x86 version and in x64 version. To install it just double click on the downloaded exe file and follow the instructions on the screen.

Windows API Viewer – x86 Version
Windows API Viewer – x64 Version

Requirements

Since Windows API Viewer for MS Excel is not an add-in to MS Excel it can be used with whatever Excel version available. It can also be used with other development tools as well. However, the following requirements must be met in order to use the tool:

  1. Windows XP or later version.
  2. Microsoft.NET 4.0 or later version.

Development tools

The following tools have been used when creating Windows API Viewer for MS Excel:

  1. Microsoft Visual Studio 2015
  2. DevExpress WinForm Controls
  3. SQLite
  4. Help + Manual
  5. SamLogic Visual Installer 2015
  6. BoxedApp Packer

The Source Files

The Windows API sources come from two different text files by Microsoft. Unfortunately, the file for x86 Windows API is rather old, released by Microsoft in 1998. The other file was released when Excel 2010 was released and includes the x64 versions of Windows API. For obvious reason they are not complete. The quality has been improved as I have been forced to manually work with these files. All the Windows API are now stored in a SQLite database and can easily be updated when necessary. If you find some error or you see that some APIs are missing, please send me an e-mail and I will update accordingly. New versions of the tool will then be made available. By the way, did I mention that working with these files has been tedious?

License

The Windows API Viewer for MS Excel is made available based on the MIT License (MIT).

Home Page

Windows API Viewer has its home at Ron de Bruin’s site where upgrades and news will be published:
http://www.rondebruin.nl/win/dennis/windowsapiviewer.htm

Special Thanks
Special thanks goes to Ron de Bruin and Ken Puls.

All the very best,
Dennis

6 thoughts on “Windows API Viewer for MS Excel

  1. @J-K Thanks for Your kind words.

    @Doug You’re welcome. VB6 included an API Viewer back in the 90’s which I used too.

    I got some other stuff that may be of interest within the nearest future.

    All the best,
    Dennis

  2. The majority of corporate users are now running Office 32-Bit 2010 or 2013 on 64-Bit Windows.

    This leads to a curious anomaly in the API declarations: you’ve got the ptrSafe type but not LongLong.

    You can *mostly* get away with a two-part conditional declaration for that, because most API calls never pass or return a LongLong integer.

    But there are cases where VBA7 mast declare a differing API function name between Win64 and Win32: so it’s prudent to use a three-part conditional compilation block:

    #IF VBA7 And Win64 Then ‘ 64 bit Office under 64-bit windows ‘ Use LongLong and LongPtr ‘ pick up new 64-Bit names
    #ElseIf VBA7 Then ‘ Office with VBA7 in 32-Bit environments ‘ Use LongPtr only, LongLong is not available
    #Else ‘ 32 bit Office on 32-Bit Windows without pointer-safe VBA

    #If VBA7 And Win64 Then

    Private Declare PtrSafe Sub CopyMemory Lib “kernel32” Alias “RtlMoveMemory” _
    (Destination As Any, _
    Source As Any, _
    ByVal Length As LongLong)

    Private Declare PtrSafe Function GetWindowLongPtr Lib “USER32” Alias “GetWindowLongPtrA” _
    (ByVal hWnd As LongPtr, _
    ByVal nIndex As Long _
    ) As LongPtr

    #ElseIf VBA7 Then

    Private Declare PtrSafe Sub CopyMemory Lib “kernel32” Alias “RtlMoveMemory” _
    (Destination As Any, _
    Source As Any, _
    ByVal Length As Long)

    Private Declare PtrSafe Function GetWindowLongPtr Lib “USER32” Alias “GetWindowLongA” _
    (ByVal hWnd As LongPtr, _
    ByVal nIndex As Long _
    ) As LongPtr

    #Else

    Private Declare Function GetWindowLongPtr Lib “USER32” Alias “GetWindowLongA” _
    (ByVal hWnd As Long,
    ByVal nIndex As Long _
    ) As Long

    Private Declare Sub CopyMemory Lib “kernel32” Alias “RtlMoveMemory” _
    (Destination As Any, _
    Source As Any, _
    ByVal Length As Long)

    #End If

  3. Nigel,

    Thanks for Your input. When I started to create the tool I actually started with three statements. However, I dropped it because as You point it out: *mostly*.

    My target with the first public version was to release it and then take part of the feedback to see what the next update will be.

    It’s on my to-do-list but right now it has no priority.

    Once again thanks for Your kind input,
    Dennis

  4. Hi Dennis,

    I just updated my main utility addin – used by me on an hourly basis and a couple of co-workers occasionally – to run in 32 and 64-bit Excel 2016. Your API Viewer was helpful in getting it to work.

    Thanks!


Posting code? Use <pre> tags for VBA and <code> tags for inline.

Leave a Reply

Your email address will not be published.