English
Forum

Done: BlockRead / Umrechnung Filesize

 

DeHarrow
Hello on any!
To my trouble: have different Files, The I with BlockRead/write copy would like - still not: @BlockRead(File$, Ber#, 0, FileSize(File$)), separate for may part with 1024 byte(point).

sense should his: have a wallpaper.pcu of, The whom status the Kopierens Show should. would be stupid, if then Ruckzuck 100% showing instead of for may part 10%, 15% copies etc.

If I The Filegröße through 1024 pieces, then I get Nachkommastellen, The unregarded go - The File unvollständig copies. round up on whole number without Kommastelle brought too nothing.

white someone How I it best employ/converting could. with small Files works it Yes with the worth 1024, but with large Files ex MB even not. hope you know I my.

Greeting Jürgen
 
Angefangen hat alles mit Profan 5.0 ...noch auf Diskette
09/02/09  
 



shark, first of all could BlockWrite so many byte write, as function BlockRead as gelesene Bytes returns. The Puffergrösse depends of Zielmedium ex of/on the The File loaded/written becomes - 1024byte appear me with normalen Festplatten and present OSsses as explicit To lowly. i'd vlt. with of/ one Puffergrösse of 256KB herantesten - power Yes none sense The CPU More To bait as necessary because disk+cache+OS the "eh" over again managen.
 
09/02/09  
 




DeHarrow
Hello IF - thanks first for your response.
The problem: I must a worth without comma rausbekommen.

have z.B. a File of 1079214 Bytes or 1.02 MB. If I this worth complete into memory read and write, then is the Fortschrittsbalken even same with 100%.
OK Statusbalken adjust would no Topic or so...
...would like hold only smaller ones steps in the Statusbalken Show let (for may part 10%, 20%, 30% copies etc.)
Dividiere I then through something z.B. FileSize(File$) / 1024 (or even larger) circa another Bytezahl To get, then have I Nachkommastellen and it works then even not Block Write.

I should sozusagen for different Dateigrößen in the area Bytes, KB, MB etc. a verlässlichen worth having.

Greeting Jürgen
 
Angefangen hat alles mit Profan 5.0 ...noch auf Diskette
09/02/09  
 




Nico
Madysa
take we at times, You habest a File of 2049 kilobytes, only as example.
You could still ganzzahlig through 1024 share and this copy. The Prozentanzeige get You then to 100 * GeleseneBytes% / FileSize(File$). After the Loop, The the power, ermittelst You with Modulo simply The verbleibenden Bytes and copy these too. The Prozente must thereafter not any more just go, it yield itself Yes 100%.
CompileMarkSeparation
whileloop 0,dateigroesse%,1024*1024

    BlockRead(blubber)
    BlockWrite(blabber)
    prozent% = 100 * &loop / dateigroesse%

EndWhile

rest% = dateigroesse% mod (1024 * 1024)
BlockRead(datei$,bereich#,dateigroesse% - rest%,rest%)
BlockWrite(dito)
prozent% = /span>
 
Nico Madysa
09/02/09  
 



Perhaps. means it something like: [...] 

(once more korrigiert)
CompileMarkSeparation
CLS
MYFCOPY("csa.debug","map33.bmp")
WAITINPUT

proc MYFCOPY

    PARAMETERS _FROM$,_TO$

    IFNOT FILEEXISTS(_FROM$)

        RETURN 0

    ENDIF

    IF FILEEXISTS(_TO$)

        ERASE _TO$

        IF FILEEXISTS(_TO$)

            RETURN 0

        ENDIF

    ENDIF

    var SZ!=FILESIZE(_FROM$)

    IF SZ!<20

        COPY _FROM$,_TO$
        RETURN 1

    ENDIF

    var FHFROM%=ASSIGN(_FROM$)
    var FHTO%=ASSIGN(_TO$)

    IFNOT FHFROM% AND FHTO%

        case FHFROM% : ASSIGN FHFROM%,""
        case FHTO% : ASSIGN FHTO%,""
        RETURN 0

    ENDIF

    OPENRW FHFROM%
    OPENRW FHTO%
    var LSZ&=INT(RANGE(SZ!*0.05,20,2048))
    var RD&=0
    var ACC&=0
    DECLARE MYBUFF#
    DIM MYBUFF#,LSZ&

    WHILENOT EOF(FHFROM%)

        RD&=BLOCKREAD(FHFROM%,MYBUFF#,0,LSZ&)

        IFNOT RD&

            BREAK

        ENDIF

        INC ACC&,RD&
        BLOCKWRITE FHTO%,MYBUFF#,0,RD&
        RECTANGLE 0,0 - (ACC&/SZ!*100),10

    ENDWHILE

    DISPOSE MYBUFF#
    ASSIGN FHFROM%,""
    ASSIGN FHTO%,""
    RETURN FILEEXISTS(_TO$)

ss=s4 href='./../../Function-References/XProfan/endproc/'>endproc
(deference code only hingeschmiert, absolutely on Error checken)
 
09/02/09  
 




DeHarrow
Hello!

thanks for Answer!
sees on the first look pointed from - will be it time try - best Thanks!

Greeting Jürgen
 
Angefangen hat alles mit Profan 5.0 ...noch auf Diskette
09/02/09  
 



^^
 
09/02/09  
 




Andreas
Miethe


to the Topic heard Perhaps too the system-dialog, the a progress at copy or irgendwelchen Berechnungen indicating. Hierbei becomes one Fortschrittsbalken and a Restdauer( The Windwos automatically accounts) displayed.
CompileMarkSeparation
 $H Windows.ph
Var ole& = ImportDll("ole32.dll","")
Var oleaut& = ImportDll("oleaut32.dll","")
Declare bString1$

Proc Ansi2Uni

    Parameters s$
    Var Unicode$ = Space$((Len(S$)*2)+1)
    ~MultiByteToWideChar(0,0,Addr(S$),-1,Addr(Unicode$),Len(Unicode$))
    SysFreeString(bString1$)
    SysFreeString(bString1$)
    bString1$ = SysAllocString(addr(Unicode$))
    Return bString1$

EndProc

DEF &CLSCTX_INPROC_SERVER 1
DEF &PROGDLG_NORMAL 0
DEF &PROGDLG_AUTOTIME 2
DEF &PROGDLG_MODAL 1
DEF &PDTIMER_RESET 1
DEF &IDA_COPY_ANIMATION  160
Interface IProgressDialog
DEF &QueryInterface 0
DEF &AddRef 4
DEF &Release 8
DEF &StartProgressDialog 12
DEF &StopProgressDialog 16
DEF &SetTitle 20
DEF &SetAnimation 24
DEF &HasUserCancelled 28
DEF &SetProgress 32
DEF &SetProgress64 36
DEF &SetLine 40
DEF &SetCancelMsg 44
DEF &Timer 48
Var ProgressLimit& = 5000
Declare CLSID_ProgressDialog#,IID_IProgressDialog#
Dim CLSID_ProgressDialog#,16
Dim IID_IProgressDialog#,16
LONG CLSID_ProgressDialog#,0 = $f8383852
WORD CLSID_ProgressDialog#,4 = $fcd3, $11d1
BYTE CLSID_ProgressDialog#,8 = $a6, $b9, 0, $60, $97, $df, $5b, $d4
LONG IID_IProgressDialog#,0 = $ebbc7c04
WORD IID_IProgressDialog#,4 = $315e, $11d2
BYTE IID_IProgressDialog#,8 = $b6, $2f, 0, $60, $97, $df, $5b, $d4
Var X& = 0
Var dwCompleted& = 0
Var ppv& = 0
cls
CoInitialize(0)
Var hr& = CoCreateInstance(CLSID_ProgressDialog#, 0, &CLSCTX_INPROC_SERVER, IID_IProgressDialog#,Addr(ppv&))

If hr& = ~S_OK

    Var Command& = LONG(ppv&,0)
    Call(Long(Command&,&SetTitle),ppv&,Ansi2Uni("System Fotschritt-Dialogbox"))
    Var hShell& = UseDll("shell32.dll")

    If hShell&

        Call(Long(Command&,&SetAnimation),ppv&,hShell&,&IDA_COPY_ANIMATION)

    EndIf

    Call(Long(Command&,&Timer),ppv&,&PDTIMER_RESET,0)
    Call(Long(Command&,&SetCancelMsg),ppv&,Ansi2Uni("Cancel"), 0)
    Call(Long(Command&,&SetLine),ppv&,1, Ansi2Uni("System Fortschritt-Dialog Test mit XProfan"), 1,0)
    Call(Long(Command&,&StartProgressDialog),ppv&,%hwnd, 0, &PROGDLG_NORMAL | &PROGDLG_AUTOTIME | &PROGDLG_MODAL, 0)

    Repeat

        If Call(Long(Command&,&HasUserCancelled),ppv&)

            Call(Long(Command&,&StopProgressDialog),ppv&)
            MessageBox("Fortschritt abgebrochen","Meldung",0)
            Break

        Else

            Call(Long(Command&,&SetProgress),ppv&, dwCompleted&, ProgressLimit&)

            If dwCompleted& >= ProgressLimit&

                Call(Long(Command&,&StopProgressDialog),ppv&)
                MessageBox("Fortschritt komplett","Meldung",0)
                Break

            Else

                Call(Long(Command&,&SetLine),ppv&,2, Ansi2Uni("Wir sind jetzt hier : "+Str$(dwCompleted&)+" von "+str$(ProgressLimit&)), 1, 0)
                an dieser Stelle könnte man eine Kopierfunktion
                oder irgenwelche Berechnungen einbauen, statt nur einen Zähler laufen zu lassen.
                Inc dwCompleted&

            EndIf

        EndIf

        Sleep 10  je kleiner die Pause, umso schneller der Fortschritt

    Until X& =1

    Call(Long(Command&,&Release),ppv&)
    Dispose CLSID_ProgressDialog#,IID_IProgressDialog#
    SysFreeString(bString1$)

EndIf

CoUninitialize()
FreeDll Ole&
Freedll oleaut&
waitinput
end
 
Gruss
Andreas
________ ________ ________ ________ _
Profan 3.3 - XProfanX2
Win 95,98,ME,2000,XP,Vista - Win 7 32 / 64 Bit
ASUS X93S - Intel Core I7-NVIDIA GForce 540M 8GB Arbeitsspeicher
Homepage :  [...] 
09/05/09  
 



Hehe tolles example!
 
09/05/09  
 



Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

4.342 Views

Untitledvor 0 min.
H.Brill11/19/23
RudiB.10/07/22
Julian Schmidt08/05/13
RICOSCH01/08/13

Themeninformationen



Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie