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

    #16
    Re: Get registry key

    Bump.

    Comment


      #17
      Re: Get registry key

      I take a look at it, but I can't promise anything.

      --------- Edit -------------

      The Error 87 sounds familiar, I got a lot of them. This is my try-out of an api version.

      Last edited by Marcel Kollenaar; 04-07-2010, 12:53 PM.
      Marcel

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

      Comment


        #18
        Re: Get registry key

        Ah, Declaresturct is how to pass byRef. My first try at that is giving "function not recognized" error, so more testing.

        Bill.

        Comment


          #19
          Re: Get registry key

          Hi Bill,

          Originally posted by Bill Parker View Post
          Ah, Declaresturct is how to pass byRef. My first try at that is giving "function not recognized" error, so more testing.
          I won't have time to look at this in this week, but you should know that anytime you change the Declare or Declarestruct lines (as opposed to initially create one), you must restart Alpha Five. That's exactly why the CSDA Code Utility was originally created. 5000 restarts later, and it get's real tiresome! :D
          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


            #20
            Re: Get registry key

            Been there, done that.

            Comment


              #21
              Re: Get registry key

              Ira,

              That's a hard coded pleasure bug. An alternative name is "By Design". They should have add a destruct("structure_name") function. ;)

              But there is an undeclare statement. Technically it will disconnect the link to the external function in the dll. If you put it at the end of the code the only thing you have to do is to restart A5 for changes in the declarestructs.
              Last edited by Marcel Kollenaar; 04-07-2010, 05:07 PM.
              Marcel

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

              Comment


                #22
                Re: Get registry key

                Originally posted by Bill Parker View Post
                Ah, Declaresturct is how to pass byRef. My first try at that is giving "function not recognized" error, so more testing.

                Bill.
                Structures are passed by it's pointer value and therefore "ByRef".

                ----------------- edit ----------------

                Hmmm, still no success. One of the best programmers here around remined me at an old dll. Maybe I have to look at PureBasic or Powerbasic to construct a dll that does the job and the dll self will recieve "save" A5 friendly parameters. But this will take some.
                Last edited by Marcel Kollenaar; 04-07-2010, 05:11 PM. Reason: Still no success
                Marcel

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

                Comment


                  #23
                  Re: Get registry key

                  Marcel,

                  I have successfully gotten past
                  RegOpenKeyEx(HKEY_LOCAL_MACHINE,SubKey,0,KEY_READ,lngKeyHandle)

                  There was a difference between us in the 3rd parameter. You used Key_Query_VAlue. That was one component of my Key_Read. Maybe there was a security issue.

                  Now I am working on
                  RegEnumValue()

                  I'll post after some more trials.

                  Bill.

                  Comment


                    #24
                    Re: Get registry key

                    Attached is the current state of the function. I need to do an assignment to a parameter that will be passed byRef. It was defined with declarestruct. Since it is defined as a long int assigning a number to is does not work? I get "variable not found", although properties_enum() shows it.

                    The issues are just past the current debug(1) statement.

                    Bill.

                    Comment


                      #25
                      Re: Get registry key

                      Here is a different approach that may help you.

                      From Interactive
                      Code:
                      ?f_GetRegKey("HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\MUICache", "C:\Program Files\a5V10\alpha5.exe")
                      = "C:\\Program Files\\a5V10\\alpha5.exe"="Alpha Five"
                      FUNCTION Code
                      Code:
                      'Date Created: 07-Apr-2010 10:07:29 PM
                      'Last Updated: 07-Apr-2010 10:07:29 PM
                      'Created By  : andy
                      'Updated By  : andy
                      FUNCTION f_GetRegKey AS C ( vArgKeyC as C, vArgValueC as C )
                      	OPTION STRICT
                      	OPTION ENCRYPTED_TOKENS
                      	ON ERROR GOTO ERR_HANDLER
                      	
                      	'ui_msg_box("", vArgKeyC + crlf() + vArgValueC )
                      	
                      	DIM vBatchFileC as C
                      	vBatchFileC = a5.Get_Path()+chr(92)+"Temp.bat"
                      	IF FILE.exists(vBatchFileC) THEN
                      		FILE.remove(vBatchFileC)
                      	END IF
                      	
                      	DIM vRegFileC as C
                      	vRegFileC = a5.Get_Path()+chr(92)+"Temp.txt"
                      	IF FILE.exists(vRegFileC) THEN
                      		FILE.remove(vRegFileC)
                      	END IF
                      
                      	DIM vCommandLineC as C
                      	vCommandLineC = "regedit.exe /e " + chr(34) + vRegFileC + chr(34) + " " + vArgKeyC
                      	'ui_msg_box("",vCommandLineC)
                      
                      	FILE.from_string(vBatchFileC,vCommandLineC)
                      	
                      	IF File.exists(vBatchFileC) THEN
                      		sys_shell_wait(vBatchFileC)
                      		IF File.exists(vRegFileC) THEN
                      			'sys_open(vRegFileC)
                      		ELSE
                      			ui_msg_box("Error",vRegFileC + " does not exist",UI_STOP_SYMBOL)
                      			END
                      		END IF
                      	ELSE
                      		ui_msg_box("Error", vBatchFileC + " does not exist",UI_STOP_SYMBOL)
                      		END
                      	END IF
                      	
                      	DIM vFileContentsC as C
                      	vFileContentsC = file.to_string(vRegFileC)
                      	'ui_msg_box("",vFileContentsC)
                      	
                      	vArgValueC = strtran(vArgValueC, chr(92), chr(92) + chr(92) )
                      	'ui_msg_box("",vArgValueC)	
                      	
                      
                      	DIM vReturnC as C
                      	FOR EACH foo IN vFileContentsC
                      '		ui_msg_box("",foo.value)
                      		IF vArgValueC $ foo.value THEN		
                      			vReturnC = vReturnC + crlf() + foo.value		
                      		END If
                      	NEXT
                      	vReturnC = remove_blank_lines(vReturnC)
                      	'ui_msg_box(line_count(vReturnC),vReturnC)		
                      
                      	
                      	IF FILE.exists(vBatchFileC) THEN
                      		FILE.remove(vBatchFileC)
                      	END IF
                      	
                      	IF FILE.exists(vRegFileC) THEN
                      		FILE.remove(vRegFileC)
                      	END IF
                      
                      	f_GetRegKey = vReturnC	
                      	
                      	END
                      	'-----------------------------------
                      	'Error handler
                      	'-----------------------------------
                      	ERR_HANDLER:
                      		Dim err as N= error_code_get()
                      		Dim msg as C= "Error # "+ err + crlf() + error_text_get(err)
                      		msg = msg + crlf() + "Script: " + error_script_get()
                      		msg = msg + crlf() + "Line #: " + error_line_number_get()
                      	
                      		trace.writeln(msg)
                      	
                      		ui_msg_box("Error", msg, ui_attention_symbol)
                      		msg = ""
                      		
                      		END
                      END FUNCTION
                      Andrew

                      Comment


                        #26
                        Re: Get registry key

                        Originally posted by Bill Parker View Post
                        Marcel,

                        I have successfully gotten past
                        RegOpenKeyEx(HKEY_LOCAL_MACHINE,SubKey,0,KEY_READ,lngKeyHandle)

                        There was a difference between us in the 3rd parameter. You used Key_Query_VAlue. That was one component of my Key_Read. Maybe there was a security issue.

                        Now I am working on
                        RegEnumValue()

                        I'll post after some more trials.

                        Bill.
                        Bill, the fact that I used the query value is that the example iterates through the sub values of the key.
                        Marcel

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

                        Comment


                          #27
                          Re: Get registry key

                          Originally posted by aws View Post
                          Here is a different approach that may help you.
                          [/code]
                          aws, thanks for this out of the box thinking version. I'll put it in my code lib.
                          Marcel

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

                          Comment


                            #28
                            Re: Get registry key

                            Originally posted by Bill Parker View Post
                            Attached is the current state of the function. I need to do an assignment to a parameter that will be passed byRef. It was defined with declarestruct. Since it is defined as a long int assigning a number to is does not work? I get "variable not found", although properties_enum() shows it.

                            The issues are just past the current debug(1) statement.

                            Bill.
                            Bill, illuminating code. I like the way you pick up new approaches and play with it. I have to study your code and acn learn a lot. I almost never use the type end type for parameters. Different mind, different approach.

                            Have to work now and will take a look at it later.
                            Marcel

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

                            Comment


                              #29
                              Re: Get registry key

                              Thanks Andy. Works great.

                              I was sure that I had looked into exporting a hive, but maybe not. When I do it interactively now, the format is different (and more difficult to work with) from what your command line gives.

                              The sys_shell() does flash on the screen, and that is one thing I was hoping to avoid by using the api approach.

                              Now that I am into conversion of this api code, it is a good learning moment for future situations if we can get it completed.

                              Bill.

                              Comment


                                #30
                                Re: Get registry key

                                Just a quick question

                                When I run andys code, I get

                                vArgKeyC = HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\MUICache
                                vArgValueC = C:\Program Files\a5V9\alpha5.exe
                                vBatchFileC = C:\Alpha5v9\WVLogin\Temp.bat
                                vRegFileC = C:\Alpha5v9\WVLogin\Temp.txt
                                vReturnC =
                                f_GetRegKey =


                                What should I expect to see in f_GetRegKey =

                                Thanks
                                Charlie Crimmel

                                Comment

                                Working...
                                X