RegOpenKeyExW and PPC2000 ...

  • Thread starter Thread starter JustMe
  • Start date Start date
J

JustMe

Hello,

I'm using the Registry library found at www.OpenNETcf.org. It works fine on
my PocketPC 2003 device.

However, on my PocketPC 2000 device, I cannot get past the RegOpenKeyExW
function. I get the message 'Method call did not return a value'. The code
is 'exactly' the same as the PPC2003 code.

Any ideas?

--Terry
 
Give us the actual sequence of operations that you performed and point out
where it failed. When you say you got a "message", do you mean that
compilation failed or a run-time exception was thrown.

Paul T.
 
Hi Paul ...

Thank you for responding.

I'm actually using some VB.Net code found in the OpenNetCF forum. Here's
what I'm using:

Private Declare Function RegOpenKeyExW Lib "Coredll.dll" (ByVal hKey As
Int32, ByVal lpSubKey As String, ByVal ulOptions As Int32, ByVal samDesired
As Int32, ByRef phkResult As Int32) As Int32

Public Enum RootKey
HKEY_CLASSES_ROOT = &H80000000
HKEY_CURRENT_USER = &H80000001
HKEY_LOCAL_MACHINE = &H80000002
HKEY_USERS = &H80000003
End Enum

Public Shared Function OpenKey(ByVal RootKey As RootKey, ByVal SubKey As
String) As Int32
Dim hKey As Int32 = 0
Dim ret As Int32 = 0
Try
ret = RegOpenKeyExW(CType(RootKey, Int32), SubKey, 0, 0, hKey)
Catch ex As Exception
MsgBox("Exception opening key: " + ex.Message)
End Try
If ret <> 0 Then
MsgBox("Failed to open key: " + ret.ToString())
End If
Return hKey
End Function

I'm calling OpenKey using this line of code:
dim rgn as Int32
rgn = OpenKey(RootKey.HKEY_LOCAL_MACHINE, "\Software\apps\MyApp\")

I don't get any exceptions when running the OpenKey code, but when the
RegOpenKeyExW line is executed, it returns with 'Method call did not return
a value'.

Thanks for helping me out with this.
--Terry
 
I don't any problem with this on either the PPC or Windows CE.NET emulator
and I'm sure that it works on my Windows CE.NET 4.2 device. Are you sure
that you don't have multiple declarations for RegOpenKeyExW() in your code
somewhere (maybe in hidden sections?)

Paul T.
 
Hi Paul ...

This code works fine on my PocketPC 2003 device. But it fails on my
PocketPC 2000 device.

There are no duplicate declarations of RegOpenKeyExW.

Any other suggestions?

--Terry
 
Your parameter to the Open call may be incorrect. No leading \ is required
before Software. Give that a try...

Paul T.

JustMe said:
Oh yes ...

There is also definitely a \Software\apps\MyApp\ key in the registry.

Tery

JustMe said:
Hi Paul ...

This code works fine on my PocketPC 2003 device. But it fails on my
PocketPC 2000 device.

There are no duplicate declarations of RegOpenKeyExW.

Any other suggestions?

--Terry
SubKey
As
String) As Int32
Dim hKey As Int32 = 0
Dim ret As Int32 = 0
Try
ret = RegOpenKeyExW(CType(RootKey, Int32), SubKey, 0, 0, hKey)
Catch ex As Exception
MsgBox("Exception opening key: " + ex.Message)
End Try
If ret <> 0 Then
MsgBox("Failed to open key: " + ret.ToString())
End If
Return hKey
End Function

