13.07.2015 Views

TRABAJO DE GRADUACIÓN - DSpace Universidad Don Bosco

TRABAJO DE GRADUACIÓN - DSpace Universidad Don Bosco

TRABAJO DE GRADUACIÓN - DSpace Universidad Don Bosco

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

End If'check error typeIf lRetVal = 2 Then'key does not exist, create new oneCall CreateRegistryKeyElse'error was some other kind of problemMsgBox "Ocurrio un error al abrir el registro."Exit SubEnd IfEnd SubPrivate Sub CreateRegistryKey()Dim hKey As Long 'registry key handle valueDim lRetVal As Long 'return value for API call result codesDim lRetHKEY As Long 'return value for registry key handleDim lDisposition As Long 'return code so we know if key was created or an existing key openedDim saKeyAttrib As SECURITY_ATTRIBUTES 'holds attributes structure'try to open registry keylRetVal = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "" & Chr(0), 0, KEY_ALL_ACCESS, hKey)'check for errorsIf lRetVal 0 Then'error opening keyMsgBox "Ocurrio un error al abrir el registro"Exit SubEnd If'create keylRetVal = RegCreateKeyEx(hKey, "SOFTWARE\rfidPoll\", 0, Chr(0), REG_OPTION_NON_VOLATILE, _0, saKeyAttrib, lRetHKEY, lDisposition)'check for errorsIf lRetVal 0 ThenMsgBox "Ocurrio un error tratando de crear las claves del registro."End If'close registry keysCall RegCloseKey(lRetHKEY)Call RegCloseKey(hKey)End SubPrivate Sub LoadTags()Dim strKeyName As String 'registry key name return valueDim hKey As Long 'registry key handle valueDim lRetVal As Long 'return value for API call result codesDim lKeyCount As Long 'counts the number of keys we've enumerated so far'clear list boxlstRFIDTags.Clear'open registry keylRetVal = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\rfidPoll\" & Chr(0), 0, _KEY_ALL_ACCESS, hKey)'check for errorsIf lRetVal 0 ThenMsgBox "Ocurrio un error al abrir la clave de registro requerida."Exit Sub 'could not open the registry key!End If'enumerate subkeys and load them into the listboxDo 'loop until we get an errorstrKeyName = Space$(255) 'create room in the variable for API return value'call enumeration APIlRetVal = RegEnumKey(hKey, lKeyCount, strKeyName, 255)'check for errorsIf lRetVal 0 Then'exit loop, we've found them allExit DoEnd If'another key found, increase count and add to the listbox- 166 -

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!