GHRH,你太伟大了,我爱死你了,哈哈哈哈!
根据你的提示,把函数定义处改回:
Private Sub CreateNewKey(LPredefinedKey As Long, sNewKeyName As String, aaa As String)
然后在调用写入注册表值时,改成了:
lRetVal = RegSetValueEx(hNewkey, sNewKeyName, 0, REG_SZ,ByVal aaa,CLng(Len(aaa)))
试运行,OK!能正确显示123了!又学到东西啦!哈哈!