|
Post by metro on Feb 15, 2021 5:11:55 GMT -5
I didn't want to insult your intelligence with this kludge, but what the heck....
'Nomainwin options$(0) = "Cold Contact Phone Call" options$(1) = "Send Literature" options$(2) = "Follow Up Call" options$(3) = "Send Promotional" options$(4) = "Final Call"
groupbox #status, "Confirm Selection Mode:", 5, 2, 250, 40 radiobutton #status.sel, "Single", [SingleStatusSelection], [nil], 15, 15, 50, 20 radiobutton #status.sel2, "Double", [DblStatusSelection],[nil] 70, 15, 50, 20 button #status.btnSel, "Select", [MultiSel],UL, 125, 15, 50, 20 button #status.btn, "Clear Selection", [clearAllItems],UL, 175, 15, 75, 20 listbox #status.list, options$(), selectionMade, 5, 50, 250, 90 listbox #status.list2, options$(),[MultiSel], 5, 50, 250, 90 Stylebits #status.list2, _LBS_MULTIPLESEL,0,0,0 WindowWidth = 270 : WindowHeight = 180
open "Select a contact status" for window as #status hLB = hwnd(#status.list2)
#status.list "singleclickselect" #status.list2,"hide" #status, "trapclose [quit]" #status.sel,"set" wait
sub selectionMade handle$ print #status.list, "selection? selection$" notice selection$ + " was chosen with listbox ";handle$ end sub
[SingleStatusSelection] #status.list2,"hide" #status.list,"show"
wait [DblStatusSelection] #status.list2,"show" #status.list,"hide" Wait [MultiSel] call itemsSelected hLB
[nil] wait [quit] close #status end
sub itemsSelected hLB itemsSel$ = "" For i = 0 to 5 isSel = SendMessageA(hLB, _LB_GETSEL, i , nullParameter) 'i - 1 = Item Number (par1), no relevance (par2) If isSel Then print options$(i) End If Next i end sub
[clearAllItems] allClear = SendMessageA(hLB, _LB_SETSEL, 0, -1) '0 (par1) = Flag to Clear, -1 (par2) = ALL Wait
Function SendMessageA(hW, msg, par1, par2) CallDLL #user32, "SendMessageA",_ hW as Ulong, _ 'Handle of the control (listbox) msg as Long, _ 'Stylebits (Windows Constant) par1 as Long, _ 'Parameter 1 (sometimes irrelevant) par2 as Long, _ 'Parameter 2 (sometimes irrelevant) SendMessageA as long 'Return Value, 1 = success End Function
|
|
|
Post by metro on Feb 15, 2021 18:23:25 GMT -5
Not sure if this is of any use to anyone, can't take credit for it though msghook libertybasiccom.proboards.com/post/34' All Credit to the Unknown coder nomainwin GLOBAL SelectedNode
' - check for defaults file if exists then open it, if it does not exit create it fpath$=DefaultDir$;"\defaults.txt" ' default paramaters file if fileExists(fpath$) then goto [cont] else open "defaults.txt" for output as #1 'create file with these as defaults #1, DefaultDir$ close #1 end if [cont] open fpath$ for input as #1 INPUT #1,PathSpec$ close #1 dim dir$(0, 0) dim FolderInfo$(50000,2) ' holds number and path associated with them dim Subfolders$(5000) dim folders$(10000) dim foundfolders$(100) gosub [setup]' ---- go set up constants structs etc. ' includedfiles$(0)= all file types that will be displayed in listview includedfiles$(0)="bmp BMP jpg JPG jpeg JPEG pdf PDF txt TXT doc DOC xls XLS" includedfiles$(0)=includedfiles$(0); "wks WKS gif GIF tif TIF tiff TIFF wma WMA png PNG" includedfiles$(0)=includedfiles$(0);" bas BAS bak BAK zip ZIP log LOG tkn TKN exe EXE ini INI" WindowWidth = 924:WindowHeight = 668 UpperLeftX=int((DisplayWidth-WindowWidth)/2) UpperLeftY=int((DisplayHeight-WindowHeight)/2) menu #main, "File","Save Defaults ", [SaveDefaults],"E&xit", [quit] button #main.b2,"Browse",[browse], ul,10, 88, 70, 24 button #main.GetMsgHookCallback, "", [OpenFile], ul, 0, 0, 0, 0 button #main.openfile, "Open File", [OpenFile], ul,310, 88, 70, 24 open "test" for window as #main #main "trapclose [quit]" #main.openfile,"!hide" hwnd = hwnd(#main) calldll #comctl32, "InitCommonControls", re as void CallDLL #user32, "GetWindowLongA",hwnd As ulong,_GWL_HINSTANCE As long,_ hInstance As ulong 'returns instance handle of window TV.Style = _WS_VISIBLE or _WS_CHILD or _WS_BORDER or_ TVS.HASLINES or TVS.HASBUTTONS or TVS.SHOWSELALWAYS or TVS.LINESATROOT calldll #user32, "CreateWindowExA",WS.EX.CLIENTEDGE As long,_ "SysTreeview32" as ptr,"" as ptr,TV.Style as long,_ 10 as long,118 as long,288 as long,_ 460 as long,hwnd as ulong,0 as ulong,_ hInstance as ulong,"" as ptr,hwndTree As ulong LV.style = _WS_CHILD OR _WS_VISIBLE_ OR LVS.NOSORTHEADER _ OR LVS.REPORT OR LVS.SHOWSELALWAYS 'or LVS.NOCOLUMNHEADER calldll #user32, "CreateWindowExA",_ _WS_EX_CLIENTEDGE As long,_ ' extended style "SysListView32" as ptr,_ ' class name "" as ptr,_ LV.style as long,_ ' style 297 as long,_ ' left x 118 as long,_ ' top y 605 as long,_ ' width 460 as long,_ ' height hwnd as long,_ ' parent hWnd 0 as long,_ hInstance as long,_ ' hInstance "" as ptr,_ hwndLV as long ' listview handle LVM.FIRST = hexdec("1000") ' set listview to high lite complete line LVM.SETEXTENDEDLISTVIEWSTYLE = LVM.FIRST + 54 LVS.EX.FULLROWSELECT = hexdec("20") CallDLL #user32, "SendMessageA", _ hwndLV As ulong, _ LVM.SETEXTENDEDLISTVIEWSTYLE As long, _ ' LVS.EX.FULLROWSELECT As long, _ LVS.EX.FULLROWSELECT As long, _ r As long label$(0)="290 Name 0" label$(1)="60 Type 1" label$(2)="100 Size 2" label$(3)="130 Modified 3" for a = 0 to 3 wide= val(word$(label$(a),1)) text$=word$(label$(a),2) column=val(word$(label$(a),3)) LVCOLUMN.mask.struct = LVCF.WIDTH OR LVCF.TEXT LVCOLUMN.cx.struct = wide LVCOLUMN.pszText$.struct = text$ CallDLL #user32, "SendMessageA", _ hwndLV As long, _ LVM.INSERTCOLUMN As long, _ column As long, _ LVCOLUMN As struct, _ r As long next a '-------- code to open file that is double clicked in listview if fileExists("msghook.dll") then #main.openfile,"!hide" open "MsgHook" for dll as #MsgHook HookDll=1 hMsgProc = hwnd(#main.GetMsgHookCallback) calldll #MsgHook, "TrapMsgFor",hwndLV as ulong, ret as boolean calldll #MsgHook, "WatchMsg", hwndLV as ulong, _WM_LBUTTONDBLCLK as long, ret as boolean calldll #user32, "GetWindowLongA",hMsgProc as ulong,_GWL_ID as short,callbackID as long calldll #MsgHook, "CreateGetMsgProcHook", hwnd as ulong, callbackID as long, _ hMsgProc as ulong, hHook as ulong else #main.openfile,"!show" end if calldll #user32, "SendMessageA",_ 'add image list to treeview hwndTree as ulong,_ 'handle of treeview TVM.SETIMAGELIST as long,_ 'set imagelist to treeview control TVSIL.NORMAL as long,_ 'type of image to replace hImageList as ulong,_ 'handle of imagelist (if null, list removed) re as long 'returns handle of previous imagelist mask = TVIF.TEXT or TVIF.IMAGE or TVIF.SELECTEDIMAGE 'valid members of struct '---------fill these struct members once TVINSERTSTRUCT.mask.struct = mask TVINSERTSTRUCT.iImage.struct = folderImage TVINSERTSTRUCT.iSelectedImage.struct = folderOpenImage [start] if right$(PathSpec$,1)<> "\" then PathSpec$ = PathSpec$; "\" a=0:b=0:c=0:d=0:s=0:y=0:f=0:x=0:r=0:m=0:m1=0:folderCount=0:i=0:index=0:Root=0 selectedItem=0 redim FolderInfo$(10000,2) ' holds number and path associated with them redim Subfolders$(5000) redim folders$(10000) redim foundfolders$(100) ' ------------populate the root folder location in the treeview TVINSERTSTRUCT.szText$.struct = PathSpec$ TVINSERTSTRUCT.hParent.struct = TV.ROOT calldll #user32, "SendMessageA",_ hwndTree as ulong,TVM.INSERTITEM as long,_ 0 as long,TVINSERTSTRUCT as struct,Root as ulong FolderInfo$(0,1)=str$(Root):FolderInfo$(0,2)=PathSpec$ '-------------- now loop thru and populate the folders under the root folder if right$(PathSpec$,1)<> "\" then PathSpec$ = PathSpec$ ; "\" files PathSpec$, dir$( fileCount= val(dir$(0,0)) folderCount=val(dir$(0, 1)) y=0 for x=fileCount+1 to fileCount + folderCount y=y+1 folders$(y)=dir$(x, 1) next c=folderCount for a = 1 to folderCount TVINSERTSTRUCT.szText$.struct = folders$(a) TVINSERTSTRUCT.hParent.struct = Root calldll #user32, "SendMessageA",_ hwndTree as ulong,TVM.INSERTITEM as long,_ 0 as long,TVINSERTSTRUCT as struct,ret as ulong FolderInfo$(a,1)=str$(ret):FolderInfo$(a,2)=PathSpec$;folders$(a) next a a=a-1 ' ------- now go back and populate the first level of subfolders for b = 1 to a NewPath$=PathSpec$;folders$(b) files NewPath$, dir$( fileCount= val(dir$(0,0)) SubfolderCount=val(dir$(0, 1)) y=0 for x=fileCount+1 to fileCount + SubfolderCount y=y+1 Subfolders$(y)=dir$(x, 1) TVINSERTSTRUCT.szText$.struct = Subfolders$(y) TVINSERTSTRUCT.hParent.struct = val(FolderInfo$(b,1)) calldll #user32, "SendMessageA",_ hwndTree as ulong,TVM.INSERTITEM as long,_ 0 as long,TVINSERTSTRUCT as struct,ret as ulong c=c+1 FolderInfo$(c,1)=str$(ret):FolderInfo$(c,2)= NewPath$;"\";Subfolders$(y) next x next b '----- Select and expand the root folder calldll #user32, "SendMessageA",_ hwndTree as ulong,TVM.SELECTITEM as long,_ TVGN.CARET as long,Root as ulong,ret as long calldll #user32, "SendMessageA",_ hwndTree as ulong,TVM.EXPAND as long,_ TVE.EXPAND as long,Root as ulong,ret as long' gosub [getFiles] selectedItem=Root ' set slectedItem to the Root folder [checkNode] ' ---------------check and see if the same node is selected TVITEM.hItem.struct = selectedItem TVITEM.mask.struct = TVIF.STATE or TVIF.HANDLE or TVIF.CHILDREN _ or TVIF.TEXT calldll #user32, "SendMessageA", hwndTree as ulong, TVM.GETITEMA as long, _ 0 as long, TVITEM as struct, ret as long if (TVITEM.state.struct<>TVIS.SELECTED) and (TVITEM.state.struct<>SelectedExpanded) then ' ----------------- if the node has changed find out which node is selected for i = 0 to c TVITEM.hItem.struct =val(FolderInfo$(i,1))' node(i) calldll #user32, "SendMessageA", hwndTree as long, TVM.GETITEMA as long, _ 0 as long, TVITEM as struct, ret as long if (TVITEM.state.struct=TVIS.SELECTED) or (TVITEM.state.struct=SelectedExpanded) then selectedItem =val(FolderInfo$(i,1)) 'node(i) OldselectedItem=selectedItem PathSpec$=FolderInfo$(i,2) if TVITEM.state.struct=TVIS.SELECTED and TVITEM.cChildren.struct=0 then gosub [getFolders] end if gosub [getFiles] exit for end if next i end if [wait] '------- we always endup here sooner or later Scan CallDLL #kernel32, "Sleep", _ 1 As Long, ret As Void if OpenFileName$<>"" then goto [OpenFile1] end if GoTo [checkNode] '---------- end fo part 1-------------- '-----------start of part2 [getFolders] ' get the current folder information and populate the treeview if right$(PathSpec$,1)<> "\" then PathSpec$ = PathSpec$; "\" files PathSpec$, "*.*", dir$() qtyFiles = val(dir$(0, 0)) qtySubDirs = val(dir$(0, 1)) redim foundfolders$(qtyFiles + qtySubDirs) f=0 for x = qtyFiles + 1 to qtyFiles + qtySubDirs f=f+1 foundfolders$(f)= dir$(x, 1) next x for a = 1 to f c=c+1 TVINSERTSTRUCT.szText$.struct = foundfolders$(a) TVINSERTSTRUCT.hParent.struct = selectedItem calldll #user32, "SendMessageA",_ hwndTree as ulong,TVM.INSERTITEM as long,_ 0 as long,TVINSERTSTRUCT as struct,ret as ulong FolderInfo$(c,1)=str$(ret):FolderInfo$(c,2)=PathSpec$;foundfolders$(a) next a return [getFiles] ' get file information for current folder and populate the listview TotalBytes=0 folder$=trim$(PathSpec$) if right$(folder$,1)<> "\" then folder$ = folder$; "\" files folder$, "*.*", dir$() qtyFiles = val(dir$(0, 0)) qtySubDirs = val(dir$(0, 1)) redim fname$(qtyFiles) redim ftype$(qtyFiles) redim fsize$(qtyFiles) redim fmod$(qtyFiles) redim foundfiles$(qtyFiles) redim foundfolders$(qtyFiles + qtySubDirs) f=1 for x = qtyFiles + 1 to qtyFiles + qtySubDirs foundfolders$(x)= dir$(x, 1) next x for y = 1 to qtyFiles foundfiles$(y)=dir$(y, 0);"*";dir$(y, 1);"*";dir$(y, 2) tempname$=word$(foundfiles$(y),1,"*") tempext$=word$(tempname$,2,".") if instr( includedfiles$(0),tempext$) > 0 and tempext$ > "" then foundfiles$(f)=foundfiles$(y) f=f+1 end if next y f=f-1:if f <0 then f = 0 if tosort = 0 and f > 0 then sort foundfiles$(),1 ,f if tosort = 1 and f > 0 then sort foundfiles$(),f ,1 a=0 for r = 1 to f if word$(foundfiles$(r),1,"*")> "" then fname$(a)=word$(foundfiles$(r),1,"*") fname$(a)=word$(fname$(a),1,".") ftype$(a)=word$(foundfiles$(r),2,".") ftype$(a)=".";word$(ftype$(a),1,"*") fsize$(a)=word$(foundfiles$(r),2,"*") fsize$(a)=Using("#####.#",(Val(fsize$(a))/1000));" kb" fmod$(a)=trim$(word$(foundfiles$(r),3,"*")) a=a+1 end if next r [populate] ' ------------- populate the file listview CallDLL #user32, "SendMessageA", _ hwndLV As long, LVM.DELETEALLITEMS As long, _ 0 As long,LVITEM As struct,r As long for a = 0 to f-1 LVITEM.mask.struct = LVIF.TEXT LVITEM.iItem.struct = a ' row LVITEM.iSubItem.struct = 0 LVITEM.pszText$.struct = fname$(a) CallDLL #user32, "SendMessageA", _ hwndLV As long,LVM.INSERTITEM As long, _ 0 As long,LVITEM As struct,r As long LVITEM.iItem.struct = a LVITEM.iSubItem.struct = 1 LVITEM.pszText$.struct = ftype$(a) CallDLL #user32, "SendMessageA", _ hwndLV As long,LVM.SETITEM As long, _ 0 As long,LVITEM As struct,r As long LVITEM.iItem.struct = a LVITEM.iSubItem.struct = 2 LVITEM.pszText$.struct = fsize$(a) CallDLL #user32, "SendMessageA", _ hwndLV As long,LVM.SETITEM As long, _ 0 As long,LVITEM As struct,r As long LVITEM.iItem.struct = a LVITEM.iSubItem.struct = 3 LVITEM.pszText$.struct = fmod$(a) CallDLL #user32, "SendMessageA", _ hwndLV As long,LVM.SETITEM As long, _ 0 As long,LVITEM As struct,r As long next a return [SaveDefaults] ' - save default folder info to defaults file a=0:b=0:c=0 if right$(PathSpec$,1)<>"\" then PathSpec$=PathSpec$;"\" open "defaults.txt" for output as #1 #1, PathSpec$ close #1 goto [wait]
[browse]' ----- select new default folder STRUCT BrowseInfo,_ hWndOwner As uLong, pIDLRoot As Long, pszDisplayName As Long,_ lpszTitle$ As ptr, ulFlags As uLong, lpfn1Callback As Long,_ lParam As Long, iImage As Long txt1$="Set Default Data Folder" + chr$(13) txt1$=txt1$+"Please choose a folder!" BrowseInfo.lpszTitle$.struct = txt1$ BrowseInfo.hWndOwner.struct = 0 BrowseInfo.ulFlags.struct = 64 calldll #shell32, "SHBrowseForFolder",_ BrowseInfo as struct, lpIDList as long sPath$ = space$(_MAX_PATH) + chr$(0) calldll #shell32, "SHGetPathFromIDList",_ lpIDList as long,sPath$ as ptr,r as boolean open "ole32" for dll as #ole 'free the block of memory calldll #ole, "CoTaskMemFree",_ lpIDList as long, r as void close #ole iNull = InStr(sPath$, chr$(0)) If iNull Then sPath$ = Left$(sPath$, iNull - 1) End If if sPath$ <> "" then PathSpec$ = sPath$ end if CallDLL #user32, "SendMessageA", _ hwndTree As long, _ TVM.DELETEITEM As long, _ 0 as ulong,_ Root as Ulong,_ r As long goto [start] [OpenFile] ' code used to select file to be opened with double click openfile=1 goto [choice] [OpenFile1] if OpenFileName$="" then Notice "You must Select a File To Open" goto [wait] end if call ShellExecute 0, OpenFileName$,_SW_MAXIMIZE, "open" OpenFileName$="" goto [wait] [choice] '--------------determine user's selection from File listview if right$(PathSpec$,1)<> "\" then PathSpec$ = PathSpec$; "\" file$="" m1 = 0 'get number of items in list: CallDLL #user32, "SendMessageA", _ hwndLV As long, _ LVM.GETITEMCOUNT As long, _ 0 As long, _ 'always 0 0 As long, _ 'always 0 total As long redim txt$(total+1,2) redim FileData$(total+1) for index = 0 to total-1 'check each row LVITEM.mask.struct = LVIF.TEXT OR LVIF.STATE LVITEM.iItem.struct = index 'row LVITEM.iSubItem.struct = 0 'second column LVITEM.cchTextMax.struct = 132 LVITEM.pszText$.struct = space$(132) LVITEM.stateMask.struct = LVIS.SELECTED CallDLL #user32, "SendMessageA", _ hwndLV As long, _ LVM.GETITEMA As long, _ index As long, _ 'index of row LVITEM As struct, _ r As long state = LVITEM.state.struct 'selected state of item if state and LVIS.SELECTED then txt$(index,1)=winstring(LVITEM.pszText$.struct) LVITEM.iItem.struct = index 'row LVITEM.iSubItem.struct = 1 'first column CallDLL #user32, "SendMessageA", _ hwndLV As long, _ LVM.GETITEMA As long, _ index As long, _ 'index of row LVITEM As struct, _ r As long txt$(index,2)=winstring(LVITEM.pszText$.struct) end if next index for m=0 to index file$=txt$(m,1);txt$(m,2) if file$>"" then m1=m1+1 FileData$(m1)= PathSpec$;file$ end if next m if openfile then openfile=0 OpenFileName$= FileData$(1) end if goto [wait] [quit] if HookDll=1 then calldll #MsgHook, "UnhookMsgHook", hHook as long, ret as void close #MsgHook end if close #main end '------------------------------------start of part 3 [setup] struct TVITEM,_ mask as ulong,hItem as ulong,state as ulong,stateMask as ulong,szText$ as ptr,_ cchTextMax as long,iImage as long,iSelectedImage as long,cChildren as long,lParam as long struct TVINSERTSTRUCT,_ hParent as ulong,hInsertAfter as ulong,mask as ulong,hItem as ulong,state as ulong, stateMask as ulong,_ szText$ as ptr,cchTextMax as long,iImage as long,iSelectedImage as long,cChildren as long,lParam as long WS.EX.CLIENTEDGE = 512 TV.ROOT = 0 : TVSIL.NORMAL = 0 TVE.EXPAND = 2 TVE.COLLAPSE = 1 TVE.COLLAPSERESET = 32768 TVS.HASBUTTONS = 1 : TVS.HASLINES = 2 TVS.LINESATROOT = 4 : TVS.SHOWSELALWAYS = 32 TVS.SINGLEEXPAND = 1024 TVIF.TEXT = 1 : TVIF.IMAGE = 2 TVIF.PARAM = 4 : TVIF.STATE = 8 TVIF.HANDLE = 16 : TVIF.SELECTEDIMAGE = 32 TVIF.CHILDREN = 64 TVM.INSERTITEM = 4352 : TVM.SETINDENT = 4359 TVM.SETIMAGELIST = 4361 : TVM.GETNEXTITEM = 4362 TVM.SELECTITEM = 4363 : TVM.GETITEMA = 4364 TVM.EXPAND= 4354 : TVM.DELETEITEM = 4353 TVM.SORTCHILDREN = 4371 TVIS.SELECTED = 2 : TVGN.PARENT = 3 TVIS.EXPANDED = 32 : TVGN.FIRSTVISIBLE = 5 TVIS.EXPANDEDONCE = 64 : TVGN.CARET = 9 SelectedExpanded = TVIS.SELECTED or TVIS.EXPANDED or TVIS.EXPANDEDONCE 'constants LVS.NOSORTHEADER = 32768 LVS.REPORT = 1 LVS.SINGLESEL = 4 LVS.SHOWSELALWAYS = 8 LVS.SORTASCENDING = 16 LVS.SORTDESCENDING = 32 LVS.NOLABELWRAP = 128 LVS.AUTOARRANGE = 256 LVS.NOSCROLL = 8192 LVS.ALIGNTOP = 0 LVS.ALIGNLEFT = 2048 LVS.NOCOLUMNHEADER = 16384 LVIF.TEXT = 1 LVIF.STATE = 8 LVIS.UNSELECTED = 0 LVIS.FOCUSED = 1 LVIS.SELECTED = 2 LVM.FIRST = 4096 LVM.SETITEM = 4102 LVM.INSERTITEM = 4103 LVM.INSERTCOLUMN = 4123 LVM.GETITEMCOUNT = 4100 LVM.GETITEMA = 4101 LVM.GETITEMTEXTA = 4141 LVM.GETITEMSTATE = 4138 LVM.SETITEMSTATE = 4139 LVM.DELETEITEM = 4104 LVM.DELETEALLITEMS = 4105 LVM.ENSUREVISIBLE = 4115 'LVM.FIRST + 19 LVCF.WIDTH = 2 LVCF.TEXT = 4 FOMOVE = hexdec("&H1") FOCOPY = hexdec("&H2") FODELETE = hexdec("&H3") FORENAME = hexdec("&H4") FOFRENAMEONCOLLISION = hexdec("&H8") FOFNOCONFIRMATION = hexdec("&H10") FOFSIMPLEPROGRESS = hexdec("&H100") FOFALLOWUNDO = hexdec("&H40") 'create structs struct SHFILEOPSTRUCT,_ hWnd As uLong,_ wFunc As Long,_ pFrom As ptr,_ pTo As ptr,_ fFlags As long,_ fAborted As long,_ hNameMaps As Long,_ sProgress As ptr Struct LVCOLUMN, _ mask As ulong, _ fmt As long, _ cx As long, _ pszText$ As ptr, _ cchTextMax As long, _ iSubItem As long, _ iImage As long, _ iOrder As long Struct LVITEM, _ mask As ulong, _ iItem As long, _ iSubItem As long, _ state As ulong, _ stateMask As ulong, _ pszText$ As ptr, _ cchTextMax As long, _ iImage As long, _ lParam As long, _ iIndent As long calldll #comctl32, "ImageList_Create",_ 16 as long,_ 'width of each image 16 as long,_ 'height of each image 0 as ulong,_ 'color behavior 2 as long,_ 'initial number of images 10 as long,_ 'number of images that can be added hImageList as ulong calldll #user32, "LoadImageA",_ 0 as ulong,_ "folder.ico" as ptr,_ 'filename of image _IMAGE_ICON as ulong,_ 'type of image 16 as long,_ 'width 16 as long,_ 'height _LR_LOADFROMFILE as ulong,_ 'load flags hIcon1 as ulong 'handle of loaded image calldll #comctl32, "ImageList_ReplaceIcon",_ hImageList as ulong,_ 'handle to image list -1 as long,_ 'index of image to replace hIcon1 as ulong,_ 'handle of icon folderImage as long 'returns index of image calldll #user32, "LoadImageA",_ 0 as ulong,_ "folderopen.ico" as ptr,_ 'filename of image _IMAGE_ICON as ulong,_ 'type of image 16 as long,_ 'width 16 as long,_ 'height _LR_LOADFROMFILE as ulong,_ 'load flags hIcon2 as ulong 'handle of loaded image calldll #comctl32, "ImageList_ReplaceIcon",_ hImageList as ulong,_ 'handle to image list -1 as long,_ 'index of image to replace hIcon2 as ulong,_ 'handle of icon folderOpenImage as long 'returns index of image return '--------- Functions and Subs ------------------------- Sub ShellExecute hWnd, file$, parameter, lpszOp$ lpszFile$ = chr$(34)+file$+chr$(34) lpszDir$ = DefaultDir$ lpszParams$="" CallDLL #shell32, "ShellExecuteA", hWnd As long,_ lpszOp$ As ptr,lpszFile$ As ptr,_ lpszParams$ As ptr,lpszDir$ As ptr,_ parameter As long, result As long End Sub function fileExists(fullPath$) files pathOnly$(fullPath$), filenameOnly$(fullPath$), dir$() fileExists = val(dir$(0, 0)) > 0 end function function pathOnly$(fullPath$) pathOnly$ = fullPath$ while right$(pathOnly$, 1) <> "\" and pathOnly$ <> "" pathOnly$ = left$(pathOnly$, len(pathOnly$)-1) wend end function function filenameOnly$(fullPath$) pathLength = len(pathOnly$(fullPath$)) filenameOnly$ = right$(fullPath$, len(fullPath$)-pathLength) end function
|
|