Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Setting Registry Key Value
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00483144
Message ID:
00483156
Views:
12
>I am having difficulty with setting a registry key value using API calls.
>
>Let me try to explain this. In the registry under HKEY_CLASSES_ROOT, there are file extentions, such as ".dbc" and it has a DEFAULT value of "Visual.Foxpro.Database".
>
>When I try to set this with API calls (using registry.vcx in the FFC) I can set a value, but it is not the DEFAULT value. (It adds a Name and a value to the key underneath the default value.) Searching through MSDN, the only tip I could find is to add the Name as '' and supposedly it will add the value to the default entry, but this does not work.
>
>The reason I need it to be the default value is becuase that is what Windows looks for in a file association. If a FileType is not noted in the default value, it thinks that there is no association, even if the next entry down holds the file type.
>
>If anyone has been able to figure this out, please let me know. My next approach is to try this in C++, but I am very weak in that language.
>
Greg,

It's a problem with the registry class. The problem is shown below:
DO CASE
  CASE TYPE("This.nCurrentKey") # 'N' OR This.nCurrentKey = 0
    nErrCode = ERROR_BADKEY
  CASE TYPE("cValueName") # "C" OR TYPE("cValue") # "C"
    nErrCode = ERROR_BADPARM
  <b>CASE EMPTY(cValueName) OR EMPTY(cValue)
    nErrCode = ERROR_BADPARM</b>
  OTHERWISE
    nErrCode = ERROR_SUCCESS
ENDCASE
In order to set the default value, you have to pass an empty string as the value name parameter here
nErrCode = RegSetValueEx(This.nCurrentKey, <b>cValueName</b>, 0, lntype, cValue, nValueSize)
However, this code never executes because of the setting of the error in the case statement.
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform