注册 登录
编程论坛 VB.NET论坛

有問題求教

shankhands 发布于 2008-10-17 14:56, 1468 次点击
我用的是,想用如下代碼實現獲得本地计算机上的拨号网络的项目

    Public Class Form1
    Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" ( _
    ByVal bKey As Integer, ByVal lpSubKey As String, ByRef phkResult As Integer) As Integer
    Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Integer) As Integer
    Private Declare Function RegEnumKey Lib "advapi32.dll" Alias _
    "RegEnumKeyA" (ByVal hKey As Integer, ByVal dwIndex As Integer, ByVal _
    lpName As String, ByVal chName As Integer) As Integer
    Const HKEY_CURRENT_USER As Integer = &H80000001
    Const ERROR_NO_MORE_ITEMS As Short = 259
    Const ERROR_SUCCESS As Short = 0
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim hKey As Integer
        Dim i As Integer
        'Dim astr As VBFixedStringAttribute
        Dim astr As VB6.fixedLengthString = New VB6.fixedLengthstring(256)
        If RegOpenKey(HKEY_CURRENT_USER, "RemoteAccess\Profile", hKey) = ERROR_SUCCESS Then
            While RegEnumKey(hKey, i, astr.value, 256) = ERROR_SUCCESS
                ListBox1.Items.Add(astr.value)
            End While
            RegCloseKey(hKey)
        Else
            ListBox1.Items.Add("There is some wrong") '此語句是用來說明沒有執行
        End If

    End Sub
End Class
出現的錯誤是:    未定义类型“VB6.fixedLengthString”。
請問這是怎麼回事.
在此先謝謝了!
3 回复
#2
fairy42008-10-17 15:42
你从那里找了段VB6的代码升级的?添加这个组件吧
 Microsoft.
再Imports Microsoft.
#3
shankhands2008-10-17 17:56
謝謝fairy4幫助!
#4
bygg2008-10-17 20:15
未定义类型“VB6.fixedLengthString”。这样的错误,要么是缺少引用,要么是缺少添加组件...
1