Jump to content

Explorer Frame UDF - Updated 1-21-11


Beege
 Share

Recommended Posts

Update 1/21/11 - Add support for custom icons (Thanks Yashied). Right now file types '.exe', '.ico', '.lnk' will work. Can anyone think of other file types that might have a custom icons?

Update 12/21/10 - Removed extra _FLTA call. thanks jaberwocky6669

- Added extra styles to Listview. Changed formating of Drive Labels. Thanks Yashied

- TAB stop still not working and still searching for memory leak pointed out by Yashied.

- fixed another potential bug when trying to navigate to empty media like CDROM. Thanks Melba23

*- New GUIFrame has been updated to support x64 so be sure to get the new one.

Updated 12/19/10 - fixed bug displaying empty drives in 'My Computer'. (Thanks Melba23 Posted Image)

Ever since Melba23 released GUIFrame I have been wanting to rewrite my Explorer Listview UDF for frames. So here it is.

This UDF takes any frame created by GUIFrame and turns it into a MS-Windows like Explorer window. Each frame is populated with a Listview, address bar, back button and status bar.

These are the tasks the UDF will handle for the following Ctrls:

Listview:

- Double click navigation

- Column Header Right Click menu for selecting which columns to display

- Sorting functions for all columns

- formating of date displays

- Parent folder ( [..] ) is automatically added to each directory navigated to.

Comboboxes:

- type any directory into the address bar and press enter to navigate

- directory navigation is auto added to the combobox drop down menu

Status bars:

- Status bar folder stats are automatically updated

All history navigation is also handeled. In future I wont to work on a way to have back and fwd navigation. currently only back.

Special thanks go to Melba23 for GUIFrame. Thank You!

Zip file includes two examples and UDF. Please let me know if you have any trouble of any kind or any ideas. I love all feedback. Thanks for looking.

post-8949-0-37010100-1292784328_thumb.gi

ExpFrame 1-21-11.zip

Previous Downloads:125

GUIFrame can be found

Example 1

#include "ExpFrame.au3"

;Create GUI
$hGUI_1 = GUICreate("GUI Frames", 600, 200, 100, 100, $WS_OVERLAPPEDWINDOW)

;Create Frames
$iFrame_A = _GUIFrame_Create($hGUI_1)

;Set min sizes for the frames
_GUIFrame_SetMin($iFrame_A, 100, 100)

