Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Get registry key

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Get registry key

    I need to check if an object has been registered in Windows. It looks like I can check this key because I find the same key on XP and Server 2003. (Not even thinking about Win7 yet.) But I don't know how to specify it since the key name includes a "path" with backslashes.

    Code:
    ?Registry.sys_get("HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\MUICache")
    returns blank, because there are multiple names with this key path. The name of the key I need to check is "D:\AMSC\bmc_cass.exe", so that would be
    Code:
    ?Registry.sys_get("HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\MUICache\D:\AMSC\bmc_cass.exe")
    Alpha does not like that. How should I escape the backslashes in that last segment of the key name?

    The return value I am looking for will be something like "foo API".

    Bill.

    #2
    Re: Get registry key

    Hi Bill,

    Based upon my exploration, I don't think there is any workable solution using existing A5 functions. But I'm sure an API call from Alpha could probably do it.

    Perhaps Selwyn might have a more definitive answer.

    --Ira
    Regards,

    Ira J. Perlow
    Computer Systems Design


    CSDA A5 Products
    New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
    CSDA Barcode Functions

    CSDA Code Utility
    CSDA Screen Capture


    Comment


      #3
      Re: Get registry key

      Thanks Ira.

      Bill.

      Comment


        #4
        Re: Get registry key

        Originally posted by Bill Parker View Post
        How should I escape the backslashes in that last segment of the key name?
        Responding only to this part of your question, you escape the backslash with a backslash, i.e. if the name is:
        abc\xyz
        you change it to:
        abc\\xyz

        Comment


          #5
          Re: Get registry key

          I played with this also, and agree with Ira.

          Using "\" or chr(92) will not work in this instants.

          Bill, FYI, W7 path is HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\MuiCache

          Scott
          Last edited by Scott Emerick; 02-08-2010, 12:52 PM.

          Comment


            #6
            Re: Get registry key

            Selwyn suggested looking at the VB code on activexperts.com to find something that might be adapted. I'll do that and report back if I find anything.

            Bill.

            Comment


              #7
              Re: Get registry key

              Look at: http://www.activexperts.com/activmon...ipts/registry/
              Marcel

              I hear and I forget. I see and I remember. I do and I understand.
              ---- Confusius ----

              Comment


                #8
                Re: Get registry key

                Yes, that is the link Selwyn gave me. Many scripts use WMI. I have brought up the wikipedia page on that but I don't know how much I will need to learn about WMI yet.

                Bill.

                Comment


                  #9
                  Re: Get registry key

                  What about this example:

                  Code:
                  'Date Created: 08-Feb-2010 07:49:41 PM
                  'Last Updated: 08-Feb-2010 07:49:41 PM
                  'Created By  : Marcel Kollenaar
                  'Updated By  : Marcel Kollenaar
                  debug(0)
                  Dim objShell as P
                  Dim strShell as C
                  objShell = ole.Create("WScript.Shell")
                  strShell = objShell.RegRead("HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Word\Wizards\PageSize")
                  ui_msg_box("Show pageSize",strShell)
                  Code:
                  L appactivate(A App,[A Wait])  '
                  C Class()  'Get the metaclass.
                  P createshortcut(C PathLink)  '
                  OLE::wscript.shell::IWshExec exec(C Command)  '
                  C expandenvironmentstrings(C Src)  '
                  L logevent(A Type,C Message,[C Target])  '
                  L Onedit()  'Public user defined function.
                  N popup(C Text,[A SecondsToWait,[A Title,[A Type]]])  '
                  V regdelete(C Name)  '
                  A regread(C Name)  '
                  V regwrite(C Name,A Value,[A Type])  '
                  N run(C Command,[A WindowStyle,[A WaitOnReturn]])  '
                  V sendkeys(C Keys,[A Wait])  '
                  CurrentDirectory = "C:\Documents and Settings\Marcel Kollenaar"
                  +Environment.
                  +SpecialFolders.
                  Use objShell.RegRead, objShell.RegWrite and objShell.Regdelete to manage the registry keys. See also: http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx

                  The best pace to look for scripts is: http://technet.microsoft.com/en-us/s...r/default.aspx and translate it into Xbasic.
                  Last edited by Marcel Kollenaar; 02-08-2010, 03:16 PM.
                  Marcel

                  I hear and I forget. I see and I remember. I do and I understand.
                  ---- Confusius ----

                  Comment


                    #10
                    Re: Get registry key

                    Marcel,

                    Your script works, but not for me because my key value name includes backslashes.

                    I found this code on activexperts. What is good is that it has separate parameters for the key path and the value name. (I am hoping that may be a solution.) So I have started to translate the script to xbasic, but I need to figure out what WScript is. Not sure yet if I have handled the hex value correctly. And it looks like there are some other constants I will need to get values for.

                    Code:
                    'const HKEY_LOCAL_MACHINE = &H80000002
                    HKEY_LOCAL_MACHINE = hex_to_dec("80000002")
                    strComputer = "."
                    'Set StdOut = WScript.StdOut
                    StdOut = WScript.StdOut
                     
                    'Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
                    oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" + strComputer + "\root\default:StdRegProv")
                     
                     
                    strKeyPath = "SOFTWARE\Microsoft\Windows Script Host\Settings"
                    strValueName = "TrustPolicy"
                    'oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
                    oReg.GetStringValue (HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue)
                    'StdOut.WriteLine "Current WSH Trust Policy Value: " & strValue
                    ui_msg_box("Current WSH Trust Policy Value: ", strValue)
                    end
                    Bill.

                    Comment


                      #11
                      Re: Get registry key

                      Bill,

                      Try this:

                      Code:
                      dim path as C
                      
                      [COLOR=Red]dim bs as C = chr(92)[/COLOR]
                      
                      path =  [COLOR=Red]"C:"+bs+"Documents and Settings"+bs+"Marcel Kollenaar"+bs+"Application Data"+bs+"Microsoft"+bs+"Sjablonen"+bs[/COLOR]
                      
                      registry.sys_set("HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Common\General\SharedTemplates",path)
                      Use the chr(92) function for the backslash.

                      +++++++++++++++++++++++ edit

                      Actually you will read the first standard key. If you add "test" to the (standard) key the function returns "test". I think the solution is that you need vbscript that iterates with a for each through the result of an sql statement. IMHO The "keys" are not direct accessable.

                      +++++++++++++++++++++++ edit 2

                      Strange this works:
                      ?Registry.sys_get("HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\MUICache\@shell32.dll,-8504")
                      = "A&utomatisch afspelen"
                      Last edited by Marcel Kollenaar; 02-08-2010, 06:14 PM.
                      Marcel

                      I hear and I forget. I see and I remember. I do and I understand.
                      ---- Confusius ----

                      Comment


                        #12
                        Re: Get registry key

                        My similar name in that registry path has a full data path, as
                        @C:\WINDOWS\system32\SHELL32.dll,-9216. But these do not work.
                        Code:
                        ?Registry.sys_get("HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\MUICac@C:\WINDOWS\system32\SHELL32.dll,-9216")
                        = ""
                        ?Registry.sys_get("HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\[email protected],-9216")
                        = ""
                        But in
                        HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\MUICache
                        I also have a name of
                        C:\Program Files\Alpha Software\a5v9\alpha5.exe
                        with a value of "Alpha Five".

                        If you have a similar key can you return the value of "Alpha Five"?

                        Bill.

                        Comment


                          #13
                          Re: Get registry key

                          Hi Bill,

                          I have such a key. But it complains about a the head of the key. So far no success.
                          Marcel

                          I hear and I forget. I see and I remember. I do and I understand.
                          ---- Confusius ----

                          Comment


                            #14
                            Re: Get registry key

                            No success for me either. Very odd. Perhaps enumerating the keys and extracting what you need?
                            Regards,

                            Ira J. Perlow
                            Computer Systems Design


                            CSDA A5 Products
                            New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
                            CSDA Barcode Functions

                            CSDA Code Utility
                            CSDA Screen Capture


                            Comment


                              #15
                              Re: Get registry key

                              I am finally back onto this project. I am converting some VB from the MS knowledgebase. Looks like it should work at least in XP. But of course I have an issue with parameters when calling the dll.

                              I don't see anywhere to specify that parameters are byref (since Alpha's parameters default to byval and some of these are byref). I don't know if that is the problem, but the error code 87 that is returned is "invalid parameter". The offending function is just after the debug(1), if one of you great minds could take a look.

                              Right now the function is hard wired, so it can be called with
                              registry_getvalues("","")

                              Bill.

                              Comment

                              Working...
                              X