I'm calling OpenKey using this line of code:
dim rgn as Int32
rgn = OpenKey(RootKey.HKEY_LOCAL_MACHINE, "\Software\apps\MyApp\")

I don't get any exceptions when running the OpenKey code, but when the
RegOpenKeyExW line is executed, it returns with 'Method call did not
return
a value'.

Thanks for helping me out with this.
--Terry

message Also, double-check that you're using the latest OpenNetCF code...

Paul T.

"Paul G. Tobey [eMVP]" <ptobey_no_spam@instrument_no_spam.com>
wrote
in
message Give us the actual sequence of operations that you performed and point
out
where it failed. When you say you got a "message", do you mean that
compilation failed or a run-time exception was thrown.

Paul T.

Hello,

I'm using the Registry library found at www.OpenNETcf.org. It works
fine
on
my PocketPC 2003 device.

However, on my PocketPC 2000 device, I cannot get past the
RegOpenKeyExW
function. I get the message 'Method call did not return a value'.
The
code
is 'exactly' the same as the PPC2003 code.

Any ideas?

--Terry
 
Hmmm ... I'd already tried that. No luck.

ANy other ideas?
--Terry

Paul G. Tobey said:
Your parameter to the Open call may be incorrect. No leading \ is required
before Software. Give that a try...

Paul T.

JustMe said:
Oh yes ...

There is also definitely a \Software\apps\MyApp\ key in the registry.

Tery

JustMe said:
Hi Paul ...

This code works fine on my PocketPC 2003 device. But it fails on my
PocketPC 2000 device.

There are no duplicate declarations of RegOpenKeyExW.

Any other suggestions?

--Terry

message I don't any problem with this on either the PPC or Windows CE.NET emulator
and I'm sure that it works on my Windows CE.NET 4.2 device. Are you sure
that you don't have multiple declarations for RegOpenKeyExW() in
your
code
somewhere (maybe in hidden sections?)

Paul T.

Hi Paul ...

Thank you for responding.

I'm actually using some VB.Net code found in the OpenNetCF forum.
Here's
what I'm using:

Private Declare Function RegOpenKeyExW Lib "Coredll.dll" (ByVal
hKey
As
Int32, ByVal lpSubKey As String, ByVal ulOptions As Int32, ByVal
samDesired
As Int32, ByRef phkResult As Int32) As Int32

Public Enum RootKey
HKEY_CLASSES_ROOT = &H80000000
HKEY_CURRENT_USER = &H80000001
HKEY_LOCAL_MACHINE = &H80000002
HKEY_USERS = &H80000003
End Enum

Public Shared Function OpenKey(ByVal RootKey As RootKey, ByVal
SubKey
As
String) As Int32
Dim hKey As Int32 = 0
Dim ret As Int32 = 0
Try
ret = RegOpenKeyExW(CType(RootKey, Int32), SubKey, 0, 0, hKey)
Catch ex As Exception
MsgBox("Exception opening key: " + ex.Message)
End Try
If ret <> 0 Then
MsgBox("Failed to open key: " + ret.ToString())
End If
Return hKey
End Function

I'm calling OpenKey using this line of code:
dim rgn as Int32
rgn = OpenKey(RootKey.HKEY_LOCAL_MACHINE, "\Software\apps\MyApp\")

I don't get any exceptions when running the OpenKey code, but when the
RegOpenKeyExW line is executed, it returns with 'Method call did not
return
a value'.

Thanks for helping me out with this.
--Terry

"Paul G. Tobey [eMVP]" <ptobey_no_spam@instrument_no_spam.com>
wrote
in
message Also, double-check that you're using the latest OpenNetCF code...

Paul T.

in
message Give us the actual sequence of operations that you performed and
point
out
where it failed. When you say you got a "message", do you
mean
that
compilation failed or a run-time exception was thrown.

Paul T.

Hello,

I'm using the Registry library found at www.OpenNETcf.org. It
works
fine
on
my PocketPC 2003 device.

However, on my PocketPC 2000 device, I cannot get past the
RegOpenKeyExW
function. I get the message 'Method call did not return a value'.
The
code
is 'exactly' the same as the PPC2003 code.

Any ideas?

--Terry
 
Try the actual Registry class rather than the code posted in the Forums. We
don't check or test the Forum posted code in any way.
 
Back
Top