View previous topic :: View next topic |
Author |
Message |
Lynn
Joined: 27 Aug 2004 Posts: 89
|
Posted: Tue Sep 28, 2004 8:29 pm Post subject: Registry example using Win32 api |
|
|
There is sample code for access to the Win32 registry:
http://www.dsource.org/tutorials/index.php?show_example=125
Caveats:
There are some anomalies using a char[] as the input buffer for RegSetValueExA and using a char[] as the destination buffer for RegQueryValueExA (reflecting my newbie understanding of D.)
There is an
extern (Windows)
definition for RegQueryValueExA since I couldn't find it in std.c.windows.windows. |
|
Back to top |
|
|
jcc7
Joined: 22 Feb 2004 Posts: 657 Location: Muskogee, OK, USA
|
Posted: Tue Sep 28, 2004 10:02 pm Post subject: |
|
|
Cool.
If you're interested in working with the registry, you might be able to benefit from using std.windows.registry by Matthew Wilson. I'm pretty sure Matthew documented it somewhere, but you might have to download the docs from the synsoft website. |
|
Back to top |
|
|
Lynn
Joined: 27 Aug 2004 Posts: 89
|
Posted: Wed Sep 29, 2004 6:48 am Post subject: |
|
|
I gave std.windows.registry a try, but had problems and perhaps gave up too quickly.
* There were conflicts between registry.d and windows.d.
* The first function I tried had an apparent compiler error, which reduced my confidence in the code:
Code: | LONG RegQueryValueExA(in HKEY hkey,
in LPCSTR lpValueName,
in Reserved, // <-- won't compile
out REG_VALUE_TYPE type,
in void *lpData,
inout DWORD cbData);
|
I'll submit a bug report. |
|
Back to top |
|
|
jcc7
Joined: 22 Feb 2004 Posts: 657 Location: Muskogee, OK, USA
|
Posted: Wed Sep 29, 2004 9:01 am Post subject: |
|
|
Lynn wrote: | I gave std.windows.registry a try, but had problems and perhaps gave up too quickly. | I didn't know if you were aware that it existed, so I thought it might be worth a shot.
Lynn wrote: | * There were conflicts between registry.d and windows.d. | That's annoying.
Lynn wrote: | * The first function I tried had an apparent compiler error, which reduced my confidence in the code: | That's definitely a bad sign. Sounds like it might be neglected code. It's probably not even compiled into phobos.lib. |
|
Back to top |
|
|
Lynn
Joined: 27 Aug 2004 Posts: 89
|
Posted: Fri Oct 01, 2004 7:36 am Post subject: |
|
|
Is it possible to revise the tutorial code? I got some info about the buffer declaration to supply to RegQueryValueExA that seems to work better.
Would that be something I provide to you for revisions?
The code shows up as posted by "Anonymous". I wonder if I wasn't logged in? |
|
Back to top |
|
|
jcc7
Joined: 22 Feb 2004 Posts: 657 Location: Muskogee, OK, USA
|
Posted: Fri Oct 01, 2004 11:19 am Post subject: |
|
|
Lynn wrote: | Is it possible to revise the tutorial code? I got some info about the buffer declaration to supply to RegQueryValueExA that seems to work better.
Would that be something I provide to you for revisions? | Sure. Just let me know what to change it to.
Lynn wrote: | The code shows up as posted by "Anonymous". I wonder if I wasn't logged in? | It could be that you weren't logged in, but it might be something wrong with the tutorial system. The PHP that makes the usernames show up is probably too clever. |
|
Back to top |
|
|
|