在win98中通过,但是在win2000 中报错:
"0x796d347b"指令引用的"0x000000000"内存。该内存不能为"read"。----------------------------
Private Const HKEY_CURRENT_USER As Long = &H80000001
Private Const REG_SZ = 1
Private Declare Function RegCreateKey ......
Private Declare Function RegSetValueEx ......
Private Declare Function RegCloseKey ......
Private Declare Function RegOpenKey ......RegCreateKey HKEY_CURRENT_USER, "Software\Getnews", hKey
RegSetValueEx hKey, "user", 0, REG_SZ, ByVal str2, Len(str2) + 1 <<=====这里
RegSetValueEx hKey, "test", 0, REG_SZ, ByVal str1, Len(str1) + 1
RegCloseKey (hKey)
Unload Me如何解决???
"0x796d347b"指令引用的"0x000000000"内存。该内存不能为"read"。----------------------------
Private Const HKEY_CURRENT_USER As Long = &H80000001
Private Const REG_SZ = 1
Private Declare Function RegCreateKey ......
Private Declare Function RegSetValueEx ......
Private Declare Function RegCloseKey ......
Private Declare Function RegOpenKey ......RegCreateKey HKEY_CURRENT_USER, "Software\Getnews", hKey
RegSetValueEx hKey, "user", 0, REG_SZ, ByVal str2, Len(str2) + 1 <<=====这里
RegSetValueEx hKey, "test", 0, REG_SZ, ByVal str1, Len(str1) + 1
RegCloseKey (hKey)
Unload Me如何解决???
解决方案 »
- 请问通过PC连接手机群发短信的原理和代码
- 关于VB中菜单的问题:选择菜单中某一项,而其他菜单均无法选择,仅关闭当前窗体后才能使用菜单
- vsflexgrid中如何使用checkbox
- 高手请进,好象是ACTIVEX问题,分不够可加!
- 我们老师让学的,我不会
- VB中对SQL SERVER数据库的备份
- 在VB+Access中怎么用SQL的Union对多少表的连结!!!
- 我在前台的程序中对text1.text=rs!number,为何text1.text的值还是空值,想不通???
- 有没有经过封装的菜单类?比如加上图标,改变字体,改变颜色等等?
- COM+的安全漏洞吗?
- 关于在vb中控制EXCEL的问题
- 请问如何得到文本框右健菜单的句柄
LenB(StrConv(str2, vbFromUnicode))取得也可用API
lstrlen(str2)
RegSetValueEx hKey, "test", 0, REG_SZ, ByVal str1, Len(str1) + 1
-----------------------------------
多了个ByVal关键字呀,去掉吧……
RegSetValueEx hKey, "user", 0, REG_SZ, str2, Len(str2) + 1 '<<=====这里
RegSetValueEx hKey, "test", 0, REG_SZ, str1, Len(str1) + 1
RegSetValueEx hKey, "user", 0, REG_SZ, ByVal str2, Len(str2) + 1应该改为
RegSetValueEx hKey, "user", 0, REG_SZ, ByVal str2, Len(str2)另外要确保str2不能为空
请参考以下微软的例子:
***********************************************
' Determine data type and use appropriate
' passed value.
' ***********************************************
Select Case pDatatype
Case REG_DWORD
MyKeyValueLng = ValueToAdd
lResult = RegSetValueEx(phkResult, KeyToAdd, _
ByVal 0&, pDatatype, _
MyKeyValueLng, Len(MyKeyValueLng))
Case REG_SZ
MyKeyValueStr = ValueToAdd
lResult = RegSetValueEx(phkResult, KeyToAdd, _
ByVal 0&, pDatatype, _
ByVal MyKeyValueStr, Len(MyKeyValueStr))
End Select