Recent

Author Topic: HRESULT to Text utility  (Read 3657 times)

440bx

  • Hero Member
  • *****
  • Posts: 5187
HRESULT to Text utility
« on: April 27, 2021, 11:16:04 pm »
This is a trivial utility for which I will be posting the source sometime in the near future (at least that's what I'm hoping.)  Right now only the executable is attached to this post.

This utility is basically what you find on the MS web page that lists all the HRESULTs and their associated messages.  With this utility you don't need to get on the net and the formatting is stable and predictable, making reading the text as easy as it should be (which is not always the case in the MS webpage.)

I figured I'd post the executable now for anyone who may benefit from it.

Enjoy.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: HRESULT to Text utility
« Reply #1 on: April 28, 2021, 04:44:17 pm »
Thanks for sharing. I like the way you organized it, but I noticed the list does not have the focus by default, there is no way to give it focus bythe keyboard, and, after you click on the list with the mouse, it loses the focus when I switch to a different app and back to your app.

440bx

  • Hero Member
  • *****
  • Posts: 5187
Re: HRESULT to Text utility
« Reply #2 on: April 28, 2021, 05:53:16 pm »
You're right !. I hadn't noticed the list didn't have the focus.  I have to fix that.

I normally just just use the mouse to scroll to the status I am looking for.  Because of that I missed the listbox does not get the focus. 

I'll make sure that is corrected in the version I'll post with source.

Thank you for bringing that to my attention.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

440bx

  • Hero Member
  • *****
  • Posts: 5187
Re: HRESULT to Text utility
« Reply #3 on: January 07, 2025, 06:38:51 am »
I forgot to post the source code for this trivial utility, it is now attached to this post.

This utility is useful when dealing with multiple HRESULT values (for instance when disassembling a dll that returns HRESULTs.)  For a single value, it's probably no better (but no worse either) than looking it up in MSDN.

NOTE:

the awk scripts used to format the HRESULT value and message text are included.  They are automatically applied to the file mshresult.txt which is a lightly cleaned up version of the ms page (as of 2021.)    MS may have added a few HRESULTs since that list was created.

The console version is meant to be used to create a text version of the list that can be manipulated  (or searched) in a text editor.   Other than that, it is not very useful.

Source for both, the console and GUI versions along with the awk scripts are included in the attachment.

Lastly, the lpi has the settings to create debug versions.  For regular use it is more efficient to use a non-debug version, simply change the debug setting and rebuild to obtain a release version (which will be roughly 1/3 the size of the debug version.)


(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

 

TinyPortal © 2005-2018