Jump to content

Recommended Posts

Posted (edited)

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
  • Moderators
Posted

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:

  Reveal hidden contents

 

Posted

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

Posted (edited)

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
Posted

  On 12/20/2010 at 7:52 AM, 'Yashied said:

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

Posted

  On 12/20/2010 at 1:42 AM, 'jaberwocky6669 said:

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

Posted

  On 12/20/2010 at 9:12 PM, 'Beege said:

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

_WinAPI_SetWindowLongEx() from WinAPIEx UDF.

  On 12/20/2010 at 9:12 PM, 'Beege said:

How did you spot that btw?

I just opened/returned the System32 folder many times. Windows Task Manager showed an increase of the memory.
  • Moderators
Posted

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:

  Reveal hidden contents

 

Posted (edited)

  On 12/21/2010 at 9:12 AM, 'Melba23 said:

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
  • Moderators
Posted

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:

  Reveal hidden contents

 

  • Moderators
Posted

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:

  Reveal hidden contents

 

Posted

  On 12/21/2010 at 3:40 PM, 'Melba23 said:

Beege,

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

M23

Thats Excellent! Thanks Melba23Posted Image

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

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:

  Reveal hidden contents

Signature last update: 2023-04-24

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
  • Recently Browsing   0 members

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