Results 1 to 2 of 2

Thread: (RESOLVED) Registry problem (simple)

Threaded View

  1. #1

    Thread Starter
    Bouncy Member darre1's Avatar
    Join Date
    May 2001
    Location
    Peterborough, UK
    Posts
    3,828

    (RESOLVED) Registry problem (simple)

    ok, i've done this plenty of times before, but i'm currently having a brain hemerage and can't figure it out.
    VB Code:
    1. Private Sub Form_Activate()
    2.     Dim lngHKey As Long
    3.     Dim strData As String
    4.     Dim lngLenData As Long
    5.        
    6.     If RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows\CurrentVersion", _
    7.         0, KEY_ALL_ACCESS, lngHKey) Then
    8.         MsgBox "Couldn't open key!", vbCritical, "Error"
    9.         Unload Me
    10.     End If
    11.    
    12.     If RegQueryValueEx(lngHKey, "ProductKey", 0, REG_SZ, strData, 29) Then
    13.         MsgBox "Couldn't retrieve Windows 98 product key!", vbCritical, "Error!"
    14.         RegCloseKey lngHKey
    15.         Unload Me
    16.     End If
    17.     RegCloseKey lngHKey
    18.    
    19.     lblProductKey.Caption = strData
    20. End Sub
    strData is returning ""....

    cheers guys

    darrel.
    Last edited by darre1; Feb 22nd, 2002 at 06:22 AM.
    Confucious say, "Man standing naked in biscuit barrel not necessarily ****ing crackers."

    Don't forget to format your code in your posts

Posting Permissions

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



Click Here to Expand Forum to Full Width