⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frm_deviceinfo.vb

📁 以前做NOKIA手机与PC通信时所参考的源代码,里面包括两个程序,一个是手机文件夹浏览源码,另一个手机SIS安装程序.
💻 VB
📖 第 1 页 / 共 2 页
字号:
        Me.groupBoxType.TabIndex = 10
        Me.groupBoxType.TabStop = False
        Me.groupBoxType.Text = "Device Type"
        '
        'labelS80
        '
        Me.labelS80.Enabled = False
        Me.labelS80.ImageAlign = System.Drawing.ContentAlignment.MiddleRight
        Me.labelS80.Location = New System.Drawing.Point(16, 92)
        Me.labelS80.Name = "labelS80"
        Me.labelS80.Size = New System.Drawing.Size(312, 16)
        Me.labelS80.TabIndex = 4
        Me.labelS80.Text = "Series 80"
        '
        'labelS603ed
        '
        Me.labelS603ed.Enabled = False
        Me.labelS603ed.ImageAlign = System.Drawing.ContentAlignment.MiddleRight
        Me.labelS603ed.Location = New System.Drawing.Point(16, 73)
        Me.labelS603ed.Name = "labelS603ed"
        Me.labelS603ed.Size = New System.Drawing.Size(312, 16)
        Me.labelS603ed.TabIndex = 3
        Me.labelS603ed.Text = "Series 60 3rd edition"
        '
        'labelS602ed
        '
        Me.labelS602ed.Enabled = False
        Me.labelS602ed.ImageAlign = System.Drawing.ContentAlignment.MiddleRight
        Me.labelS602ed.Location = New System.Drawing.Point(16, 54)
        Me.labelS602ed.Name = "labelS602ed"
        Me.labelS602ed.Size = New System.Drawing.Size(312, 16)
        Me.labelS602ed.TabIndex = 2
        Me.labelS602ed.Text = "Series 60 2nd edition"
        '
        'labelS40
        '
        Me.labelS40.Enabled = False
        Me.labelS40.ImageAlign = System.Drawing.ContentAlignment.MiddleRight
        Me.labelS40.Location = New System.Drawing.Point(16, 35)
        Me.labelS40.Name = "labelS40"
        Me.labelS40.Size = New System.Drawing.Size(312, 16)
        Me.labelS40.TabIndex = 1
        Me.labelS40.Text = "Series 40"
        '
        'labelUnknown
        '
        Me.labelUnknown.ImageAlign = System.Drawing.ContentAlignment.MiddleRight
        Me.labelUnknown.Location = New System.Drawing.Point(16, 16)
        Me.labelUnknown.Name = "labelUnknown"
        Me.labelUnknown.Size = New System.Drawing.Size(312, 16)
        Me.labelUnknown.TabIndex = 0
        Me.labelUnknown.Text = "Unknown device"
        '
        'groupBoxFS
        '
        Me.groupBoxFS.Controls.Add(Me.labelConversion)
        Me.groupBoxFS.Controls.Add(Me.labelSIS)
        Me.groupBoxFS.Controls.Add(Me.labelJava)
        Me.groupBoxFS.Controls.Add(Me.labelFSSupport)
        Me.groupBoxFS.Location = New System.Drawing.Point(8, 131)
        Me.groupBoxFS.Name = "groupBoxFS"
        Me.groupBoxFS.Size = New System.Drawing.Size(336, 119)
        Me.groupBoxFS.TabIndex = 11
        Me.groupBoxFS.TabStop = False
        Me.groupBoxFS.Text = "File System Support"
        '
        'labelConversion
        '
        Me.labelConversion.Enabled = False
        Me.labelConversion.ImageAlign = System.Drawing.ContentAlignment.MiddleRight
        Me.labelConversion.Location = New System.Drawing.Point(16, 73)
        Me.labelConversion.Name = "labelConversion"
        Me.labelConversion.Size = New System.Drawing.Size(312, 16)
        Me.labelConversion.TabIndex = 4
        Me.labelConversion.Text = "Device supports file conversion"
        '
        'labelSIS
        '
        Me.labelSIS.Enabled = False
        Me.labelSIS.ImageAlign = System.Drawing.ContentAlignment.MiddleRight
        Me.labelSIS.Location = New System.Drawing.Point(16, 54)
        Me.labelSIS.Name = "labelSIS"
        Me.labelSIS.Size = New System.Drawing.Size(312, 16)
        Me.labelSIS.TabIndex = 3
        Me.labelSIS.Text = "Device supports SIS applications' installation"
        '
        'labelJava
        '
        Me.labelJava.Enabled = False
        Me.labelJava.ImageAlign = System.Drawing.ContentAlignment.MiddleRight
        Me.labelJava.Location = New System.Drawing.Point(16, 35)
        Me.labelJava.Name = "labelJava"
        Me.labelJava.Size = New System.Drawing.Size(312, 16)
        Me.labelJava.TabIndex = 2
        Me.labelJava.Text = "Device supports Java MIDlet installation"
        '
        'labelFSSupport
        '
        Me.labelFSSupport.ImageAlign = System.Drawing.ContentAlignment.MiddleRight
        Me.labelFSSupport.Location = New System.Drawing.Point(16, 16)
        Me.labelFSSupport.Name = "labelFSSupport"
        Me.labelFSSupport.Size = New System.Drawing.Size(312, 16)
        Me.labelFSSupport.TabIndex = 0
        '
        'FRM_DeviceInfo
        '
        Me.AcceptButton = Me.buttonClose
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.CancelButton = Me.buttonClose
        Me.ClientSize = New System.Drawing.Size(696, 288)
        Me.Controls.Add(Me.groupBoxSync)
        Me.Controls.Add(Me.buttonClose)
        Me.Controls.Add(Me.groupBoxGen)
        Me.Controls.Add(Me.groupBoxType)
        Me.Controls.Add(Me.groupBoxFS)
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
        Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
        Me.MaximizeBox = False
        Me.MinimizeBox = False
        Me.Name = "FRM_DeviceInfo"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent
        Me.Text = "Device Info"
        Me.groupBoxSync.ResumeLayout(False)
        Me.groupBoxGen.ResumeLayout(False)
        Me.groupBoxType.ResumeLayout(False)
        Me.groupBoxFS.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub

