Showing Windows Progress Bar

王朝system·作者佚名  2006-01-09
窄屏简体版  字體: |||超大  

If you're clients are all on Windows, you can display the progress bar when performing a long calculation. There are two types of progress bars -- one large graphical (like when you're copying a database) and one through the status bar at the bottom of the screen (like when you open a very large document over a dial-up connection).

For an example of the large graphical progress bar, build an agent with this code:

Const NPB_TWOLINE% = 1

Declare Function NEMProgressBegin Lib "nnotesws.dll" ( Byval wFlags As Integer ) As Long

Declare Sub NEMProgressEnd Lib "nnotesws.dll" ( Byval hwnd As Long )

Declare Sub NEMProgressSetBarPos Lib "nnotesws.dll" ( Byval hwnd As Long, Byval dwPos As Long)

Declare Sub NEMProgressSetBarRange Lib "nnotesws.dll" ( Byval hwnd As Long, Byval dwMax As Long )

Declare Sub NEMProgressSetText Lib "nnotesws.dll" ( Byval hwnd As Long, Byval pcszLine1 As String, Byval pcszLine2 As String )

Sub Initialize

Dim hwnd As Long

Dim i As Long

Dim j As Long

hwnd = NEMProgressBegin( NPB_TWOLINE )

' Set the bar range - the default is 100

NEMProgressSetBarRange hwnd, 200

' Display text on the dialog.

NemProgressSetText hwnd, "Calculating ...", "Start"

For i = 0 To 200

For j = 0 To 9000

' artificial delay for the example !!

Next j

' Update the bar position

NEMProgressSetBarPos hwnd, i

' Update the text at twenty five percent

If i = 50 Then

NEMProgressSetText hwnd, "Calculating ....", "25%"

End If

' Update the text at fifty percent

If i = 100 Then

NEMProgressSetText hwnd, "Calculating .....", "50 %"

End If

' Update the text at seventy five percent

If i = 150 Then

NEMProgressSetText hwnd, "Calculating ......", "75 %"

End If

Next

' Destroy the dialog when we're done

NEMProgressEnd hwnd

End Sub

Run the agent and you will see the status bar.

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航