zoukankan      html  css  js  c++  java
  • Showing progress bar with class

    With this code, you can show the progress of a long lasting work.


    Declare Public Function NEMProgressBegin Lib "nnotesws.dll" (Byval 
    wFlags As Integer) As Long
    Declare Public Sub NEMProgressSetBarRange Lib "nnotesws.dll" (Byval 
    hWnd As Long,Byval dwMax As Long)
    Declare Public Sub NEMProgressDeltaPos Lib "nnotesws.dll" (Byval 
    hWnd As Long,Byval dwIncrement As Long)
    Declare Public Sub NEMProgressSetBarPos Lib "nnotesws.dll" (Byval 
    hWnd As Long,Byval dwPos As Long)
    Declare Public Sub NEMProgressSetText Lib "nnotesws.dll" (Byval 
    hWnd As Long,Byval pcszLine1 As String)
    Declare Public Sub NEMProgressEnd Lib "nnotesws.dll" (Byval hWnd As
     Long)
    
    Public Class CProgressBar
    	
    	Private hWnd As Long
    	
    	Property Set Range As Long
    		NEMProgressSetBarRange hWnd,Range
    	End Property
    	
    	Property Set Delta As Long
    		NEMProgressDeltaPos hWnd, Delta
    	End Property
    	
    	Property Set Pos As Long
    		NEMProgressDeltaPos hWnd, Me.Pos	
    	End Property
    	
    	Property Set Text As String
    		NEMProgressSetText hWnd,Text
    	End Property
    	
    	Property Set Progress (Pos As Long) As String
    		Me.Pos = Pos
    		Text = Progress
    	End Property
    	
    	Property Set ProgressBy (Delta As Long) As String
    		Me.Delta = Delta
    		Text = ProgressBy
    	End Property
    	
    	Private Sub Init
    		Range = 100
    		Delta = 1
    		Text = ""
    		Pos = 0
    	End Sub
    	
    	Sub New (Range As Long)
    		hWnd = NEMProgressBegin (2)
    		Init
    		If Range <> 0 Then Me.Range = Range
    	End Sub
    	
    	Sub Delay (Seconds  As Integer)
    Dim Started
    Started = Now
    While (Now - Started) * 24 * 60 * 60 < Seconds
    'Do nothing
    Wend
    End Sub

    Sub Delete
    NEMProgressEnd hWnd
    End Sub

    End Class

    '******************************
    'Calling function**************
    'Variable de barra de progreso******************************************************
    Dim oBarraProgreso As CProgressBar
    lNoDocsRespaldo = colDocsAMover.count
    Set oBarraProgreso = New CProgressBar( colDocsAMover.count)
    For x = 1 To colDocsAMover.Count
    Set doc =  colDocsAMover.GetNthDocument(x)
    Call doc.CopyToDatabase(ndbBaseRespaldo)
    Call doc.Remove(True)
    oBarraProgreso.Text = "Faltan " & Cstr(lNoDocsRespaldo -x) & " documentos de " & Cstr(lNoDocsRespaldo) & " por respaldar"
    oBarraProgreso.Pos = x
    Next x
  • 相关阅读:
    学习笔记26_MVC前台强类型参数
    Elasticsearch 和 solr 的区别
    Mysq索引优化(什么情况创建索引,什么情况不创建索引)
    Spring支持的常用数据库传播属性和事务隔离级别
    方法的参数传递机制
    JAVA类初始化和实例初始化
    JAVA设计模式
    CentOS 7 下安装 Nginx 服务,并开机自启动
    JAVA发送xml格式的接口请求
    JAVA接收postman的中raw的参数
  • 原文地址:https://www.cnblogs.com/hannover/p/2481337.html
Copyright © 2011-2022 走看看