Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Access denied
Message
From
15/06/2000 20:16:17
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Title:
Access denied
Miscellaneous
Thread ID:
00381109
Message ID:
00381109
Views:
74
I setup the following code to check for the existance of a printer ( I intend to use the program as a postsetup call for vfp setup ). When I run it I get a response of 5 from the RegOpenKeyEx function. I have checked the path with regedit and it exists. I am confused :(

Can the Klingons come to the rescue?

Also, what is the 4th parameter for. It was defined as nSecurityAccess in the declaration but I can't find a list of what the numbers should mean.

I know the registry class would make this simpler but I have the bit in my teeth now and I don't want to let go.

Here is the code:

**************************************************************************
*** Add PDF printer IF it is NOT already there
**************************************************************************
*** Check registry for existance of 'DocuComm PDF Driver' checks for
*** existance of:
*** HKEY_LOCAL_MACHINE\System\CurrentControlSet\control\Print\Printers\DocuCom PDF Driver
*** registry entry.
#INCLUDE Programs\Registry.H && Handles number parameter converting them to user
* friendly names ie HKEY_LOCAL_MACHINE to -2147483646


*** Setup structure for Win32API
LOCAL lnHandle, lnSuccess

DECLARE INTEGER RegOpenKeyEx IN Win32API ;
INTEGER nStartHandle, ;
STRING cKeyToOpen, ;
INTEGER nReservedZero, ;
INTEGER nSecurityAccess, ;
INTEGER @nOpenHandle


DECLARE INTEGER RegCloseKey IN Win32API ;
INTEGER nHKey

set step on

STORE 0 TO lnHandle,lnSuccess
*- Open the PDF printer key
lnSuccess = RegOpenKeyEx(HKEY_LOCAL_MACHINE, ;
"SYSTEM\CurrentControlSet\Control\Print\Printers\DocuCom PDF Driver", 0, 0, @lnHandle)

lnSuccess = RegCloseKey(lnHandle)
It is impossible to make programs idiot proof. Idiots are too cleaver.

MCP( Tcp/Ip )
Next
Reply
Map
View

Click here to load this message in the networking platform