Problem with API from VB6 on Vista Beta 2 August

  • Thread starter Thread starter Garry
  • Start date Start date
G

Garry

I use the following VB6 code to get a registry value.

lngValueSize = 256
gstrKeyValue = Space(lngValueSize)
lngStatus = RegQueryValueEx(lngSubkeyHandle, Trim$(strSubKey), 0,
lngValueType, ByVal gstrKeyValue, lngValueSize)

RegGetKeyValueP = ""
If lngStatus = 0 Then
If lngValueSize > 0 Then
If lngValueType = REG_SZ Then
RegGetKeyValueP = Left$(gstrKeyValue,
lngValueSize - 1)
Else
RegGetKeyValueP = Trim$(gstrKeyValue)
End If
End If
End If

The lngValueType returned is 1 which is REG_SZ but the gstrKeyValue is not
a Null Terminated string and so the value has its end lopped off. ie.
"6744553' is returned as "674455". The code works fine on WIN XP and all
previous standard versions of Windows.

Anyone know wot the problem is????

Garry
 
Hmmmm... no, don't know what the problem is... and don't know that I'd spend
an awful lot of time trying to figure out why legacy code (VB6 vs. .Net)
isn't working on a legacy BETA drop...

Lang
 
Garry said:
I use the following VB6 code to get a registry value.

lngValueSize = 256
gstrKeyValue = Space(lngValueSize)
lngStatus = RegQueryValueEx(lngSubkeyHandle, Trim$(strSubKey), 0,
lngValueType, ByVal gstrKeyValue, lngValueSize)

RegGetKeyValueP = ""
If lngStatus = 0 Then
If lngValueSize > 0 Then
If lngValueType = REG_SZ Then
RegGetKeyValueP = Left$(gstrKeyValue,
lngValueSize - 1)
Else
RegGetKeyValueP = Trim$(gstrKeyValue)
End If
End If
End If

The lngValueType returned is 1 which is REG_SZ but the gstrKeyValue is
not a Null Terminated string and so the value has its end lopped off. ie.
"6744553' is returned as "674455". The code works fine on WIN XP and all
previous standard versions of Windows.

Anyone know wot the problem is????

Garry

Garry,

I cannot comment on your code, but I would not do a lot of changes to it
until the final release of Vista. I have found my VB6 programs run
differently on each version of Vista and sometimes different between two
installs of the same beta version.

I have two small apps that run just fine on every other version of Windows,
but have reacted differently on Vista. On RC1 they will run fine from
another partition, but have problems if installed into Program Files. I
don't think Vista is going to be kind to VB6.

It is just my opinion, but I don't think Microsoft wants developers to
continue using VB6 and is not going to support it very well in any future
operating systems.

Norm
 
Dreadful. Isn't it.

Microsoft stated when it introduced the DotNET family of development
environments, that it would continue supporting VB6 for at least another 9
years.

That takes us up to 2010.

It would be a pity if they did not stand by this.

But anyway, we are talking about an API. They are going to break
compatibility for an API!!!

Sounds unbelievable.

I reinstalled my Vista using RC1 which is different BUT I haven't had time
to go thru these API registry functions with the debugger yet.

Garry.
 
Back
Top