473,320 Members | 2,094 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Issue with RegOpenKeyEx

VJK
This question is related to Windows registry key opening.

Please refer to the following two lines of VC++ code

printf ("queryRegistrySetting:%s - %s - %s\n", subElement,
variableName, variableType);
output: queryRegistrySetting: Software\\xx\\xx\\xx\\xx\\xx - Args - EXPAND_STRING

long result = RegOpenKeyEx (HKEY_LOCAL_MACHINE, subElement, 0,
KEY_ALL_ACCESS, &key);
output: fails with return value of 87 From winerror.h: #define ERROR_INVALID_PARAMETER 87L // dderror


But,

long result = RegOpenKeyEx (HKEY_LOCAL_MACHINE,
"Software\\xx\\xx\\xx\\xx\\xx", 0, KEY_ALL_ACCESS, &key);

succeeds without any error. As you can see, in the second case, I have
replaced the variable subElement, with actual value.

Once it succeeds with the above change, even if I use the variable
subElement, i.e.

long result = RegOpenKeyEx (HKEY_LOCAL_MACHINE, subElement, 0,
KEY_ALL_ACCESS, &key);

succeeds without any error, till I logout and login or reboot the
system.

Alternate way of executing RegOpenKeyEx without error:
----------------------------------------------------------------------------------

Instead of replacing subElement with actual value, if I do,

a. Start->Run->regedit
b. this opens the registry editor.
c. without doing any change, I just close the registry editor.

After this,

long result = RegOpenKeyEx (HKEY_LOCAL_MACHINE, subElement, 0,
KEY_ALL_ACCESS, &key); succeeds without any error.

Could someone, explain, if they have faced similar issue and if so, how
this is solved, please ?

Thanks in advance for your help.

Jul 23 '05 #1
3 7641
>>This question is related to Windows registry key opening.

Then post it to a newsgroup which cares about such things. This
newsgroup is about the standard C++ language, which knows nothing about
the windows registry.

Jul 23 '05 #2
> This question is related to Windows registry key opening.

So why not post to the Microsoft New Server where there are, no joking,
1000's of newgroups devoted to Microsoft technology? There is an army of
people that will answer your questions.
And similarly if you were using Borland technology, raise matters on the
Borland news server.

You want to subscribe to news://microsoft.news.com

Stephen Howe
Jul 23 '05 #3
Stephen Howe wrote:
This question is related to Windows registry key opening.

So why not post to the Microsoft New Server where there are, no joking,
1000's of newgroups devoted to Microsoft technology? There is an army of
people that will answer your questions.
And similarly if you were using Borland technology, raise matters on the
Borland news server.

You want to subscribe to news://microsoft.news.com


You mean news://news.microsoft.com :-)

Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Paul Mateer | last post by:
Hi, I have been running some queries against a table in a my database and have noted an odd (at least it seems odd to me) performance issue. The table has approximately 5 million rows and...
7
by: George Hester | last post by:
Please take a look at this google artcle: http://groups.google.com/groups?hl=en&lr=&frame=right&th=55d6f4b50f5f9382&seekm=411f370d%241%40olaf.komtel.net#link9 The op was having trouble with...
2
by: Anthony Cuttitta Jr. | last post by:
We have an application that outputs several different graphs from data downloaded from our AS400. The application has worked without (this) issue for several months now, but just recently, the...
2
by: sarab | last post by:
Hi , I am having problems accessing the registry using RegOpenKeyEx(). It returns 2. The keys are related to MS SQL Server 2000. Do i need some permissions to access the registry?. please...
0
by: Kevin Spencer | last post by:
Hi all, I am working on a service that uploads METAR weather information to the National Weather Service FTP site. The service I'm authoring is hosted on a Windows 200 server, and the NWS FTP...
2
by: Ben Rush | last post by:
Hello World, Okay, I have spent the day browsing the newsgroups and reading up on article after article concerning ViewState corruption and so forth, and I have a couple questions. We...
5
by: Robert | last post by:
I have a series of web applications (configured as separate applications) on a server. There is a main application at the root and then several virtual directories that are independant...
13
by: SAL | last post by:
Hello, I'm trying to include a popup in the ItemTemplate of a gridview row. The ItemTemplate for the field contains a textbox and when the user clicks in the textbox I want a popup panel to show...
0
by: vickyvick | last post by:
Hi, I'm using Regcreatekeyex() to query a value, the frequency of using this function is very high and I was wondering if I could use the Regcopenkeyex function to optimise the code,Please leave...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.