News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Semi-beginner needs some help

Started by skywalker, December 14, 2005, 03:28:27 PM

Previous topic - Next topic

skywalker


I would like to make this to where it can read in a text file with
additional file names to copy. Or any other ideas would be appreciated.
Ideally I could add and subtract files by clicking on them.


Thanks.

; copyf.asm  Copy a file over an existing file
;           

.486                       
    .model flat, stdcall       ; 32 bit memory model
    option casemap :none       ; case sensitive


    include \masm32\include\windows.inc
    include \masm32\include\masm32.inc
    include \masm32\include\gdi32.inc
    include \masm32\include\user32.inc
    include \masm32\include\kernel32.inc
    include \masm32\include\Comctl32.inc
    include \masm32\include\comdlg32.inc
    include \masm32\include\shell32.inc
    include \masm32\include\oleaut32.inc
    include \masm32\macros\macros.asm

    includelib \masm32\lib\masm32.lib
    includelib \masm32\lib\gdi32.lib
    includelib \masm32\lib\user32.lib
    includelib \masm32\lib\kernel32.lib
    includelib \masm32\lib\Comctl32.lib
    includelib \masm32\lib\comdlg32.lib
    includelib \masm32\lib\shell32.lib
    includelib \masm32\lib\oleaut32.lib

.data

      File1 db "Q:\LabSupplies\lab_order.xls", 0 ; file names are case sensitive
      File2 db "C:\spare\lab_order.xls", 0

.code

start:

main proc

    LOCAL buffer[260]:BYTE
    invoke GetCL,1,ADDR buffer

    ; Specifies how this operation is to proceed if a file of the same
    ; name as that specified by lpNewFileName already exists.
    ; If this parameter is TRUE and the new file already exists,
    ; the function fails. If this parameter is FALSE and the new file
    ; already exists, the function overwrites the existing file and succeeds.                   

    invoke CopyFile, offset File1, offset File2, FALSE
    invoke ExitProcess,0

main endp

end start

farrier

skywalker,

Attached is a program I'm using with customers to do a data backup without any user interaction.  It is in a very rough state right now, as I am making some changes.  When the program is working as intended, with the following command line:

dateback E: file12bBackedUp.dat, file22bBackedUp.dat

it does the following:

This is run from a batch file associated with a DeskTop Icon.  The first parameter is the destination drive--CDRW or USB thumb drive.
The remaining parameters are the files to be backed up.
The total size of the files to be backed up is calculated and the destination drive is checked for available space.
If there is not enough space available, the oldest folder previously created by this program is deleted and the available space is recalculated.
A new folder is created with the current date as: 20051215THU
The files to be backed up are copied to the newly created folder.

hth,

farrier


[attachment deleted by admin]
It is a GOOD day to code!
Some assembly required!
ASM me!
With every mistake, we must surely be learning. (George...Bush)

skywalker

Quote from: farrier on December 15, 2005, 08:33:45 AM
skywalker,

Attached is a program I'm using with customers to do a data backup without any user interaction.  It is in a very rough state right now, as I am making some changes.  When the program is working as intended, with the following command line:

dateback E: file12bBackedUp.dat, file22bBackedUp.dat

it does the following:

This is run from a batch file associated with a DeskTop Icon.  The first parameter is the destination drive--CDRW or USB thumb drive.
The remaining parameters are the files to be backed up.
The total size of the files to be backed up is calculated and the destination drive is checked for available space.
If there is not enough space available, the oldest folder previously created by this program is deleted and the available space is recalculated.
A new folder is created with the current date as: 20051215THU
The files to be backed up are copied to the newly created folder.

hth,

farrier


Many thanks. I haven't done programming for about 8 months. I'll look it over and study it. Is this a console program?

Andy



farrier

skywalker,

Quote from: skywalker on December 15, 2005, 02:28:26 PM
Many thanks. I haven't done programming for about 8 months. I'll look it over and study it. Is this a console program?

Andy

It is not a console program, it creates a simple dialog, then hides it, then removes the button from the taskbar so that the user is not tempted to close the program.  It really should be a service, but I didn't know how then and it works just fine.

farrier
It is a GOOD day to code!
Some assembly required!
ASM me!
With every mistake, we must surely be learning. (George...Bush)

skywalker

Quote from: farrier on December 15, 2005, 06:02:48 PM
skywalker,

Quote from: skywalker on December 15, 2005, 02:28:26 PM
Many thanks. I haven't done programming for about 8 months. I'll look it over and study it. Is this a console program?

Andy

It is not a console program, it creates a simple dialog, then hides it, then removes the button from the taskbar so that the user is not tempted to close the program.  It really should be a service, but I didn't know how then and it works just fine.

farrier


I will need some help at some point in converting it to masm style.