Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > Progress Bar


Reply
 
Thread Tools Display Modes
  #1  
Old 04-27-2002, 07:34 PM
chris00's Avatar
chris00 chris00 is offline
 
Join Date: Mar 2002
Location: Ohio, USA
Posts: 1,552
Unhappy Progress Bar


The Program I am working on lets user COPY, CUT, PASTE, DELETE, etc. When moving a File I am trying to display a ProgressBar showing the amount left to move. I know so far how to get the File Size but not much more.

This is what I am trying to do
ex.
FilesSize = 546546
AmountLeft = 4367
ProgressBar1 = 10


Thanks

Chris
Reply With Quote
  #2  
Old 04-27-2002, 07:36 PM
Bruce Fox
Guest
 
Posts: n/a
Default

Are u using FSO?
Reply With Quote
  #3  
Old 04-27-2002, 07:44 PM
chris00's Avatar
chris00 chris00 is offline
 
Join Date: Mar 2002
Location: Ohio, USA
Posts: 1,552
Default

I am not using SFO. Becouse I'm not very familiar with it.
Do you thing I should do it using SFO ?


Chris
Reply With Quote
  #4  
Old 04-27-2002, 07:46 PM
Bruce Fox
Guest
 
Posts: n/a
Default

I was just curious cause if u were using FSO, there
is probably no way u can use a 'Progress Bar' once
the (FSO)File transfer takes place.
Reply With Quote
  #5  
Old 04-28-2002, 01:18 AM
Flyguy's Avatar
Flyguy Flyguy is offline
Lost Soul

Super Moderator
* Guru *
 
Join Date: May 2001
Location: Vorlon
Posts: 18,931
Default

If you want a progress bar file copying or moving a file you have to write to copy/move code yourself.
Most (API) functions just do a copy.
Reply With Quote
  #6  
Old 04-28-2002, 05:58 AM
Squirm's Avatar
Squirm Squirm is offline
Political Coder

Retired Moderator
* Guru *
 
Join Date: Mar 2001
Location: London, England
Posts: 8,037
Default

SHFileOperation API can copy a file and provides a neat documents-flying-thru-space animation and progressbar while it copies.

Code:
Option Explicit

Private Type SHFILEOPSTRUCT
    hWnd As Long
    wFunc As Long
    pFrom As String
    pTo As String
    fFlags As Integer
    fAborted As Boolean
    hNameMaps As Long
    sProgress As String
End Type

Private Declare Function SHFileOperation Lib "shell32.dll" Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long
Private Const FO_COPY = &H2
Private Const FO_MOVE = &H1

Private Sub Form_Load()
    Dim SHOperation As SHFILEOPSTRUCT
    
    'Set up the structure
    With SHOperation
        .wFunc = FO_COPY
        .pFrom = "C:\ur_demo.exe"
        .pTo = "C:\ur_demo_2.exe"
    End With
    
    'Copy the file
    SHFileOperation SHOperation
End Sub
__________________
Search the forums | Use [vb][/vb] tags | Still IRCing
Reply With Quote
  #7  
Old 04-28-2002, 11:25 AM
chris00's Avatar
chris00 chris00 is offline
 
Join Date: Mar 2002
Location: Ohio, USA
Posts: 1,552
Talking

Thanks Squirm

I can copy the file but how do I set up the animation ?


Chris S.
Reply With Quote
  #8  
Old 04-28-2002, 11:31 AM
Squirm's Avatar
Squirm Squirm is offline
Political Coder

Retired Moderator
* Guru *
 
Join Date: Mar 2001
Location: London, England
Posts: 8,037
Default

It does it automatically. If you're copying a small file then it happens too fast to see. Copying a 13Mb file took about 3 seconds.
__________________
Search the forums | Use [vb][/vb] tags | Still IRCing
Reply With Quote
  #9  
Old 04-28-2002, 11:45 AM
chris00's Avatar
chris00 chris00 is offline
 
Join Date: Mar 2002
Location: Ohio, USA
Posts: 1,552
Talking OK

Thanks Squirm

I copied a large file and it works.


Chris
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->