SPONSORS:






User Tag List

Results 1 to 8 of 8
  1. #1
    Guest

    Re: Adding new registry keys using QA Partner

    To have QAP/Silk create a registry key, try the following code snippet:

    // ===============
    // Function: RegCreate()
    //
    // Description:
    // This function creates the specified registry entry if it does not already exist.
    //
    // Parameters: INTEGER iKey registry key
    // STRING sPath path to item through registry hierarchy
    // Returns: none
    // Usage: RegCreate(HKEY_LOCAL_MACHINE, "Software\MyApp")
    // ===============

    dll "advapi32.dll"
    LONG RegCloseKey(LONG hKey)
    LONG RegCreateKeyEx(LONG hKey, STRING lpSubKey, LONG Reserved, STRING lpClass, LONG dwOptions, LONG samDesired, LONG lpSecurityAttributes, out LONG phkResult, out LONG lpdwDisposition) alias "RegCreateKeyExA"


    void RegCreate(INTEGER iKey, STRING sPath)
    LONG hNewKey
    LONG lDisposition
    RegCreateKeyEx(iKey, sPath, 0, "", 0, KEY_READ, 0, hNewKey, lDisposition)
    RegCloseKey(hNewKey)

  2. #2
    Guest

    Re: Adding new registry keys using QA Partner

    Actually, the previous snippet forgot to check to see if the registry key already existed. In reality, it should look like this:

    [-]void RegCreate(INTEGER iKey, STRING sPath)
    [ ] LONG hNewKey
    [ ] LONG lDisposition
    [-] if !RegValueExists(iKey, sPath)
    [ ] RegCreateKeyEx(iKey, sPath, 0, "", 0, KEY_READ, 0, hNewKey, lDisposition)
    [ ] RegCloseKey(hNewKey)


    [-] boolean RegValueExists(INTEGER iKey, STRING sPath, STRING sItem optional)
    [-] if (sItem == NULL)
    [ ] sItem = ""
    [-] do
    [ ] STRING sRes = SYS_GetRegistryValue(iKey, sPath, sItem)
    [ ] return TRUE
    [-] except
    [ ] return FALSE

  3. #3
    AJ
    AJ is offline
    Moderator AJ's Avatar
    Join Date
    Jun 1999
    Location
    San Jose, CA
    Posts
    1,691
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Adding new registry keys using QA Partner

    Hello Tony, if you would like to paste code in try reading about the UBB Code by following this link : http://www.betasoft.com/boards/ubb/ubbcode.html

    This shows you how to paste code in.

    [c o d e]
    paste it here
    [/c o d e]

    it makes code WYSIWYG

    I'm also working on a code attaching function (enables you to upload your code as files)

    Thanks


    ------------------
    AJ Alhait
    BetaSoft Inc.
    AJ Alhait
    BetaSoft Inc.

  4. #4
    Junior Member
    Join Date
    Jul 1999
    Location
    St. Lurent, Quebec, Canada
    Posts
    15
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Adding new registry keys using QA Partner

    Hi,

    I need to have QA Partner run a .reg file (in order to add a certain registry key to my registry) or add a registry key itself. I have been unable to make use of SYS_Execute on the .reg file as "Agent" crashes on the client machine when I do this and Start() claims it cannot find execute the file. To make matters worse, SYS_SetRegistryValue() specifically indicates it will NOT add new keys.

    Help!

    Gili
    Gili Tzabari

  5. #5
    AJ
    AJ is offline
    Moderator AJ's Avatar
    Join Date
    Jun 1999
    Location
    San Jose, CA
    Posts
    1,691
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Adding new registry keys using QA Partner

    To Execute a registry file, I recommend you declare RegEdit and perform an import of a registry file.

    (just a workaround)

    ------------------
    AJ Alhait
    BetaSoft Inc.
    AJ Alhait
    BetaSoft Inc.

  6. #6
    VSC
    VSC is offline
    Junior Member
    Join Date
    Oct 1999
    Location
    Brussels, Belgium
    Posts
    2
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Adding new registry keys using QA Partner

    Hi, this is the first time I use the forum. It looks great.
    I don't find KEY_READ in Tony's code. Can you help me?
    Does somebody else have more registry prototypes?
    Thank you.
    V. Schifflers

  7. #7
    AJ
    AJ is offline
    Moderator AJ's Avatar
    Join Date
    Jun 1999
    Location
    San Jose, CA
    Posts
    1,691
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Adding new registry keys using QA Partner

    There's no Key_Read method, there is a 4Test method called : SYS_GetRegistryValue(iKey, sPath, sItem) which returns a string.

    You can use that.

    I also advice you to download Mr. Cluey's library which has a Registry class that enables you to do almost anything with registries. I've extended his class myself, but it does take a programmer to understand it and extend it (I got help from a developer).

    You can find the library in our download area. Mr. Cluey's page is no longer online, but I still have his library available.

    ------------------
    AJ Alhait
    BetaSoft Inc.
    AJ Alhait
    BetaSoft Inc.

  8. #8
    Guest

    Re: Adding new registry keys using QA Partner

    Sorry about omitting the KEY_READ constant. However, I've attached a rather lengthy snippet of code that includes some useful Registry related constants, and a new function called RegCreateKey(). This function not only does what it's name implies, it also accepts the optional name of a value and and an optional STRING or DWORD value to be set. This function works even if the specified key already exists.

    Tony Mrozinski
    Intel Corporation

 

 

Posting Permissions

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

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 02:14 AM.

Copyright BetaSoft Inc.