Hi, Jack: I suspect this error is the same reason your original code didn't work. As I said, I ran the code on my sole Win 8.1 box here, and it ran fine.
If you open the registry in RegEdit (the usual disclaimers apply: make backups, don't change anything; if apocalypse occurs, it's not my fault) and see if you can navigate to HKLM/Software/Microsoft... etcetera. Perhaps the problem is that the key isn't yet there, in which case you should likely test for the existence of elements in the branch: Windows Defender, and on down. On Wed, Jan 14, 2015 at 1:01 PM, Jack Skelley <[email protected]> wrote: > Good Afternoon Ted: > In regopenkey in registry.prg returns an error of 2. > I think error 2 means the key can't be opened. > Using the registry class in Windows 7 works fine. > Thanks for the help. > Jack > > ________________________________________ > From: ProfoxTech [[email protected]] on behalf of Ted Roche [ > [email protected]] > Sent: Tuesday, January 13, 2015 7:56 PM > To: [email protected] > Subject: Re: VFP6: Windows 8.1 Read A Registry Key > > I've never tried to use WScript to do this. VFox ships with several > different samples that read the Registry. This works on my Win 8.1 machine: > > #DEFINE HKEY_LOCAL_MACHINE -2147483646 && BITSET(0,31)+2 > > LOCAL regfile, oReg, lnValue, llRetVal > > regfile = HOME(2)+"classes\registry.prg" > > SET PROCEDURE TO (m.regfile) ADDITIVE > > oReg = CreateObject("registry") > > lnValue = 0 > > llRetVal = oReg.GetRegKey("DisableAntiSpyware",@lnValue,; > "Software\Microsoft\Windows Defender",; > HKEY_LOCAL_MACHINE) > > WAIT WINDOW "The value is " + STR(lnValue) > > On Tue, Jan 13, 2015 at 6:37 PM, Jack Skelley < > [email protected]> > wrote: > > > Good Evening All: > > I would like to be able to read a registry key in Windows 8.1 to see if > > the Windows Defender is active. So: > > gbError = .f. &&on error handles a key not found > > goWSHShell = CreateObject("WScript.Shell") > > lcKey = "HKLM\SOFTWARE\Microsoft\Windows Defender\DisableAntiSpyware" > > lnReturn = goWSHShell.RegRead(lcKey) > > do case > > case gbError > > gcDefender = "Microsoft Windows Defender Key Not Found..." > > case lnReturn = 1 > > gcDefender = "Microsoft Windows Defender Found And Enabled..." > > case lnReturn = 0 > > gcDefender = "Microsoft Windows Defender Present But Not Enabled..." > > endcase > > wait window gcDefender timeout 1 > > I have zero issues reading a registry key in Windows 7 but in 8.1 I get > an > > error 'invalid root key' > > I am sure it has something to do with the permissions of the key. I > > checked the permissions this and it gives 'read' rights to all users. > > But I still can't access the key. > > So how do you accesses the key? Thanks for any help. > > Best regards > > Jack [excessive quoting removed by server] _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/cacw6n4uosnwzmngyyoxmcipkypidzuugrpcqhfuchkvfcye...@mail.gmail.com ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