#End Region

    '===================================================================
    ' FRM_DeviceInfo_Load:
    ' Gets the device specific information from PCSAPI and
    ' sets the information on the dialog.
    '===================================================================
    Private Sub FRM_DeviceInfo_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim iRet As Integer = 0
        Dim pStructure As IntPtr = IntPtr.Zero
        ' Create a general device info struct
        Dim info As CONAPI_DEVICE_GEN_INFO = New CONAPI_DEVICE_GEN_INFO

        m_hDMHandle = MainForm.LBX_PhoneFiles.GetDMHandle()
        m_strSerial = MainForm.LBX_PhoneFiles.GetCurrentSN()
        If m_hDMHandle <> 0 Then
            ' Get general device info
            iRet = CONAGetDeviceInfo(m_hDMHandle, m_strSerial, CONAPI_DEVICE_GENERAL_INFO, pStructure)
            If iRet = CONA_OK Then
                ' Cast the pointer to CONAPI_DEVICE_GEN_INFO struct
                info = Marshal.PtrToStructure(pStructure, GetType(CONAPI_DEVICE_GEN_INFO))

                ' File system support
                If info.iFileSystemSupport = CONAPI_FS_NOT_SUPPORTED Then
                    SetLabelText(labelFSSupport, "Device does not support file system")
                ElseIf (info.iFileSystemSupport And CONAPI_FS_SUPPORTED) <> 0 Then
                    SetLabelText(labelFSSupport, "Device supports file system")
                End If
                SetLabelEnabled(labelJava, (info.iFileSystemSupport And CONAPI_FS_INSTALL_JAVA_APPLICATIONS) <> 0)
                SetLabelEnabled(labelSIS, (info.iFileSystemSupport And CONAPI_FS_INSTALL_SIS_APPLICATIONS) <> 0)
                SetLabelEnabled(labelConversion, (info.iFileSystemSupport And CONAPI_FS_FILE_CONVERSION) <> 0)

                ' Syncronization support
                If (info.iSyncSupport = CONAPI_SYNC_NOT_SUPPORTED) Then
                    SetLabelText(labelSyncSupport, "Device does not support syncronization")
                Else
                    SetLabelText(labelSyncSupport, "Device supports syncronization")
                End If
                SetLabelEnabled(labelSADS, (info.iSyncSupport And CONAPI_SYNC_SA_DS) <> 0)
                SetLabelEnabled(labelSADM, (info.iSyncSupport And CONAPI_SYNC_SA_DM) <> 0)
                SetLabelEnabled(labelCIDS, (info.iSyncSupport And CONAPI_SYNC_CI_DS) <> 0)

                ' Device type
                SetLabelEnabled(labelS40, info.iType = CONAPI_SERIES40_DEVICE)
                SetLabelEnabled(labelS602ed, info.iType = CONAPI_SERIES60_2ED_DEVICE)
                SetLabelEnabled(labelS603ed, info.iType = CONAPI_SERIES60_3ED_DEVICE)
                SetLabelEnabled(labelS80, info.iType = CONAPI_SERIES80_DEVICE)
                ' Old type, not shown any more
                'SetLabelEnabled(labelNokia7710, info.iType = CONAPI_NOKIA7710_DEVICE)
                SetLabelEnabled(labelUnknown, info.iType = CONAPI_UNKNOWN_DEVICE)

                ' General info (device type name, software version, used language)
                SetLabelText(labelName, info.pstrTypeName)
                SetLabelText(labelVersion, info.pstrSWVersion)
                SetLabelText(labelLang, info.pstrUsedLanguage)

                ' Release allocated resources
                iRet = CONAFreeDeviceInfoStructure(CONAPI_DEVICE_GENERAL_INFO, pStructure)
                If iRet <> CONA_OK Then
                    ShowErrorMessage("CONAFreeDeviceInfoStructure failed!", iRet)
                End If
            Else
                ShowErrorMessage("CONAGetDeviceInfo failed:", iRet)
            End If
        End If
    End Sub

    '===================================================================
    ' SetLabelEnabled:
    ' Sets a label enabled/disabled.
    '===================================================================
    Private Sub SetLabelEnabled(ByVal lbl As Label, ByVal val As Boolean)
        lbl.Enabled = val
    End Sub

    '===================================================================
    ' SetLabelText:
    ' Appends text to a label whether not null. Also enables/disables label.
    '===================================================================
    Private Sub SetLabelText(ByVal lbl As Label, ByVal txt As String)
        SetLabelEnabled(lbl, txt <> vbNullString)
        If txt <> vbNullString Then
            lbl.Text += txt
        End If
    End Sub

    '===================================================================
    ' buttonClose_Click:
    ' Close button has been pressed. Closes the dialog.
    '===================================================================
    Private Sub buttonClose_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles buttonClose.Click
        Me.Close()
    End Sub
End Class

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -