I hate to admit it, but the problem was a bonehead error on my part. In the
declare below... I had Lib set to "Kernal" not "Kernel"... Ack! Pft! The
moral... when all else fails, it's still a good idea to print out your code
and let someone else look at it. My wife asked me (looking over my
shoulder), why I spelled kernel two different ways...

Somebody punch a hole in my Mensa card... I need a retest.

Private lpRegOpenKeyExA As Long
Private Declare Function RegOpenKeyExA Lib "Kernel" _
Alias "CallProc32W" ( _
ByVal hKey As Long, ByVal lpSubKey As String, _
ByVal ulOptions As Long, ByVal samDesired As Long, _
ByRef phkResult As Long, _
ByVal lpfnFunction As Long, _
ByVal fAddressConvert As Long, _
ByVal dwParams As Long) _
As Long
Private Const THUNK_OPEN_MASK As Long = 15&
'01111 (1=byval or string, 0=byref)
'This is passed to fAddressConvert.
Private Const THUNK_OPEN_COUNT As Long = 5&
'Number of arguments
'This is passed to dwParams
Dan Rhea - Mailto:danr@sirs.com
Windows CD-ROM Programmer
SIRS Mandarin, Inc.
(561) 994-0079 x757
"Dan Rhea" <danr@sirs.com> wrote in message news:39ec7d4a$1@news.devx.com...
> Greetings all,
> Some background... I have an AutoRun program I use on my distribution CDs
> that is written in VB4 16-bit (to keep from getting into dependency and
> registration issues). The program is working just fine.
> Unfortunately I have had a few customers complain about the AutoRun

> launching every time they put one of my CDs in their drive.
> To get around this, I had my setup program set/create a key with a

> value.
> HKEY_LOCAL_MACHINE\Software\SIRS Products\Researcher
> Install Version = "WINTER2000RES"
> In my AutoRun program I'm using general thunking commands to call
> RegOpenKeyEx (with CallProc32W).
> When I run this I get the runtime error 53 (File not found).
> The same code in VB6 (without the thunking of course), opens properly, and
> returns my key value after a RegQueryValueEx.
> Is it possible that since I am running from a 16-bit program, that the
> RegOpenKeyEx API call is looking for the registry in the wrong place and

> error 53 is valid?
> If so, is there some way I can tell the registry API calls where the
> registry actually is or am I just out of luck trying to thunk these
> particular API routines?
> Here is the statement that gets the error...
> m_lErrorIs = RegOpenKeyExA(m_lKeyIs, m_sSubKeyIs, 0&, _
> KEY_QUERY_VALUE, lKeyHand, _
> lpRegOpenKeyExA, _
> -RegOpenKeyExA is an alias of CallProc32W.
> -m_lKeyIs is HKEY_LOCAL_MACHINE (&H80000002)
> -m_sSubKeyIs is "Software\SIRS Products\Researcher" & vbNullString
> -lKeyHand is 0&
> -lpRegOpenKeyExA is an address from GetProcAddress32W of RegOpenKeyExA
> If you would like to see more details, I posted a message about this
> yesterday with a lot of code snippets in it.
> Any help would be appreciated since I am rapidly coming up on my release
> deadline.
> Thanks...
> ___________________________
> Dan Rhea - Mailto:danr@sirs.com
> Windows CD-ROM Programmer
> SIRS Mandarin, Inc.
> (561) 994-0079 x757