Announcement

Collapse

Forum Guidelines

This forum is for finished source code that is working properly. If you have questions about this or any other source code, please post it in one of the Discussion Forums, not here.
See more
See less

Programmers Disk Utility

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Programmers Disk Utility

    the following program provides a quite useful tool for programmers. it is based on an earlier
    work with a number of added features. the program was initially a file listing program but
    file searching and several file deletion and data output routines have been added.

    once the files are listed from either a selected disk or folder, the resulting display file
    may be copied to the clipboard, or the contents of any cell or the the file path can copied
    to the clipboard.

    i have allowed multiple file selections and a right-click menu selection would allow multiple
    file deletions to be made.

    the two required include files are available from the following links:

    ez_size.inc
    http://www.powerbasic.com/support/pb...ad.php?t=24323

    tooltips2.inc which is a november 28, 2004 modification of william burns tooltips include file.
    http://www.powerbasic.com/support/pb...ad.php?t=24833

    i have borrowed code from many of you for use in this program so this is my gift to you.

    any feedback for this program should be directed to the following link:

    http://www.powerbasic.com/support/pb...ad.php?t=13833

    a full disk utility install package including the help file is located at:
    http://www.box.net/public/10i3pzu6sl

    for those of you who prefer a zipped package over an install, use the
    following link and add your own shortcut.

    zip package link: http://www.box.net/public/9u1fbyljq

    regards,

    ~bob
    ----------------------
    composed with ez-post!

    ' last edit 2006/12/26 19:00 est",
    '=========================================================================
    the following is the basic source code: "disk uitlity.bas"
    [CODE]' pbwin 7.04
    ' pb forms 1.00 (only required to change layout)
    '------------------------------------------------------------
    ' pbforms created
    #compile exe
    #dim all

    '------------------------------------------------------------
    ' ** includes **
    '------------------------------------------------------------
    $inclean = "great stuff by borje"

    ' pbforms begin includes
    ' #resource "disk utility.pbr" ' contains only an icon and version info
    #if not %def($inclean)
    #include "win32api.inc"
    #include "commctrl.inc"
    #else
    #include "disk utility.inc"
    #endif
    ' #include "pbforms.inc"
    ' pbforms end includes
    '------------------------------------------------------------
    #include "ez_size.inc"
    #include "tooltips2.inc"

    '------------------------------------------------------------
    ' ** constants **
    '------------------------------------------------------------
    ' pbforms begin constants
    %idr_imgfile1 = 102
    %idd_dialog1 = 101
    %idd_dialog2 = 103
    %idd_dialog3 = 104
    %idr_menu1 = 105
    %filedatalistview = 1001
    %messagelabel = 1002
    %infolabel = 1003
    %filetypelabel = 1004
    %filetypecombobox = 1005
    %startfromlabel = 1006
    %startfromtextbox = 1007
    %subfolderscheckbox = 1008
    %hiddenfolderscheckbox = 1009
    %browsebutton = 1010
    %searchlabel = 1011
    %searchtextbox = 1012
    %maxfilesizelabel = 1013
    %maxfilesizecombobox = 1014
    %filetypetextbox = 1015
    %exiteditbutton = 1016
    %casesensitivecheckbox = 1017
    %unicodecheckbox = 1018
    %startbutton = 1019
    %alwaysontop = 1020
    %disabletooltips = 1021
    %exitbutton = 1022
    %helplabel = 1023
    %userfunctiontextbox = 1024
    %userfunctionbutton = 1025
    %setup_editfiletypes = 1101
    %setup_edituserfunctions = 1102
    ' pbforms end constants

    %openfile = 2001
    %openexplorer = 2002
    %deletefile = 2003
    %copyall = 2004
    %copycell = 2005
    %copypath = 2006

    %userfunction1 = 2101
    %userfunction9 = 2109
    '------------------------------------------------------------

    %inyourfaceerror = %mb_systemmodal + %mb_setforeground + _
    %mb_topmost + %mb_iconhand

    %inyourfacealert = %mb_systemmodal + %mb_setforeground + _
    %mb_topmost + %mb_iconexclamation

    %segmentsize = 10000
    %one_k = 1024
    $dashes = "------"
    %oneday = 86400

    ' magic numbers
    %lv_filename = 1
    %lv_fileext = 2
    %lv_folder = 3
    %lv_size = 4
    %lv_modified = 5
    %lv_attributes = 6
    %lv_hiddenfolder = 7

    %init_startpath = 1
    %init_filetype = 2
    %init_searchmask = 3
    %init_includesubs = 4
    %init_includehidden = 5
    %init_maxsearchsize = 6
    %init_disabletooltips = 7
    %init_alwaysontop = 8
    %init_unicodesearch = 9
    %init_casesensitive = 10
    %init_loc_x = 11
    %init_loc_y = 12
    %init_size_x = 13
    %init_size_y = 14

    %search_argument1 = 1
    %search_directive = 2
    %search_argument2 = 3

    $userdataheader = _
    "'" & string$(70, 45) & $crlf & "' user function name , " & _
    "user function executable" & $crlf & "' open with notepad , " & _
    "c:\windows\system32\notepad.exe" & $crlf & "'" & _
    string$(70, 45) & $crlf

    %userdata_name = 1
    %userdata_executable = 2

    '------------------------------------------------------------
    ' ** declarations **
    '------------------------------------------------------------
    declare callback function showdialog1proc()
    declare function showdialog1(byval hparent as dword) as long
    declare callback function showdialog2proc()
    declare function showdialog2(byval hdlg as dword) as long
    declare callback function showdialog3proc()
    declare function showdialog3(byval hdlg as dword) as long
    declare function attachmenu1(byval hdlg as dword) as dword
    ' pbforms declarations

    ' thanks to pierre bellisle 2006-12-26
    declare function pathmatchspec lib "shlwapi.dll" _
    alias "pathmatchspeca"(pszfile as asciiz, _
    pszspec as asciiz) as long
    '------------------------------------------------------------

    '------------------------------------------------------------
    ' global variables
    '------------------------------------------------------------
    global gfilecount as long ' counter for found files
    global gsubdirs as long ' flag for include sub-dirs" checkbox
    global gabort as long ' to enable cancel operation
    global ghlistview as dword ' listview's handle
    global glvsort as long ' sort direction flag
    global gtsize as quad ' found files total size
    global glastfiletype as string ' mask of file to search for
    global gstartpath as string ' path to start search from
    global gfiles() as string ' array for found files
    global gsearch as string ' search for this
    global gmatches as long ' number of search matches
    global hpopuplv as dword
    global allfilemasks as string
    global ssearch1 as string
    global ssearch2 as string
    global ssearchmask as string
    global gmaxsize as dword
    global casesensitive as long
    global unicode as long
    global includehiddenfolders as long
    global asciihiddenfolder as string
    global row as long
    global column as long
    global x_ref_size as long
    global y_ref_size as long


    '------------------------------------------------------------------
    function makefontex(byval fontname as string, _
    byval pointsize as long, _
    byval fbold as long, _
    byval fitalic as long, _
    byval funderline as long) as long

    ' borrowed from borje hagsten
    ' makefontex(fontname, pointsize, fbold, fitalic, funderline)

    local hdc as long, cypixels as long

    hdc = getdc(%hwnd_desktop)
    cypixels = getdevicecaps(hdc, %logpixelsy)
    releasedc %hwnd_desktop, hdc
    pointsize = 0 - (pointsize * cypixels) \ 72

    function = _
    createfont( _
    pointsize, 0, _ 'height, width(default=0)
    0, 0, _ 'escapement(angle), orientation
    fbold, _ 'weight (%fw_normal = 400, %fw_bold = 700)
    fitalic, _ 'italic
    funderline, _ 'underline
    %false, _ 'strikethru - who needs it?
    %ansi_charset, %out_tt_precis, _
    %clip_default_precis, %default_quality, _
    %ff_dontcare , bycopy fontname)

    end function
    '------------------------------------------------------------------
    sub edituserfunctions(hdlg as dword)

    local alwaysontop as long

    control get check hdlg, %alwaysontop to alwaysontop
    dialog disable hdlg
    showdialog3 %hwnd_desktop
    if istrue alwaysontop then
    setwindowpos hdlg, %hwnd_topmost, _
    0, 0, 0, 0, %swp_nomove or %swp_nosize: _
    control set check hdlg, %alwaysontop, %true
    else
    setwindowpos hdlg, %hwnd_top, _
    0, 0, 0, 0, %swp_nomove or %swp_nosize: _
    control set check hdlg, %alwaysontop, %false
    end if

    dialog enable hdlg

    end sub
    '------------------------------------------------------------------
    sub savestring(stringdata as string, filename as string)

    local fnum as long

    errclear
    fnum = freefile
    open filename for output as #fnum
    print #fnum, stringdata;
    if err <> 0 then _
    msgbox "an error was encountered writing to the file" & _
    $cr & $cr & filename, %inyourfaceerror, "write error"
    flush #fnum
    close #fnum

    end sub
    '------------------------------------------------------------------
    sub changebackgroundcolor(hdlg as dword, controlid as long, _
    backgroundcolor as long)

    if isfalse iswindowvisible(hdlg) then exit sub

    control set color hdlg, controlid, -1, backgroundcolor
    control redraw hdlg, controlid

    end sub
    '------------------------------------------------------------------
    sub openfileusingexplorer(hdlg as dword)

    local stemp as string, n as long

    stemp = parse$(gfiles(row), $tab, %lv_folder) & _
    parse$(gfiles(row), $tab, %lv_filename)
    n = shell ("explorer.exe " & stemp)

    end sub
    '------------------------------------------------------------------
    sub openfileusingshellexecute(hdlg as dword)

    local stemp as string, filetyp as string

    static shome as string

    stemp = parse$(gfiles(row), $tab, %lv_folder) & _
    parse$(gfiles(row), $tab, %lv_filename)
    filetyp = lcase$(parse$(stemp, ".", -1))

    shome = curdir$

    ' change to application folder
    chdrive parse$(gfiles(row), $tab, %lv_folder)
    chdir parse$(gfiles(row), $tab, %lv_folder)

    select case filetyp
    case "wav"
    sndplaysound(bycopy stemp, %snd_sync or %snd_nodefault)
    case else
    stemp = parse$(gfiles(row), $tab, %lv_folder) & _
    parse$(gfiles(row), $tab, %lv_filename)
    shellexecute 0, "open", bycopy stemp, ", ", %sw_show
    end select

    ' change to default folder
    chdrive shome
    chdir shome

    end sub
    '------------------------------------------------------------------
    sub checkallwaysontop(hdlg as dword)

    local lret as long

    control get check hdlg, %alwaysontop to lret
    if istrue lret then
    setwindowpos hdlg, %hwnd_topmost, 0, 0, 0, 0, _
    %swp_nomove or %swp_nosize
    else
    setwindowpos hdlg, %hwnd_notopmost, 0, 0, 0, 0, _
    %swp_nomove or %swp_nosize
    end if

    end sub
    '------------------------------------------------------------------
    function exists(filename as string) as long

    local fnum as long

    errclear
    fnum = freefile
    open filename for input access read lock shared as fnum
    close fnum

    if err <> 0 then function = %false else function = %true

    end function
    '------------------------------------------------------------------
    sub getstring(stringdata as string, filename as string, _
    optional byval errormessageenable as long)

    local fnum as long

    do
    if isfalse exists(filename) then
    incr fnum
    if fnum > 10 then
    if istrue errormessageenable then msgbox _
    "file read error encountered for file:" & _
    $cr & $cr & filename, %inyourfacealert, "read error"
    exit sub
    end if
    sleep 10
    else
    exit loop
    end if
    loop

    fnum =freefile
    open filename for binary access read lock shared as fnum
    get$ #fnum, lof(fnum), stringdata
    close fnum

    end sub
    '------------------------------------------------------------------
    function getuserdata() as string

    local stemp as string, sline as string, suserdata as string

    getstring stemp, "user data.ini"
    if stemp = " then stemp = $userdataheader

    do
    if stemp = " then exit loop

    sline = trim$(extract$(stemp, $crlf))
    stemp = remain$(stemp, $crlf)
    select case left$(sline, 1)
    case ", "'" ' strips blank lines and comment lines
    case else
    suserdata = suserdata & sline & $crlf
    if parsecount(sline, ",") <> 2 then _
    msgbox "incorrect comma delimiters", _
    %inyourfacealert, "''user data.ini'' error"
    end select
    loop
    function = suserdata

    end function
    '------------------------------------------------------------------
    sub positioncombobox(hdlg as dword)

    local stemp as string, comboboxrow as long, slastmask as string

    comboboxrow = 1
    do
    combobox select hdlg, %filetypecombobox, comboboxrow
    combobox get text hdlg, %filetypecombobox to stemp
    if instr(stemp, "\") = 0 then
    if stemp = glastfiletype then exit loop
    if stemp = slastmask then exit loop
    slastmask = stemp
    end if
    incr comboboxrow
    loop

    if stemp = slastmask then ' need to add mask to combobox
    combobox add hdlg, %filetypecombobox, glastfiletype
    combobox select hdlg, %filetypecombobox, comboboxrow
    combobox get text hdlg, %filetypecombobox to stemp
    allfilemasks = allfilemasks & glastfiletype & $crlf
    do
    if instr(allfilemasks, $crlf & $crlf) = 0 then exit loop
    replace $crlf & $crlf with $crlf in allfilemasks
    loop
    savestring allfilemasks, "disk utility file masks.ini"
    msgbox "file mask ''" & stemp & "'' added" & $crlf & _
    "to the file mask choices", &h51000, "added mask"
    end if

    end sub
    '------------------------------------------------------------------
    sub filetypeselection(hdlg as dword)

    local stemp as string

    combobox get text hdlg, %filetypecombobox to stemp
    if ((stemp <> glastfiletype) or (instr(stemp, "\") > 0)) then
    glastfiletype = parse$(stemp, "\", -1)
    if instr(stemp, "\") > 0 then
    gstartpath = left$(stemp, len(stemp) - len(glastfiletype) - 1)
    if right$(gstartpath, 1) <> "\" then gstartpath = gstartpath & "\"
    control set text hdlg, %startfromtextbox, gstartpath
    positioncombobox(hdlg)
    end if
    changebackgroundcolor(hdlg, %filetypecombobox, %yellow)
    end if

    end sub
    '------------------------------------------------------------
    sub findfirststandardtype(hdlg as dword, slasttype as string)

    local lasttyperow as long, stemp as string, scurrenttype as string

    getstring stemp, "disk utility file masks.ini"
    stemp = $crlf & stemp

    if instr(stemp, slasttype) = 0 then
    ' find first standard mask *.xxx
    lasttyperow = 1
    do
    combobox select hdlg, %filetypecombobox, lasttyperow
    combobox get text hdlg, %filetypecombobox to scurrenttype
    if instr(scurrenttype, "\") = 0 then exit loop
    incr lasttyperow
    loop
    else
    ' find the last mask
    lasttyperow = 1
    do
    combobox select hdlg, %filetypecombobox, lasttyperow
    combobox get text hdlg, %filetypecombobox to scurrenttype
    if scurrenttype = slasttype then exit loop
    incr lasttyperow
    loop
    end if
    control set text hdlg, %filetypecombobox, slasttype

    end sub
    '------------------------------------------------------------
    sub settooltips(hdlg as dword)

    settooltip hdlg, %searchlabel, _
    "if there is anything in the search textbox, a search" & $crlf & _
    "for that data in every file will be performed and" & $crlf & _
    "only those files containing the data will be listed." & $crlf & _
    "if a sort directive is included, then every file will" & $crlf & _
    "be searched for both the data prior to and following" & $crlf & _
    "the directive. three directives are supported, an" & $crlf & _
    "|and| directive, an |or| directive and a |not|" & $crlf & _
    "directive. a vertical bar must both preceed and" & $crlf & _
    "follow the directive so that leading or trailing" & $crlf & _
    "spaces may be included in the search data. only" & $crlf & _
    "files matching the directive will be listed"

    settooltip hdlg, %browsebutton, _
    "click the browse button to allow" & $crlf & _
    "setting of the desired starting folder"

    settooltip hdlg, %subfolderscheckbox, _
    "place a check here if searching or" & $crlf & _
    "listing should include sub folders."

    settooltip hdlg, %hiddenfolderscheckbox, _
    "place a check here if searching or" & $crlf & _
    "listing should include hidden folders."

    settooltip hdlg, %startbutton, _
    "clicking the start search button" & $crlf & _
    "will start the list/search process." & $crlf & _
    "once the process is started, the" & $crlf & _
    "button name will change from" & $crlf & _
    "from ''start search'' to ''cancel''" & $crlf & _
    "which will allow aborting any" & $crlf & _
    "undesired operations."

    settooltip hdlg, %maxfilesizelabel, _
    "changing this value will limit the" & $crlf & _
    "maximum file size for searches." & $crlf & _
    "files larger than this value will" & $crlf & _
    "not be searched."

    settooltip hdlg, %disabletooltips, _
    " placing a check here will disable" & $crlf & _
    "tooltips except for help if desired"

    end sub
    '------------------------------------------------------------
    sub getinit(hdlg as dword)

    local stemp as string, x as long, y as long

    if dir$("disk utility.ini") <> " then
    getstring stemp, "disk utility.ini"
    do
    if instr(stemp, $crlf) = 0 then exit loop
    replace $crlf with " in stemp
    loop

    gstartpath = parse$(stemp, ",", %init_startpath)
    if right$(gstartpath, 1) <> "\" then gstartpath = gstartpath & "\"
    control set text hdlg, %startfromtextbox, gstartpath

    control set text hdlg, %filetypecombobox,_
    parse$(stemp, ",", %init_filetype)
    control set text hdlg, %searchtextbox, _
    parse$(stemp, ",", %init_searchmask)
    control set check hdlg, %subfolderscheckbox, _
    val(parse$(stemp, ",", %init_includesubs))
    control set check hdlg, %hiddenfolderscheckbox, _
    val(parse$(stemp, ",", %init_includehidden))
    control set text hdlg, %maxfilesizecombobox, _
    parse$(stemp, ",", %init_maxsearchsize)
    control set check hdlg, %disabletooltips, _
    val(parse$(stemp, ",", %init_disabletooltips))
    control set check hdlg, %alwaysontop, _
    val(parse$(stemp, ",", %init_alwaysontop))
    control set check hdlg, %unicodecheckbox, _
    val(parse$(stemp, ",", %init_unicodesearch))
    control set check hdlg, %casesensitivecheckbox, _
    val(parse$(stemp, ",", %init_casesensitive))

    x = val(parse$(stemp, ",", %init_loc_x))
    y = val(parse$(stemp, ",", %init_loc_y))
    if x < 0 then x = 0
    if y < 0 then y = 0
    dialog set loc hdlg, x, y

    x = val(parse$(stemp, ",", %init_size_x))
    y = val(parse$(stemp, ",", %init_size_y))
    if x < x_ref_size then x = x_ref_size
    if y < y_ref_size then y = y_ref_size
    dialog set size hdlg, x, y

    if istrue val(parse$(stemp, ",", %init_alwaysontop)) then _
    setwindowpos hdlg, %hwnd_topmost, 0, 0, 0, 0, _
    %swp_nomove or %swp_nosize

    end if

    if parse$(stemp, ",", %init_maxsearchsize) = " then _
    control set text hdlg, %maxfilesizecombobox, "10 mb"

    if parse$(stemp, ",", %init_filetype) = " then
    glastfiletype = "*.*"
    findfirststandardtype(hdlg, glastfiletype)
    end if

    end sub
    '------------------------------------------------------------
    sub removetooltips(hdlg as dword)

    removetooltip hdlg, %searchlabel
    removetooltip hdlg, %browsebutton
    removetooltip hdlg, %subfolderscheckbox
    removetooltip hdlg, %hiddenfolderscheckbox
    removetooltip hdlg, %startbutton
    removetooltip hdlg, %maxfilesizelabel
    removetooltip hdlg, %disabletooltips

    end sub
    '------------------------------------------------------------
    sub checkdisabledtooltips(hdlg as dword)

    local lret as long

    control get check hdlg, %disabletooltips to lret
    if istrue lret then
    removetooltips(hdlg)
    else
    settooltips(hdlg)
    end if

    end sub
    '------------------------------------------------------------
    sub resize(hdlg as dword)

    static initialized as long
    local x as long, y as long, n as long
    local xc as long, yc as long

    if isfalse initialized then dialog get size hdlg _
    to x_ref_size, y_ref_size

    ' "initialize" must be specified and called first
    ez_size hdlg, 0, "initialize"

    ez_size hdlg, %filedatalistview, "stretch"
    ez_size hdlg, %messagelabel, "stretch horizontal anchor top"
    ez_size hdlg, %infolabel, "anchor top right"

    ez_size hdlg, %filetypelabel, "anchor bottom left"
    ez_size hdlg, %filetypecombobox, "anchor bottom left"
    ez_size hdlg, %startfromlabel, "anchor bottom left"
    ez_size hdlg, %startfromtextbox, "anchor bottom left"
    ez_size hdlg, %subfolderscheckbox, "anchor bottom left"
    ez_size hdlg, %hiddenfolderscheckbox, "anchor bottom left"
    ez_size hdlg, %browsebutton, "anchor bottom left"
    ez_size hdlg, %searchlabel, "anchor bottom left"
    ez_size hdlg, %searchtextbox, "anchor bottom left"
    ez_size hdlg, %maxfilesizecombobox, "anchor bottom left"
    ez_size hdlg, %maxfilesizelabel, "anchor bottom left"
    ez_size hdlg, %casesensitivecheckbox, "anchor bottom left"
    ez_size hdlg, %unicodecheckbox, "anchor bottom left"

    ez_size hdlg, %startbutton, "anchor bottom right"
    ez_size hdlg, %disabletooltips, "anchor bottom right"
    ez_size hdlg, %exitbutton, "anchor bottom right"
    ez_size hdlg, %helplabel, "anchor bottom right"
    ez_size hdlg, %alwaysontop, "anchor bottom right"

    ' "clean-up" must be specified and called last
    ez_size hdlg, 0, "clean-up"

    if isfalse initialized then
    getinit hdlg
    checkdisabledtooltips(hdlg)
    checkallwaysontop(hdlg)

    dialog get size hdlg to x, y

    ' size adjustment routine - anchor bottom left
    for n = %filetypelabel to %unicodecheckbox
    control get loc hdlg, n to xc, yc
    control set loc hdlg, n, xc, yc + (y - y_ref_size)
    next

    ' size adjustment routine - anchor bottom right
    for n = %startbutton to %helplabel
    control get loc hdlg, n to xc, yc
    control set loc hdlg, n, _
    xc + (x - x_ref_size), yc + (y - y_ref_size)
    next

    ' adjust listview size
    control get size hdlg, %filedatalistview to xc, yc
    control set size hdlg, %filedatalistview, _
    xc + (x - x_ref_size), yc + (y - y_ref_size)

    ez_size_addsizegrip hdlg

    initialized = %true
    end if

    end sub
    '------------------------------------------------------------------
    sub senduserdata(hdlg as dword, controlid as long)

    ' user data format
    ' function name, executable

    local stemp as string, suserdata as string
    local executable as string, path as string, lret as long

    suserdata = getuserdata

    stemp = trim$(parse$(suserdata, $crlf, _
    (controlid - %userfunction1 + 1)))
    replace ", " with "," in stemp

    executable = trim$(parse$(stemp, ",", %userdata_executable))
    path = trim$(parse$(gfiles(row), $tab, %lv_folder) & _
    parse$(gfiles(row), $tab, %lv_filename))

    replace "," with " in path

    ' change to executable path
    stemp = curdir$ ' save current folder
    chdrive executable
    chdir executable

    stemp = $dq & executable & $dq & " " & $dq & path & $dq
    lret = shell(stemp, 1)

    ' return to default path
    chdrive stemp
    chdir stemp

    end sub
    '------------------------------------------------------------
    ' activate default webbrowser,
    '------------------------------------------------------------
    function browse(thelink as string) as long
    function = shellexecute(%null, "open", bycopy thelink, _
    ", ", %sw_show)
    end function
    '------------------------------------------------------------
    sub displayhelp()

    if dir$("help.htm") <> " then
    browse("help.htm")
    else
    beep
    msgbox "the html help document" & $crlf & $crlf & _
    " ''help.htm''" & $crlf & $crlf & _
    " is not available" & $crlf & _
    " in this version", &h51000, "help alert"
    end if

    end sub
    '------------------------------------------------------------
    sub configuresearch(hdlg as dword)

    local stemp as string, multiplier as long

    control get text hdlg, %maxfilesizecombobox to stemp
    replace "," with " in stemp
    stemp = ucase$(trim$(stemp))

    select case right$(stemp, 2)
    case "gb"
    multiplier = %one_k ^ 3
    if val(stemp) => 4 then stemp = "3.999" ' max 3.999 gb
    control set text hdlg, %maxfilesizecombobox, _
    format$(val(stemp)) & " gb"
    case "mb"
    multiplier = %one_k ^ 2
    if val(stemp) => 4000 then stemp = "3999"
    control set text hdlg, %maxfilesizecombobox, _
    format$(val(stemp)) & " mb"
    case "kb"
    multiplier = %one_k ^ 1
    control set text hdlg, %maxfilesizecombobox, _
    format$(val(stemp)) & " kb"
    case else
    multiplier = %one_k ^ 0
    end select

    gmaxsize = val(stemp) * multiplier

    control get text hdlg, %searchtextbox to gsearch
    control get check hdlg, %casesensitivecheckbox to casesensitive
    if isfalse casesensitive then gsearch = lcase$(gsearch)

    ' setup logical searches
    if ((instr(lcase$(gsearch), "|and|") > 0) or _
    (instr(lcase$(gsearch), "|or|") > 0) or _
    (instr(lcase$(gsearch), "|not|") > 0)) then

    ssearch1 = parse$(gsearch, "|", %search_argument1)
    ssearchmask = lcase$(parse$(gsearch, "|", %search_directive))
    ssearch2 = parse$(gsearch, "|", %search_argument2)
    else
    ssearch1 = gsearch
    ssearchmask = "none"
    ssearch2 = ssearch1
    end if

    control get check hdlg,%unicodecheckbox to unicode

    control get check hdlg,%hiddenfolderscheckbox to includehiddenfolders

    control get text hdlg, %startfromtextbox to stemp
    control set text hdlg, %messagelabel, "searching: " & stemp & "..."

    end sub
    '------------------------------------------------------------
    sub deleteselecteditems(hdlg as dword)

    local i as long, lrslt as long, tlvi as lv_item

    ' set lv_item mask for unselect
    tlvi.state = not(%lvis_focused or %lvis_selected)
    tlvi.statemask = %lvis_focused or %lvis_selected

    lrslt = msgbox("are you sure you want to delete " & _
    "the high lighted file(s)?", _
    &h51000 + %mb_yesno , "delete data")
    if lrslt = %idno then exit sub

    i = -1
    do
    i = listview_getnextitem(ghlistview,i,%lvni_selected)
    if i = -1 then exit loop
    kill parse$(gfiles(i), $tab, %lv_folder) & _
    parse$(gfiles(i), $tab, %lv_filename)
    gfiles(i) = "-- deleted --" & $tab & repeat$(6, $dashes & $tab)

    ' unselect row
    sendmessage ghlistview, %lvm_setitemstate, i, byval varptr(tlvi)
    loop

    invalidaterect ghlistview, byval %null, 0
    updatewindow ghlistview 'redraw listview
    control set focus hdlg, 0

    end sub
    '------------------------------------------------------------------
    function clipboardsettext (hdlg as dword, _
    byval stext as string) as long

    local hdata as dword, hglob as dword
    hdata = globalalloc(%gmem_moveable or %gmem_ddeshare, len(stext)+1)
    hglob = globallock(hdata)
    poke$ hglob, stext + chr$(0)
    globalunlock hdata
    if isfalse(openclipboard(%null)) then ' ** open the clipboard
    globalfree hdata
    exit function
    end if
    emptyclipboard ' ** paste the data into the clipboard
    function = setclipboarddata(%cf_text, hdata)
    closeclipboard
    end function
    '------------------------------------------------------------------
    sub savefilepath2clipboard(hdlg as dword)

    local stemp as string

    stemp = parse$(gfiles(row), $tab, %lv_folder) & _
    parse$(gfiles(row), $tab, %lv_filename)
    clipboardsettext(hdlg, stemp)
    control set text hdlg, %messagelabel, _
    " the file path in the selected row has been sent to the clipboard"

    end sub
    '------------------------------------------------------------------
    sub savecell2clipboard(hdlg as dword)

    local stemp as string

    stemp = parse$(gfiles(row), $tab, column + 1)
    clipboardsettext(hdlg, stemp)
    control set text hdlg, %messagelabel, _
    " the contents of the selected cell have been sent to the clipboard"

    end sub
    '------------------------------------------------------------------
    sub copyall(hdlg as dword)

    local stemp as string

    stemp = join$(gfiles(), $crlf)
    stemp = $dq & "file name" & $dq & $tab & _
    $dq & "file ext" & $dq & $tab & _
    $dq & "folder" & $dq & $tab & _
    $dq & "size" & $dq & $tab & _
    $dq & "last modified" & $dq & $tab & _
    $dq & "attributes" & $dq & $tab & _
    $dq & "hidden folder" & $dq & $tab & _
    $crlf & stemp

    replace "," with " in stemp ' delete any commas
    replace $tab with "," in stemp ' change tab delimiter to comma
    replace "," & $crlf with $crlf in stemp ' delete trailing comma
    clipboardsettext(hdlg, stemp)
    control set text hdlg, %messagelabel, _
    " a comma-separated values (csv) file " & _
    "has been sent to the clipboard"

    end sub
    '------------------------------------------------------------------
    function getattributes(file as string) as string

    ' 0 normal** %normal
    ' 1 read-only %readonly
    ' 2 hidden %hidden
    ' 4 system %system
    ' 8 volume label %vlabel
    ' 16 directory %subdir
    ' 32 archived %archive
    ' 128 normal** (synonym of %normal)

    local attributes as long, attributestring as string

    attributes = getattr(file)

    if (attributes and %readonly) = %readonly then _
    attributestring = "r" else attributestring = "-"
    if (attributes and %archive) = %archive then _
    attributestring = attributestring & "a" else attributestring = _
    attributestring & "-"
    if (attributes and %system) = %system then _
    attributestring = attributestring & "s" else attributestring = _
    attributestring & "-"
    if (attributes and %hidden) = %hidden then _
    attributestring = attributestring & "h" else attributestring = _
    attributestring & "-"

    function = attributestring

    end function
    '------------------------------------------------------------
    sub saveinit(hdlg as dword)

    local stemp as string, sinit as string, lret as long
    local x as long, y as long

    sinit = gstartpath & "," ' 1
    control get text hdlg, %filetypecombobox to stemp ' 2
    sinit = sinit & stemp & ","
    control get text hdlg, %searchtextbox to stemp ' 3
    sinit = sinit & stemp

  • #2
    This is the "Disk Utility.inc" file for the above source code.

    Code:
    ' Created by inClean v1.25, 12-21-2006, 17:15:53
    '-----------------------------------------------------------------
    ' Equates:  173
    '-----------------------------------------------------------------
    %WINAPI                                         = 1
    %TRUE                                           = 1
    %FALSE                                          = 0
    %NULL                                           = 0
    %WM_USER                                        = &H400
    %LF_FACESIZE                                    = 32
    %MAXDWORD                                       = &HFFFFFFFF???
    %FILE_ATTRIBUTE_HIDDEN                          = &H00000002
    %FILE_ATTRIBUTE_DIRECTORY                       = &H00000010
    %NOERROR                                        = 0
    %ReadOnly                                       = &B000001
    %Hidden                                         = &B000010
    %System                                         = &B000100
    %Archive                                        = &B100000
    %CYAN                                           = &HFFFF00???
    %YELLOW                                         = &H00FFFF???
    %WHITE                                          = &HFFFFFF???
    %INVALID_HANDLE_VALUE                           = &HFFFFFFFF???
    %GMEM_MOVEABLE                                  = &H2
    %GMEM_DDESHARE                                  = &H2000
    %LOCALE_USER_DEFAULT                            = &H0000
    %TIME_FORCE24HOURFORMAT                         = &H08   ' always use 24 hour format
    %MAX_PATH                                       = 260  ' max. length of full pathname
    %OUT_TT_PRECIS                                  = 4
    %CLIP_DEFAULT_PRECIS                            = 0
    %DEFAULT_QUALITY                                = 0
    %ANSI_CHARSET                                   = 0
    %FF_DONTCARE                                    = 0    ' Don't care or don't know.
    %FW_DONTCARE                                    = 0
    %FW_NORMAL                                      = 400
    %LOGPIXELSY                                     = 90   ' Logical pixels/inch in Y
    %BIF_RETURNONLYFSDIRS                           = &H0001  ' For finding a folder to start document searching
    %BIF_DONTGOBELOWDOMAIN                          = &H0002  ' For starting the Find Computer
    %BFFM_INITIALIZED                               = 1
    %BFFM_SELCHANGED                                = 2
    %BFFM_SETSELECTIONA                             = %WM_USER + 102
    %BFFM_SETSELECTION                              = %BFFM_SETSELECTIONA
    %SW_SHOW                                        = 5
    %WM_NULL                                        = &H0
    %WM_DESTROY                                     = &H2
    %WM_SIZE                                        = &H5
    %WM_SETFONT                                     = &H30
    %WM_NOTIFY                                      = &H4E
    %WM_NCACTIVATE                                  = &H086
    %WM_INITDIALOG                                  = &H110
    %WM_COMMAND                                     = &H111
    %WM_TIMER                                       = &H113
    %WS_POPUP                                       = &H80000000
    %WS_CHILD                                       = &H40000000
    %WS_VISIBLE                                     = &H10000000
    %WS_CLIPSIBLINGS                                = &H04000000
    %WS_CLIPCHILDREN                                = &H02000000
    %WS_BORDER                                      = &H00800000
    %WS_DLGFRAME                                    = &H00400000
    %WS_VSCROLL                                     = &H00200000
    %WS_HSCROLL                                     = &H00100000
    %WS_SYSMENU                                     = &H00080000
    %WS_THICKFRAME                                  = &H00040000
    %WS_GROUP                                       = &H00020000
    %WS_TABSTOP                                     = &H00010000
    %WS_MINIMIZEBOX                                 = &H00020000
    %WS_MAXIMIZEBOX                                 = &H00010000
    %WS_EX_WINDOWEDGE                               = &H00000100
    %WS_EX_CLIENTEDGE                               = &H00000200
    %WS_EX_RIGHT                                    = &H00001000
    %WS_EX_LEFT                                     = &H00000000
    %WS_EX_LTRREADING                               = &H00000000
    %WS_EX_RIGHTSCROLLBAR                           = &H00000000
    %WS_EX_CONTROLPARENT                            = &H00010000
    %CF_TEXT                                        =  1
    %SWP_NOSIZE                                     = &H0001
    %SWP_NOMOVE                                     = &H0002
    %HWND_DESKTOP                                   = 0
    %HWND_TOP                                       = 0
    %HWND_TOPMOST                                   = &HFFFFFFFF???
    %HWND_NOTOPMOST                                 = &HFFFFFFFE???
    %SM_CXVSCROLL                                   = 2
    %SM_CYHSCROLL                                   = 3
    %TPM_RIGHTBUTTON                                = &H0002&
    %TPM_LEFTALIGN                                  = &H0000&
    %MB_YESNO                                       = &H00000004&
    %MB_ICONHAND                                    = &H00000010&
    %MB_ICONEXCLAMATION                             = &H00000030&
    %MB_SYSTEMMODAL                                 = &H00001000&
    %MB_SETFOREGROUND                               = &H00010000&
    %MB_TOPMOST                                     = &H00040000&
    %MF_ENABLED                                     = &H0&
    %MF_GRAYED                                      = &H1&
    %SC_CLOSE                                       = &HF060&
    %IDNO                                           = 7
    %ES_LEFT                                        = &H0&
    %ES_MULTILINE                                   = &H4&
    %ES_AUTOVSCROLL                                 = &H40&
    %ES_AUTOHSCROLL                                 = &H80&
    %ES_WANTRETURN                                  = &H1000&
    %EN_UPDATE                                      = &H400
    %EM_SETSEL                                      = &HB1
    %BS_TEXT                                        = &H0&
    %BS_PUSHBUTTON                                  = &H0&
    %BS_AUTOCHECKBOX                                = &H3&
    %BS_LEFT                                        = &H100&
    %BS_CENTER                                      = &H300&
    %BS_TOP                                         = &H400&
    %BS_VCENTER                                     = &HC00&
    %BS_MULTILINE                                   = &H00002000&
    %BS_NOTIFY                                      = &H00004000&
    %BN_CLICKED                                     = 0
    %SS_LEFT                                        = &H00000000
    %SS_CENTER                                      = &H00000001
    %SS_RIGHT                                       = &H00000002
    %SS_NOTIFY                                      = &H00000100
    %SS_CENTERIMAGE                                 = &H00000200
    %DS_3DLOOK                                      = &H0004&
    %DS_NOFAILCREATE                                = &H0010&
    %DS_SETFONT                                     = &H0040& ' User specified font for Dlg controls
    %DS_MODALFRAME                                  = &H0080& ' Can be combined with WS_CAPTION
    %LB_GETCURSEL                                   = &H188
    %CBN_EDITCHANGE                                 = 5
    %CBN_CLOSEUP                                    = 8
    %CBS_DROPDOWN                                   = &H2&
    %CBS_AUTOHSCROLL                                = &H40&
    %CBS_HASSTRINGS                                 = &H200&
    %SBS_SIZEBOXBOTTOMRIGHTALIGN                    = &H4&
    %SBS_SIZEGRIP                                   = &H10&
    %SND_SYNC                                       = &H0         ' play synchronously (default)
    %SND_NODEFAULT                                  = &H2         ' silence not default, if sound not found
    %NM_FIRST                                       = 0            ' generic to all controls
    %InYourFaceError                                = %MB_SYSTEMMODAL + %MB_SETFOREGROUND + _
                                                       %MB_TOPMOST + %MB_ICONHAND
    %InYourFaceAlert                                = %MB_SYSTEMMODAL + %MB_SETFOREGROUND + _
                                                       %MB_TOPMOST + %MB_ICONEXCLAMATION
    %COMMCTRL_INC                                   = 1
    %LVM_FIRST                                      = &H1000      ' ListView messages
    %NM_CLICK                                       = %NM_FIRST - 2  ' uses NMCLICK type
    %NM_DBLCLK                                      = %NM_FIRST - 3
    %NM_RCLICK                                      = %NM_FIRST - 5  ' uses NMCLICK type
    %LVN_FIRST                                      = 0-100       ' listview
    %TTS_ALWAYSTIP                                  = &H0001
    %TTS_NOPREFIX                                   = &H0002
    %TTS_BALLOON                                    = &H0040
    %TTF_IDISHWND                                   = &H00000001
    %TTF_SUBCLASS                                   = &H00000010
    %TTDT_AUTOPOP                                   = 2
    %TTM_SETDELAYTIME                               = %WM_USER +  3
    %TTM_ADDTOOL                                    = %WM_USER +  4
    %TTM_DELTOOL                                    = %WM_USER +  5
    %TTM_GETTEXT                                    = %WM_USER + 11
    %TTM_UPDATETIPTEXT                              = %WM_USER + 12
    %TTM_SETMAXTIPWIDTH                             = %WM_USER + 24
    %LVS_REPORT                                     = &H00000001
    %LVS_SHOWSELALWAYS                              = &H00000008
    %LVS_OWNERDATA                                  = &H00001000
    %LVM_GETITEMCOUNT                               = %LVM_FIRST + 4
    %LVIF_TEXT                                      = &H0001
    %LVIS_FOCUSED                                   = &H0001
    %LVIS_SELECTED                                  = &H0002
    %LVNI_SELECTED                                  = &H0002
    %LVM_GETNEXTITEM                                = %LVM_FIRST + 12
    %LVCF_FMT                                       = &H0001
    %LVCF_WIDTH                                     = &H0002
    %LVCF_TEXT                                      = &H0004
    %LVCF_SUBITEM                                   = &H0008
    %LVCFMT_LEFT                                    = &H00000000
    %LVCFMT_RIGHT                                   = &H00000001
    %LVCFMT_CENTER                                  = &H00000002
    %LVM_INSERTCOLUMN                               = %LVM_FIRST + 27
    %LVM_SETITEMSTATE                               = %LVM_FIRST + 43
    %LVSICF_NOINVALIDATEALL                         = &H00000001
    %LVM_SETITEMCOUNT                               = %LVM_FIRST + 47
    %LVM_SETEXTENDEDLISTVIEWSTYLE                   = %LVM_FIRST + 54  ' optional wParam == mask
    %LVM_GETEXTENDEDLISTVIEWSTYLE                   = %LVM_FIRST + 55
    %LVS_EX_FULLROWSELECT                           = &H00000020 ' applies to report mode only
    %LVS_EX_INFOTIP                                 = &H00000400 ' listview does InfoTips for you
    %LVN_COLUMNCLICK                                = %LVN_FIRST - 8
    %LVN_GETDISPINFO                                = %LVN_FIRST - 50
     
    '-----------------------------------------------------------------
    ' TYPE and UNION structures:  14
    '-----------------------------------------------------------------
    TYPE RECT
      nLeft AS LONG
      nTop AS LONG
      nRight AS LONG
      nBottom AS LONG
    END TYPE
     
    TYPE POINTAPI
      x AS LONG
      y AS LONG
    END TYPE
     
    TYPE FILETIME
      dwLowDateTime AS DWORD
      dwHighDateTime AS DWORD
    END TYPE
     
    TYPE SYSTEMTIME
      wYear AS WORD
      wMonth AS WORD
      wDayOfWeek AS WORD
      wDay AS WORD
      wHour AS WORD
      wMinute AS WORD
      wSecond AS WORD
      wMilliseconds AS WORD
    END TYPE
     
    TYPE WIN32_FIND_DATA
      dwFileAttributes AS DWORD
      ftCreationTime AS FILETIME
      ftLastAccessTime AS FILETIME
      ftLastWriteTime AS FILETIME
      nFileSizeHigh AS DWORD
      nFileSizeLow AS DWORD
      dwReserved0 AS DWORD
      dwReserved1 AS DWORD
      cFileName AS ASCIIZ * %MAX_PATH
      cAlternateFileName AS ASCIIZ * 14
    END TYPE
     
    TYPE LOGFONT
      lfHeight AS LONG
      lfWidth AS LONG
      lfEscapement AS LONG
      lfOrientation AS LONG
      lfWeight AS LONG
      lfItalic AS BYTE
      lfUnderline AS BYTE
      lfStrikeOut AS BYTE
      lfCharSet AS BYTE
      lfOutPrecision AS BYTE
      lfClipPrecision AS BYTE
      lfQuality AS BYTE
      lfPitchAndFamily AS BYTE
      lfFaceName AS ASCIIZ * %LF_FACESIZE
    END TYPE
     
    TYPE NMHDR
      hwndFrom AS DWORD
      idfrom AS DWORD
      code AS LONG    ' used for messages, so needs to be LONG, not DWORD...
    END TYPE
     
    TYPE TOOLINFO
      cbSize AS DWORD
      uFlags AS DWORD
      hwnd AS DWORD
      uId AS DWORD
      rec AS RECT
      hinst AS DWORD
      lpszText AS ASCIIZ PTR
      lParam AS LONG
      lpReserved AS DWORD
    END TYPE
     
    TYPE BROWSEINFO
        hWndOwner      AS DWORD
        pIDLRoot       AS DWORD
        pszDisplayName AS ASCIIZ PTR
        lpszTitle      AS ASCIIZ PTR
        ulFlags        AS DWORD
        lpfnCallback   AS DWORD
        lParam         AS LONG
        iImage         AS LONG
    END TYPE
     
    TYPE INIT_COMMON_CONTROLSEX
        dwSize AS DWORD   ' size of this structure
        dwICC  AS DWORD   ' flags indicating which classes to be initialized
    END TYPE
     
    TYPE LV_ITEM
        mask       AS DWORD
        iItem      AS LONG
        iSubItem   AS LONG
        STATE      AS DWORD
        stateMask  AS DWORD
        pszText    AS ASCIIZ PTR
        cchTextMax AS LONG
        iImage     AS LONG
        lParam     AS LONG
        iIndent    AS LONG
        iGroupId   AS LONG
        cColumns   AS DWORD        ' tile view columns
        puColumns  AS DWORD PTR
    END TYPE
     
    TYPE LV_COLUMN
        mask AS DWORD
        fmt AS LONG
        cx AS LONG
        pszText AS ASCIIZ PTR
        cchTextMax AS LONG
        iSubItem AS LONG
        iImage AS LONG
        iOrder AS LONG
    END TYPE
     
    TYPE NM_LISTVIEW
        hdr       AS NMHDR
        iItem     AS LONG
        iSubItem  AS LONG
        uNewState AS DWORD
        uOldState AS DWORD
        uChanged  AS DWORD
        ptAction  AS POINTAPI
        lParam    AS LONG
    END TYPE
     
    TYPE LV_DISPINFO
        hdr  AS NMHDR
        item AS LV_ITEM
    END TYPE
     
    '-----------------------------------------------------------------
    ' Declared Functions:  46
    '-----------------------------------------------------------------
    DECLARE FUNCTION CloseClipboard LIB "USER32.DLL" ALIAS "CloseClipboard" () AS LONG
    DECLARE FUNCTION CreateFont LIB "GDI32.DLL" ALIAS "CreateFontA" (BYVAL nHeight AS LONG, BYVAL nWidth AS LONG, BYVAL nEscapement AS LONG, BYVAL nOrientation AS LONG, BYVAL fnWeight AS LONG, BYVAL fdwItalic AS DWORD, _
            BYVAL fdwUnderline AS DWORD, BYVAL fdwStrikeOut AS DWORD, BYVAL fdwCharSet AS DWORD, BYVAL fdwOutputPrecision AS DWORD, BYVAL fdwClipPrecision AS DWORD, BYVAL fdwQuality AS DWORD, _
            BYVAL fdwPitchAndFamily AS DWORD, lpszFace AS ASCIIZ) AS DWORD
    DECLARE FUNCTION CreateFontIndirect LIB "GDI32.DLL" ALIAS "CreateFontIndirectA" (lpLogFont AS LOGFONT) AS DWORD
    DECLARE FUNCTION CreateWindowEx LIB "USER32.DLL" ALIAS "CreateWindowExA" (BYVAL dwExStyle AS DWORD, lpClassName AS ASCIIZ, lpWindowName AS ASCIIZ, BYVAL dwStyle AS DWORD, BYVAL x AS LONG, BYVAL y AS LONG, _
        BYVAL nWidth AS LONG, BYVAL nHeight AS LONG, BYVAL hWndParent AS DWORD, BYVAL hMenu AS DWORD, BYVAL hInstance AS DWORD, lpParam AS ANY) AS DWORD
    DECLARE FUNCTION DeleteObject LIB "GDI32.DLL" ALIAS "DeleteObject" (BYVAL hObject AS DWORD) AS LONG
    DECLARE FUNCTION DestroyMenu LIB "USER32.DLL" ALIAS "DestroyMenu" (BYVAL hMenu AS DWORD) AS LONG
    DECLARE FUNCTION EmptyClipboard LIB "USER32.DLL" ALIAS "EmptyClipboard" () AS LONG
    DECLARE FUNCTION EnumChildWindows LIB "USER32.DLL" ALIAS "EnumChildWindows" (BYVAL hwndParent AS DWORD, BYVAL lpEnumFunc AS LONG, BYVAL lParam AS LONG) AS LONG
    DECLARE FUNCTION FileTimeToLocalFileTime LIB "KERNEL32.DLL" ALIAS "FileTimeToLocalFileTime" (lpFileTime AS FILETIME, lpLocalFileTime AS FILETIME) AS LONG
    DECLARE FUNCTION FileTimeToSystemTime LIB "KERNEL32.DLL" ALIAS "FileTimeToSystemTime" (lpFileTime AS FILETIME, lpSystemTime AS SYSTEMTIME) AS LONG
    DECLARE FUNCTION FindClose LIB "KERNEL32.DLL" ALIAS "FindClose" (BYVAL hFindFile AS DWORD) AS LONG
    DECLARE FUNCTION FindFirstFile LIB "KERNEL32.DLL" ALIAS "FindFirstFileA" (lpFileName AS ASCIIZ, lpFindFileData AS WIN32_FIND_DATA) AS DWORD
    DECLARE FUNCTION FindNextFile LIB "KERNEL32.DLL" ALIAS "FindNextFileA" (BYVAL hFindFile AS DWORD, lpFindFileData AS WIN32_FIND_DATA) AS LONG
    DECLARE FUNCTION FreeLibrary LIB "KERNEL32.DLL" ALIAS "FreeLibrary" (BYVAL hLibModule AS DWORD) AS LONG
    DECLARE FUNCTION GetCursorPos LIB "USER32.DLL" ALIAS "GetCursorPos" (lpPoint AS POINTAPI) AS LONG
    DECLARE FUNCTION GetDateFormat LIB "KERNEL32.DLL" ALIAS "GetDateFormatA" (BYVAL Locale AS LONG, BYVAL dwFlags AS DWORD, lpDate AS SYSTEMTIME, lpFormat AS ASCIIZ, lpDateStr AS ASCIIZ, BYVAL cchDate AS LONG) AS LONG
    DECLARE FUNCTION GetDC LIB "USER32.DLL" ALIAS "GetDC" (BYVAL hWnd AS DWORD) AS DWORD
    DECLARE FUNCTION GetDeviceCaps LIB "GDI32.DLL" ALIAS "GetDeviceCaps" (BYVAL hdc AS DWORD, BYVAL nIndex AS LONG) AS LONG
    DECLARE FUNCTION GetDlgCtrlID LIB "USER32.DLL" ALIAS "GetDlgCtrlID" (BYVAL hWnd AS DWORD) AS LONG
    DECLARE FUNCTION GetDlgItem LIB "USER32.DLL" ALIAS "GetDlgItem" (BYVAL hDlg AS DWORD, BYVAL nIDDlgItem AS LONG) AS DWORD
    DECLARE FUNCTION GetModuleHandle LIB "KERNEL32.DLL" ALIAS "GetModuleHandleA" (lpModuleName AS ASCIIZ) AS DWORD
    DECLARE FUNCTION GetProcAddress LIB "KERNEL32.DLL" ALIAS "GetProcAddress" (BYVAL hModule AS DWORD, lpProcName AS ASCIIZ) AS LONG
    DECLARE FUNCTION GetSystemMenu LIB "USER32.DLL" ALIAS "GetSystemMenu" (BYVAL hWnd AS DWORD, BYVAL bRevert AS LONG) AS LONG
    DECLARE FUNCTION GetSystemMetrics LIB "USER32.DLL" ALIAS "GetSystemMetrics" (BYVAL nIndex AS LONG) AS LONG
    DECLARE FUNCTION GetTimeFormat LIB "KERNEL32.DLL" ALIAS "GetTimeFormatA" (BYVAL Locale AS LONG, BYVAL dwFlags AS DWORD, lpTime AS SYSTEMTIME, lpFormat AS ASCIIZ, lpTimeStr AS ASCIIZ, BYVAL cchTime AS LONG) AS LONG
    DECLARE FUNCTION GlobalAlloc LIB "KERNEL32.DLL" ALIAS "GlobalAlloc" (BYVAL wFlags AS DWORD, BYVAL dwBytes AS DWORD) AS LONG
    DECLARE FUNCTION GlobalFree LIB "KERNEL32.DLL" ALIAS "GlobalFree" (BYVAL hMem AS DWORD) AS LONG
    DECLARE FUNCTION GlobalLock LIB "KERNEL32.DLL" ALIAS "GlobalLock" (BYVAL hMem AS DWORD) AS DWORD
    DECLARE FUNCTION GlobalUnlock LIB "KERNEL32.DLL" ALIAS "GlobalUnlock" (BYVAL hMem AS DWORD) AS LONG
    DECLARE FUNCTION InvalidateRect LIB "USER32.DLL" ALIAS "InvalidateRect" (BYVAL hWnd AS DWORD, lpRect AS RECT, BYVAL bErase AS LONG) AS LONG
    DECLARE FUNCTION IsIconic LIB "USER32.DLL" ALIAS "IsIconic" (BYVAL hWnd AS DWORD) AS LONG
    DECLARE FUNCTION IsWindow LIB "USER32.DLL" ALIAS "IsWindow" (BYVAL hWnd AS DWORD) AS LONG
    DECLARE FUNCTION IsWindowVisible LIB "USER32.DLL" ALIAS "IsWindowVisible" (BYVAL hWnd AS DWORD) AS LONG
    DECLARE FUNCTION LoadLibrary LIB "KERNEL32.DLL" ALIAS "LoadLibraryA" (lpLibFileName AS ASCIIZ) AS LONG
    DECLARE FUNCTION OpenClipboard LIB "USER32.DLL" ALIAS "OpenClipboard" (BYVAL hWnd AS DWORD) AS LONG
    DECLARE FUNCTION PostMessage LIB "USER32.DLL" ALIAS "PostMessageA" (BYVAL hWnd AS DWORD, BYVAL dwMsg AS DWORD, BYVAL wParam AS DWORD, BYVAL lParam AS LONG) AS LONG
    DECLARE FUNCTION ReleaseDC LIB "USER32.DLL" ALIAS "ReleaseDC" (BYVAL hWnd AS DWORD, BYVAL hDC AS DWORD) AS LONG
    DECLARE FUNCTION SendMessage LIB "USER32.DLL" ALIAS "SendMessageA" (BYVAL hWnd AS DWORD, BYVAL dwMsg AS DWORD, BYVAL wParam AS DWORD, BYVAL lParam AS LONG) AS LONG
    DECLARE FUNCTION SetClipboardData LIB "USER32.DLL" ALIAS "SetClipboardData" (BYVAL dwFormat AS DWORD, BYVAL hMem AS DWORD) AS DWORD
    DECLARE FUNCTION SetWindowPos LIB "USER32.DLL" ALIAS "SetWindowPos" (BYVAL hWnd AS DWORD, BYVAL hWndInsertAfter AS DWORD, BYVAL x AS LONG, BYVAL y AS LONG, BYVAL cx AS LONG, BYVAL cy AS LONG, BYVAL wFlags AS DWORD) AS LONG
    DECLARE FUNCTION SHBrowseForFolder LIB "SHELL32.DLL" ALIAS "SHBrowseForFolderA" (lpbi AS BROWSEINFO) AS DWORD
    DECLARE FUNCTION ShellExecute LIB "SHELL32.DLL" ALIAS "ShellExecuteA" (BYVAL hwnd AS DWORD, lpOperation AS ASCIIZ, lpFile AS ASCIIZ, lpParameters AS ASCIIZ, lpDirectory AS ASCIIZ, BYVAL nShowCmd AS LONG) AS DWORD
    DECLARE FUNCTION SHGetPathFromIDList LIB "SHELL32.DLL" ALIAS "SHGetPathFromIDListA" (pidList AS ANY, lpBuffer AS ASCIIZ) AS LONG
    DECLARE FUNCTION sndPlaySound LIB "WINMM.DLL" ALIAS "sndPlaySoundA" (lpszSoundName AS ASCIIZ, BYVAL uFlags AS DWORD) AS LONG
    DECLARE FUNCTION TrackPopupMenu LIB "USER32.DLL" ALIAS "TrackPopupMenu" (BYVAL hMenu AS DWORD, BYVAL uFlags AS DWORD, BYVAL x AS LONG, BYVAL y AS LONG, BYVAL nReserved AS LONG, BYVAL hWnd AS DWORD, lprc AS RECT) AS LONG
    DECLARE FUNCTION UpdateWindow LIB "USER32.DLL" ALIAS "UpdateWindow" (BYVAL hWnd AS DWORD) AS LONG
     
    '-----------------------------------------------------------------
    DECLARE SUB CoTaskMemFree LIB "ole32.dll" ALIAS "CoTaskMemFree" (BYVAL pMem AS DWORD)
    DECLARE SUB InitCommonControls LIB "COMCTL32.DLL" ALIAS "InitCommonControls" ()
     
    '-----------------------------------------------------------------
    DECLARE FUNCTION ListView_GetNextItem (BYVAL hWnd AS DWORD, BYVAL i AS LONG, BYVAL flags AS LONG) AS LONG
    '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    FUNCTION ListView_GetNextItem (BYVAL hWnd AS DWORD, BYVAL i AS LONG, BYVAL flags AS LONG) AS LONG
            FUNCTION = SendMessage(hWnd, %LVM_GETNEXTITEM, i, MAKLNG(flags, 0))
    END FUNCTION
     
    '-----------------------------------------------------------------
    DECLARE SUB ListView_SetItemCountEx (BYVAL hwndLV AS DWORD, BYVAL cItems AS DWORD, _
                   BYVAL dwFlags AS LONG)
    '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     
     
    SUB ListView_SetItemCountEx (BYVAL hwndLV AS DWORD, BYVAL cItems AS DWORD, _
           BYVAL dwFlags AS LONG)
            SendMessage hwndLV, %LVM_SETITEMCOUNT, cItems, dwFlags
    END SUB

    ------------------

    Comment


    • #3
      The following file is a typical file showing how the user can customize the
      Disk Utility for his own special purposes. This idea was suggested by
      Michael Mattias.

      Create a file by the name "User Data.ini" with the following data. As many
      as 9 custom functions can be added.

      Code:
      '----------------------------------------------------------------------
      ' User Function Name  ,  User Function Executable
      ' Open with Notepad   ,  C:\WINDOWS\system32\notepad.exe
      '----------------------------------------------------------------------
      Open with Notepad  ,   C:\WINDOWS\system32\notepad.exe
      Open with Excel    ,   D:\Program Files\Microsoft Office\Office\EXCEL.EXE
      Open with Word     ,   D:\Program Files\Microsoft Office\Office\WINWORD.EXE
      These are only examples. The left hand entry is the name desired in the
      right-click display menu and right hand entry is the desired executable.
      The path of the item on the row clicked is passed as an argument to the
      executable.

      Regards,

      ~Bob
      ----------------------
      Composed with EZ-POST!




      ------------------


      [This message has been edited by Bob Scott (edited December 21, 2006).]

      Comment


      • #4
        As of January 22 2007, all this source code plus an EXE which was compiled using
        PBWin 7.04 and will run on any version of Windows (W95B or newer) as long as the
        monitor has at least 1024 x 768 resolution is available in the PowerBASIC Files
        Section at:

        Link: http://www.powerbasic.com/files/pub/pbwin/tools/PDU.zip

        Regards,

        ~Bob
        ----------------------
        Composed with EZ-POST!


        [This message has been edited by Bob Scott (edited January 27, 2007).]

        Comment


        • #5
          Not that I am slow or anything but after 3 years I'm finally getting around to update some things about this utility that have "bugged"me for a long time.

          This first problem was that a sort on size was not accurate due to the commas and number lengths messing up the string sort so the fix is to change the following portion of the "SortColumn" subroutine:

          From:
          Code:
              ' Parse out proper "column" to temp. array
              FOR i = 0 TO UBOUND(gFiles(1))
                  dummy(i) = PARSE$(gFiles(i), $TAB, clmn)
              NEXT
          To:
          Code:
              ' Parse out proper "column" to temp. array
              FOR i = 0 TO UBOUND(gFiles(1))
                  dummy(i) = PARSE$(gFiles(i), $TAB, clmn)
                  IF clmn = %LV_Size THEN 
                      REPLACE "," WITH "" IN dummy(i)
                      dummy(i) = RIGHT$(STRING$(20, "0") & dummy(i), 20) 
                  END IF
              NEXT
          Best regards,

          ~Bob
          Last edited by Bob Scott; 6 Feb 2010, 02:19 PM. Reason: Display

          Comment


          • #6
            Not that I am any faster... LOL

            So, I've been looking to study disk search programs, and I noticed that the code in post #1 is incomplete.
            Also, the links to the PDU.zip file are broken.
            AND, I cannot find the old FILES section of the PB website, so...

            ...does anyone have an archived copy of PDU.zip?

            If yes, then please either post it here, post a link to where I could download it, or PM me?

            Thanks,
            -John

            Comment


            • #7
              Is this the PDU.ZIP file that you are looking for?

              I found it at https://web.archive.org/web/20080923...b/pbwin/tools/

              Joe

              Comment


              • #8
                See post 5. The correction there may not have been made in the zip.
                Dale

                Comment

                Working...
                X