'把lpdata as any 改成 lpdata as string ,如下:
Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As String, ByVal cbData As Long) As Long
'定义常数:
Private Const REG_SZ=1
'这句很重要,如果没这句,就会变成REG_NONE类型
'然后这样传:
ret = RegSetValueEx(lResult, "NoDriveTypeAutoRun", 0, REG_SZ, "95", Len(lData))
'我没去调试了,你先试试这样吧