Results 1 to 3 of 3
  1. #1
    5 Star Lounger jujuraf's Avatar
    Join Date
    Jun 2001
    Location
    San Jose, California, USA
    Posts
    1,061
    Thanks
    0
    Thanked 0 Times in 0 Posts

    read registry with WinAPI (Excel 97/2000)

    I have a request from a co-worker to write a query to determine if the current instance of Excel is running on a computer which is owned by my company. I've looked in the registry and there are several registry entries which I think are unique that would answer the question. (Each employee is given a company-formatted PC which is pre-configured with a standard set of software but you can add your own too). What I'd like to get is the equivalent of the text on the MyComputer/Properties window. It shows who the computer is registered to name/company. I have that great API tool from www.allapi.net but can't figure out which registry call to use.

    Any registry geniuses out there?

    Deb <img src=/S/brickwall.gif border=0 alt=brickwall width=25 height=15>

  2. Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

  3. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: read registry with WinAPI (Excel 97/2000)

    Well, this is cheating, but... Word has a System.PrivateProfileString function that makes registry reading relatively easy, without any API programming. However, you would need to set a Reference to Word in order to do this efficiently.

    Example:

    <pre>Sub RegRead()
    'requires a reference to the Microsoft Word x.x Object Library
    Dim strSetting As String
    strSetting = System.PrivateProfileString("", _
    "HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentV ersion" & _
    "ExplorerUser Shell Folders", _
    "Personal")
    MsgBox strSetting
    End Sub</pre>

    Hopefully a real registry genius will post the actual API calls if you prefer to go that way.

  4. #3
    3 Star Lounger
    Join Date
    Aug 2001
    Location
    Jeddah, Saudi Arabia
    Posts
    243
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: read registry with WinAPI (Excel 97/2000)

    On my Windows 2000 system the registered owner is found in the HKEY_LOCAL_MACHINESoftwareMicrosoftWindows NTCurrentVersionRegisteredOwner key.

    I used the Regedit program to search for the name displayed in My Computer properties. I guess you will have to do the same to differentiate between the keys used by the various flavours of Windows.

    Regards,

    Kevin Bell

Posting Permissions

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