????? ????? DWORD ??? ???????

?????? ????????? ?????? ?????????
???? ???????: 258262 - ??? ???????? ???? ????? ????? ??? ???????.
????? ???? | ?? ????

??????

?? ??? ??????? ?? ??????? ????? ????????? ??? ???????. ???? ??? ?????? ????? ????? ??? REG_DWORD ???????? ???? ?? ?????? ?? ??????? ???? ???????. ?? ???? ??? ???? ???? ??????? ??????, ????? ??? ??????.

??????? ????

???: ????? ??? ??????? ??? ??????? ??? ????? ???????. ??? ????? ?????? ???? ?? ??? ???? ???????? ??????? ?? ???? ?????? ???????? ?? ???? ???? ?????. ?????? ??? ??????? ??? ????? ??? ???? ???????? ?? ????? ????????? ??????? ???? ??? ??? ??????? ?????? ?????? ?? "????? ??????? ?? Microsoft:
256986??? ????? Microsoft Windows

?????: ???? ??????? "???? ???????" ?????? ??? ?????? ?? ???? ???? ?????? ????? ???? ????? ????? ???? ???????. ??? ???? Microsoft ?? ???????? ???? ???? ?? ??????? "???? ???????" ?????? ??? ?????. ?????? "???? ???????" ??? ???????? ??????.

??????? ??? ???? ??????? ?? ??? ??????? ?? ??? ?????? ?? ???? Microsoft Windows NT "?" Microsoft Windows 2000. ??? ??? ???? ?????? Microsoft Windows 9 X ????? ??? ??????? Regedit.exe ????? ?? Regedt32.exe.

??????:?????? ??? ??????? ?? ????? ????? ???? ??? ????? ??? ?????? ???????? ??? ??? ??? ???????? ?? ????????.
  1. ??? ????? "???? ???????" (Regedt32.exe).
  2. ??? ???? ??????? ?????? ?? ???????:
       HKEY_LOCAL_MACHINE\Software
    					
  3. ?? ??????? ????? ? ???? ??? ????? ????? ?? ?? ?????? ????? ??????? ??????:
       VfpREGTest
    					
  4. ?? ??????? ????? ? ???? ??? ????? ???? ? ?? ?? ?????? ???? ??????? ???????:
       Value Name: MyDWORD
       Data Type:  REG_DWORD
       Value:      0
    					
  5. ?? ?????? "???? ???????".
  6. ????? ?????? ?? Visual FoxPro ?? ???? ???????? ???????? ???????:
    #DEFINE HKEY_CLASSES_ROOT           -2147483648
    #DEFINE HKEY_CURRENT_USER           -2147483647
    #DEFINE HKEY_LOCAL_MACHINE          -2147483646
    #DEFINE HKEY_USERS                  -2147483645
    
    LOCAL nKey, cSubKey, cValue, nValueToWrite, lSuccess
    nKey = HKEY_LOCAL_MACHINE
    nValueToWrite = 1
    cSubKey = "Software\VfpREGTest"
    cValue = "MyDWORD"
    
    lSuccess = WriteRegDWORD(nKey, cSubKey, cValue, nValueToWrite)
    
    IF (lSuccess) THEN
       =MESSAGEBOX("Function Successful.")
    ELSE
       =MESSAGEBOX("Function Not Successful.")
    ENDIF
    
    FUNCTION WriteRegDWORD
       * This function writes a REG_DWORD to the registry. It will return .T.
       * if successful and .F. if it isn't successful.
       PARAMETERS  nKey, cSubKey, cValue,  nValueToWrite
       * nKey The root key to open. It can be any of the constants defined below.
       *#DEFINE HKEY_CLASSES_ROOT           -2147483648
       *#DEFINE HKEY_CURRENT_USER           -2147483647
       *#DEFINE HKEY_LOCAL_MACHINE          -2147483646
       *#DEFINE HKEY_USERS                  -2147483645
       *cSubKey The SubKey to open.
       *cValue The value that is going to be written.
       *nValueToWrite The value to write to the registry
    
       * Constants that are needed for Registry functions
       #DEFINE REG_DWORD   4
    
       * WIN 32 API functions that are used
       DECLARE Integer RegOpenKey IN Win32API ;
          Integer nHKey, String @cSubKey, Integer @nResult
       DECLARE Integer RegSetValueEx IN Win32API ;
          Integer hKey, String lpszValueName, Integer dwReserved,;
          Integer fdwType, String lpbData, Integer cbData
       DECLARE Integer RegCloseKey IN Win32API Integer nHKey
    
       * Local variables used
       LOCAL nErrCode          && Error Code returned from Registry functions
       LOCAL nKeyHandle        && Handle to Key that is opened in the Registry
       LOCAL lpdwValueType     && Type of Value that we are looking for.
       LOCAL lpbValue          && The data stored in the value
       LOCAL lpcbValueSize     && Size of the variable
       LOCAL lpdwReserved      && Reserved Must be 0
    
       * Initialize the variables
       nKeyHandle = 0
       lpdwReserved = 0           
       lpdwValueType = REG_DWORD
       lpcbValueSize = 4     && DWORD is 4 bytes
    
       lpbValue = LongToStr(nValueToWrite)
    
       nErrCode = RegOpenKey(nKey, cSubKey, @nKeyHandle)
       * If the error code isn't 0, then the key doesn't exist or can't be opened.
       IF (nErrCode # 0) THEN
          RETURN .F.
       ENDIF
    
       nErrCode=RegSetValueEx(nKeyHandle, cValue, lpdwReserved, lpdwValueType, lpbValue, lpcbValueSize)
       =RegCloseKey(nKeyHandle)
       IF (nErrCode # 0) THEN
          RETURN .F.
       ENDIF
    RETURN .T.
    
    FUNCTION LongToStr
    * This function converts a long to a string
       PARAMETERS nLongVal
       LOCAL nLoopVar, strReturn
    
       strReturn = ""
       FOR nLoopVar = 24 TO 0 STEP -8
          strReturn = CHR(INT(nLongVal/(2^nLoopVar))) + strReturn
          nLongVal = MOD(nLongVal, (2^nLoopVar))
       NEXT
    RETURN strReturn
    * End of Code
    					
  7. ????? ????????? ???????? ?? ?????? ?? ?????? 1. ???? ???? ????? ??????? ???? ?? ??? ??????. ????? ??????? regedt32.exe ?????? ?? ??? ??? ????? ?????? ??? ???????.
  8. ????? ??????? nKey ? cSubKey cValue ? nValueToWrite ?????????? ?????? ?? ????? ??? ???????.
(?) Microsoft Corporation 2000? ???? ???? ?????. ????????? ?????? ????? Barnard ? Microsoft Corporation.

?????


?????? ??? ??????? ?????? ?????? ??? ??? ?? ??????? ? ???? ??? ??? ??????? ????? ?????? ?? "????? ??????? ?? Microsoft:
244675????? ????? ToUse Windows Script Host ??? ????? ?? ??? ???????

???????

???? ???????: 258262 - ????? ??? ??????: 27/????? ??????/1425 - ??????: 2.2
????? ???
  • Microsoft Visual FoxPro 3.0 Standard Edition
  • Microsoft Visual FoxPro 3.0b Standard Edition
  • Microsoft Visual FoxPro 5.0 Standard Edition
  • Microsoft Visual FoxPro 5.0a
  • Microsoft Visual FoxPro 6.0 Professional Edition
????? ??????: 
kbmt kbapi kbcodesnippet kbhowto kbregistry KB258262 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????258262

????? ???????

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com