|
Restored from previous forum. Originally posted by Mr.Skunk.
Hello, as i've not the key you mentionned in your precedent article, this example will read the current version string of Zone Alarm (firewall)
; Little example to read Registry values
#PB_Window_ThickFrame=262144 InitWindow(0) If OpenWindow(0, 100,100, 600,240, #PB_Window_ThickFrame | #PB_Window_SystemMenu ,"Registry example")
; ; Open the Key ;
subkey.s="Software\Zone Labs\ZoneAlarm" ; Key path (without the keyname you want to read) keyhandle.l=0 ; the handle of the key, return by the RegOpenKeyEx function a.l=RegOpenKeyEx_(#HKEY_LOCAL_MACHINE,@subkey,0,#KEY_READ,@keyhandle) ; to open the key
; ; Read the KEy ;
name$="CurrentVersion" ; name of the key you want to use type.l=0 ; type of the key, returned by the function data$=" " ; buffer where you will read result (maxlength = 255) datasize.l=255 ; max Length of the result buffer
a.l=RegQueryValueEx_(keyhandle,@name$,0,@type,@data$,@datasize) ; read the key
; ; Close the Key ; a.l=RegCloseKey_(keyhandle) ; free the momory of the key handle
drawingoutput(windowid())
If type=#REG_SZ ; if key type=text a$=left(data$,datasize-1) ; get the result string (without the final '0') locate(20,20):drawtext(a$) EndIf
stopdrawing()
Repeat EventID.l = WaitWindowEvent() If EventID = #PB_EventCloseWindow Quit = 1 EndIf Until Quit = 1 EndIf End Hope it helps, feel free to ask if it's not clear.
Mr Skunk
Edited by - mr.skunk on 26 June 2001 14:20:43
|