;Create Explorer Listviews
_GUIFrame_Switch($iFrame_A, 1)
$LocalList = _ExpFrame_Create(_GUIFrame_GetHandle($iFrame_A, 1))
_GUIFrame_Switch($iFrame_A, 2)
$LocalList2 = _ExpFrame_Create(_GUIFrame_GetHandle($iFrame_A, 2), 'c:\')

;Register functions for Windows Message IDs needed.
GUIRegisterMsg($WM_SIZE, "_ExpFrame_WMSIZE_Handler")
GUIRegisterMsg($WM_NOTIFY, "_ExpFrame_WMNotify_Handler")
GUIRegisterMsg($WM_COMMAND, '_ExpFrame_WMCOMMAND_Handler')

; Set resizing flag for all created frames
_GUIFrame_ResizeSet(0)

GUISetState(@SW_SHOW, $hGUI_1)

While 1
    $nMsg = GUIGetMsg()
    _ExpFrame_GUIGetMsg($nMsg);<< Dont forget to pass msg to _ExpFrame_GUIGetMsg!!
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd
Edited by Beege
Link to comment
Share on other sites

  • Moderators

Beege,

Cracking UDF! :x

However, to pay you back for your various bug reports and feature requests on GUIFrame.... :P

I have a system with a number of card readers and your UDF demands that I have some media in them to work. I have managed to get round it by amending your __DirSetMyComputer function to avoid trying to access these drives when they have no media like this:

Func __DirSetMyComputer($iIndex)

    If $g_aExpFrames[$iIndex][$g_sCurrentDir] <> 'My Computer' Then __Columns_GetWidths($iIndex)
    $g_aExpFrames[$iIndex][$g_sCurrentDir] = 'My Computer'
    _GUICtrlListView_DeleteAllItems($g_aExpFrames[$iIndex][$g_hListView])
    __Columns_SetWidths($iIndex, True)

    Local $drives = DriveGetDrive("ALL")
    Local $iIcon, $sItem, $iItem, $sName, $iSpace, $iAvailable, $iTotalAvailable, $iTotalSize, $iIconIndex = 0
    For $i = 1 To $drives[0]

        $sName = DriveGetLabel($drives[$i] & '\') & ' (' & StringUpper($drives[$i]) & ')'
        $sItem = $sName
        $iIcon = __GUIImageList_GetFileIconIndex($drives[$i] & '\')

        If DriveStatus($drives[$i] & '\') <> "NOTREADY" Then ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

            $iSpace = DriveSpaceTotal($drives[$i]) * 1048576;Space
            $iAvailable = DriveSpaceFree($drives[$i]) * 1048576; Avalible
            $iTotalSize += $iSpace
            $iTotalAvailable += $iAvailable

            If BitAND($g_aExpFrames[$iIndex][$g_iCompCol], 1) Then $sItem &= '|' & __FormatSize($iSpace)
            If BitAND($g_aExpFrames[$iIndex][$g_iCompCol], 2) Then $sItem &= '|' & __FormatSize($iAvailable)
            If BitAND($g_aExpFrames[$iIndex][$g_iCompCol], 4) Then $sItem &= '|' & DriveGetType($drives[$i]);type
            If BitAND($g_aExpFrames[$iIndex][$g_iCompCol], 8) Then;Attributes
                If DriveGetType($drives[$i] & '\') <> 'CDROM' Then $sItem &= '|' & FileGetAttrib($drives[$i] & '\')
            EndIf

        EndIf ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

        $iItem = GUICtrlCreateListViewItem('', $g_aExpFrames[$iIndex][$g_ListView])
        GUICtrlSetData($iItem, $sItem);Use GUICtrlSetData to avoid columns being auto resized.
        _GUICtrlListView_SetItem($g_aExpFrames[$iIndex][$g_ListView], $sName, $iIconIndex, 0, $iIcon);set icon index
        $iIconIndex += 1
    Next

    _GUICtrlStatusBar_SetText($g_aExpFrames[$iIndex][$g_hStatusbar], @TAB & $drives[0] & ' Drives, ' & __FormatSize($iTotalAvailable) & ' Free of ' & __FormatSize($iTotalSize) & @TAB, 0, 0)
    __ComboHistoryAdd($g_aExpFrames[$iIndex][$g_idCombo], $g_aExpFrames[$iIndex][$g_sCombo], 'My Computer')

    Return 1

With that small fix I have no more problems. You will know whether that might cause problems elsewhere - I hope not because it is a very simple solution. :shifty:

Sorry to come up with a problem so quickly, but I could not get it to work and see how good it is unless I fixed it! :nuke:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Melba23,

Thank you very much for the feedback and bug report. I will make those changes right away! Cant have a error the very second it starts! Posted Image

Link to comment
Share on other sites

Nicely done Beege. But there are a few comments:

  • Why do you use icons from the system image list? As a result, custom icons does not displayed (.exe, .ico, .lnk, etc). Look at _WinAPI_ShellExtractAssociatedIcon() function from WinAPIEx UDF.
  • If you are using a system image list, you should use LVS_SHAREIMAGELISTS flag (I think).
  • ExpFrame UDF will work only in x86 OS. It's inherited from GUIFrame UDF (_WinAPI_SetWindowLong()).
  • There is a small memory leak.
  • Does not work TAB key (WS_TABSTOP).
  • You should not use Sleep(1). This dramatically reduces the processing speed.
  • What happen if the disk label is "System (XP)"? May be better to replace

    $sChangeDir = StringMid($sItemText, StringInStr($sItemText, '(') + 1, 2) & '\'

    to

    $sChangeDir = StringMid($sItemText, StringInStr($sItemText, ':') - 1, 2) & '\'
Edited by Yashied
Link to comment
Share on other sites

Nicely done Beege. But there are a few comments:

  • Why do you use icons from the system image list? As a result, custom icons does not displayed (.exe, .ico, .lnk, etc). Look at _WinAPI_ShellExtractAssociatedIcon() function from WinAPIEx UDF.
  • If you are using a system image list, you should use LVS_SHAREIMAGELISTS flag (I think).
  • ExpFrame UDF will work only in x86 OS. It's inherited from GUIFrame UDF (_WinAPI_SetWindowLong()).
  • There is a small memory leak.
  • Does not work TAB key (WS_TABSTOP).
  • You should not use Sleep(1). This dramatically reduces the processing speed.
  • What happen if the disk label is "System (XP)"? May be better to replace

    $sChangeDir = StringMid($sItemText, StringInStr($sItemText, '(') + 1, 2) & '\'

    to

    $sChangeDir = StringMid($sItemText, StringInStr($sItemText, ':') - 1, 2) & '\'
Yashied, Thankyou very much for the feedback!

- Very good point about the custom icons. I will start looking into other ways to implement that.

- $LVS_SHAREIMAGELISTS will be added to the style.

- Do you know of any way I can make this x64 compatible?

- Any suggestion on how I can find the memory leak? How did you spot that btw?

- The sleep(1) is only executed every 250ms so it really shouldn't be causing a performance hit. Its just there to keep the GUI from not responding when Im populating a large directory. Come to think of it, that might have been a bit of code from my "FTP Explorer" program. I think Ill remove it..

- I'm a little confused about the TABs but will look more at it tonight.

- I Will defiantly make the changes about the $changedir string. Good idea! Thanks

Link to comment
Share on other sites

In your function __DirSetCurrent you have a variable declared after it's first use:

$aList = __FLTA($sDirectory)
Local $aList = __FLTA($sDirectory)

jaberwocky6669, Thank you for pointing that out! Don't know how I did that.Posted Image

Link to comment
Share on other sites

Do you know of any way I can make this x64 compatible?

_WinAPI_SetWindowLongEx() from WinAPIEx UDF.

How did you spot that btw?

I just opened/returned the System32 folder many times. Windows Task Manager showed an increase of the memory.
Link to comment
Share on other sites

  • Moderators

Yashied,

Is it as simple as replacing _WinAPI_SetWindowLong with _WinAPI_SetWindowLongEx in the GUIFrame UDF? Or do I also have to cast the new WndProc pointer in a different form? And if so, how? :x

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Is it as simple as replacing _WinAPI_SetWindowLong with _WinAPI_SetWindowLongEx in the GUIFrame UDF?

Yes.

And replace

DllCallbackRegister("_GUIFrame_SepWndProc", "int", "hwnd;uint;wparam;lparam")

to

DllCallbackRegister("_GUIFrame_SepWndProc", "lresult", "hwnd;uint;wparam;lparam")
Edited by Yashied
Link to comment
Share on other sites

  • Moderators

Yashied,

Thanks. I have aready amended the UDF code and aim put out the new version later today. :P

I have extracted the function rather than add the whole #include file - still crediting you as the author of course. Are you happy with that? :x

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

Beege,

New GUIFrame version posted. One problem sorted at least! :x

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Beege,

New GUIFrame version posted. One problem sorted at least! :x

M23

Thats Excellent! Thanks Melba23Posted Image

Link to comment
Share on other sites

  • 1 month later...
  • 2 years later...
  • 3 years later...

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...