📄 fileoperationlistener.vb
字号:
'Filename : FileOperationListener.vb
'Part of : Phone Navigator
'Description : Implementation of phone navigators file operation listener
'Version : 3.2
'
'This example is only to be used with PC Connectivity API version 3.2.
'Compability ("as is") with future versions is not quaranteed.
'
'Copyright (c) 2005-2007 Nokia Corporation.
'
'This material, including but not limited to documentation and any related
'computer programs, is protected by intellectual property rights of Nokia
'Corporation and/or its licensors.
'All rights are reserved. Reproducing, modifying, translating, or
'distributing any or all of this material requires the prior written consent
'of Nokia Corporation. Nokia Corporation retains the right to make changes
'to this material at any time without notice. A copyright license is hereby
'granted to download and print a copy of this material for personal use only.
'No other license to any other intellectual property rights is granted. The
'material is provided "as is" without warranty of any kind, either express or
'implied, including without limitation, any warranty of non-infringement,
'merchantability and fitness for a particular purpose. In no event shall
'Nokia Corporation be liable for any direct, indirect, special, incidental,
'or consequential loss or damages, including but not limited to, lost profits
'or revenue,loss of use, cost of substitute program, or loss of data or
'equipment arising out of the use or inability to use the material, even if
'Nokia Corporation has been advised of the likelihood of such damages occurring.
Imports System.Runtime.InteropServices
'===================================================================
' FileOperationListener
Public Class FileOperationListener
Private m_hFS As Integer
Private pFSCallBack As FSNotifyCallbackDelegate
'===================================================================
' StartListening
'
' Start listening file operation notifications
'===================================================================
Public Sub StartListening(ByVal hwndParent As IntPtr, ByVal hFS As Integer, ByVal title As String, ByVal line1 As String, ByVal line2 As String)
m_hFS = hFS
' Register file system notification callback function
pFSCallBack = AddressOf FSNotifyCallback
Dim iResult As Integer = CONARegisterFSNotifyCallback(m_hFS, API_REGISTER, pFSCallBack)
If iResult <> CONA_OK Then ShowErrorMessage("FileOperationListener::StartListening(): CONARegisterFSNotifyCallback", iResult)
MainForm.LBX_PhoneFiles.ResetContent()
MainForm.StartProgress(title, line1, line2)
End Sub
'===================================================================
' FSNotifyCallback
'
' Call back function for file operation notifications
'===================================================================
Public Function FSNotifyCallback(ByVal iOperation As Integer, ByVal iStatus As Integer, ByVal iTransferredBytes As Integer, ByVal iAllBytes As Integer) As Integer
FSNotifyCallback = CONA_OK
MainForm.SetProgress(iStatus)
If MainForm.IsCancelled Then
FSNotifyCallback = ECONA_CANCELLED
End If
End Function
'===================================================================
' StopListening
'
' Stop listening file operation notifications
'===================================================================
Public Sub StopListening()
' Unregister file system notification callback function
Dim iResult As Integer = CONARegisterFSNotifyCallback(m_hFS, API_UNREGISTER, pFSCallBack)
If iResult <> CONA_OK Then ShowErrorMessage("FileOperationListener::StopListening(): CONARegisterFSNotifyCallback", iResult)
MainForm.StopProgress()
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -