|
-
Feb 22nd, 2003, 07:42 PM
#1
Thread Starter
New Member
OLEAUT32.DLL Crashes For No Reason
Have problem w/ a simple ActiveX DLL. I am successfully
making calls to RegCreateKeyEx and RegEnumKeyEx, but
as I try to get the values from a given key via RegEnumValues,
the pgm GPFs in OLEAUT32.DLL. This behavior occurs using
VB5 and VB6, w/ the identical code. Here's the def for the
routine that triggers the failure:
Code:
Declare Function RegEnumStrValue Lib "advapi32.dll" _
Alias "RegEnumValueA" (ByVal hKey As Long, _
ByVal dwIndex As Long, _
ByVal lpValueName As String, _
lpcbValueName As Long, lpReserved As Long, _
lpType As Long, lpData As String, lpcbData As Long) As Long
I use RegEnumStrValue as an alias for fetching string values.
While debugging the routine that uses the API, a GPF occurs
out of the blue. Here's the offending code:
Code:
stName = String$(m_lgValNameLgt + 1, Chr(0))
lgName = Len(stName)
stData = String$(m_lgMaxValueLgt + 1, Chr(0))
lgLgt = Len(stData)
l = RegEnumStrValue(m_lgCurrKey, i, stName, _
lgName, lgNull, lgType, stData, lgLgt)
It's absolutely bizarre ! BTW, I written tons and debugged
of VB code, so that's why I'm so perplexed. I've done a
nbr of searches here and on the Web, but no joy. I have
seen and dealt w/ similar weirdies, esp w/ Access95/97/2000,
but this one has me stumped.
Any suggestions ? TIA....Jet
-
Feb 23rd, 2003, 01:30 PM
#2
It is my understanding that VB strings have to be passed using ByVal to API functions. I think you need to change lpData As String to ByVal lpData As String in the declaration or include ByVal stData in the function call.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|