Results 1 to 3 of 3
  1. #1
    5 Star Lounger jujuraf's Avatar
    Join Date
    Jun 2001
    Location
    San Jose, California, USA
    Posts
    1,061
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Bad DLL calling convention (Excel 2002)

    Hi all,
    I have code that searches the registry for a given key and it's worked fine for the past many months. I got this code from the Lounge, thank you very much <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>. I just ran it now in Excel2002 and it fails with "Bad DLL Calling Convention." The registry entry I want is definitely at the desired location and it contains the desired string so I don' t know why it fails. Here's the code (with edits to hide the name of my employer)
    <pre>Public Function IsOrg(Optional noArgs As Boolean = True) As Boolean
    Dim dat As Variant
    Dim RootKey As String, Path As String, RegEntry As String

    On Error GoTo noFind

    IsOrg= False
    RootKey = "HKEY_LOCAL_MACHINE"
    Path = "SoftwareMicrosoftWindows NTCurrentVersion"
    RegEntry = "RegisteredOrganization"
    dat = GetRegistry(RootKey, Path, RegEntry)
    If InStr(1, dat, "MyCompanyName") Then IsOrg= True

    noFind:
    ' Err.Clear ' removed for debug
    ' On Error GoTo 0
    End Function</pre>

    Any ideas why this fails now? <img src=/S/yikes.gif border=0 alt=yikes width=15 height=15> I pretty sure it used to work in Excel 2002 (I also use Excel97 and Excel 2000). I'm running this for the first time on a new IBM laptop that I just got as my new computer.

    Deb

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Bad DLL calling convention (Excel 2002)

    What is the definition (code) of GetRegistry?

  3. #3
    5 Star Lounger jujuraf's Avatar
    Join Date
    Jun 2001
    Location
    San Jose, California, USA
    Posts
    1,061
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Bad DLL calling convention (Excel 2002)

    I checked the declarations and guess what??? They got messed up when I copy/pasted the code. <img src=/S/bash.gif border=0 alt=bash width=35 height=39> <img src=/S/bummer.gif border=0 alt=bummer width=15 height=15> Rats!!

    What happened was that I had imported this module (where all my registry code sits) into a new project. I then immediately commented it all out (via the edit tool bar in the IDE) so I could work on something else. Later I came back and uncommented it all and this caused the declarations to get messed up (an extra "()" was added because of how the line continuation character was placed). I never noticed this as I was working at the end of the module.

    Thanks for the kick in the butt to get me to look at the declarations. <img src=/S/stupidme.gif border=0 alt=stupidme width=30 height=30>

    Ok.... back to solving real problems.

    Deb

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •