Noddle Posted February 24, 2013 Posted February 24, 2013 Hi is there a way to make FileOpenDialog show the files listed in a "thumbnail" view by defaut without clicking on the "view menu" button to select "thumbnails' i'm working with images.. $var = FileOpenDialog($message, $_RunningPath & "", "Images (*.jpg)", 1 + 4) thanks for anyhelp, Nigel
johnmcloud Posted February 24, 2013 Posted February 24, 2013 (edited) expandcollapse popup#include <WindowsConstants.au3> #include <WinAPI.au3> #include "_FileDialogsEx.au3" Global $f_CDN_Start = 1 $Return = _FileOpenDialogEx("", @WindowsDir & "\Web\Wallpaper", "All Files (*.*)", BitOR($OFN_ENABLESIZING,$OFN_ALLOWMULTISELECT), "", 0, "_OFN_HookProc") If @error Then ConsoleWrite('No file selected.' & @CRLF) Else ConsoleWrite($Return & @CRLF) EndIf Func _OFN_HookProc($hWnd, $Msg, $wParam, $lParam) Switch $Msg Case $WM_NOTIFY Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR $tNMHDR = DllStructCreate("hwnd hWndFrom;int idFrom;int code", $lParam) $hWndFrom = DllStructGetData($tNMHDR, "hWndFrom") $iIDFrom = DllStructGetData($tNMHDR, "idFrom") $iCode = DllStructGetData($tNMHDR, "code") Switch $iCode Case $CDN_INITDONE Case $CDN_FOLDERCHANGE If $f_CDN_Start Then;if executing first time Local $hODLV = _FindWindowEx($hWndFrom, 0, "SHELLDLL_DefView", "") If $hODLV <> 0 Then DllCall('user32.dll','int','SendMessage','hwnd',$hODLV,'uint',$WM_COMMAND,'wparam',$ODM_VIEW_THUMBS,'lparam',0) EndIf WinMove($hWndFrom, "", 0,0, 400, 200, 0) $f_CDN_Start = 0;to make sure these tweaks happens only once. EndIf Case $CDN_SELCHANGE Case $CDN_FILEOK EndSwitch Case Else EndSwitch EndFunc Func _FindWindowEx($hWndParent,$hWndChildAfter,$sClassName,$sWinTitle="") Local $aRet = DllCall('user32.dll','hwnd','FindWindowEx', 'hwnd', $hWndParent,'hwnd',$hWndChildAfter,'str',$sClassName,'str',$sWinTitle) If $aRet[0] = 0 Then ConsoleWrite('_FindWindowEx() Error : ' & _WinAPI_GetLastErrorMessage()) Return $aRet[0] EndFunc Exit Edited February 24, 2013 by johnmcloud
Noddle Posted February 25, 2013 Author Posted February 25, 2013 This will not run, it uses @Unicodein the changlog for Auto it, it says this16th May, 2008 - v3.2.12.0AutoIt:Changed: @Unicode renamed to @AutoItUnicode. @Unicode is an alias for now. It will be removed > 3.2.14.0so I go to use @AutoitUnicode, it still will not work,so more time on Google, I found this,3.2.13.1 (10th June, 2008) (Beta)AutoIt:- Removed #357: @AutoItUnicode macro.So it looks like this has not worked for a long time..so has anyone else have any ideas how to do what I want ?Nigel
johnmcloud Posted February 25, 2013 Posted February 25, 2013 Change @Unicode with "" and magically it work...
KaFu Posted February 25, 2013 Posted February 25, 2013 Here's an adjusted version: Â OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13)Â BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16)Â ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2025-May-18) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
johnmcloud Posted February 25, 2013 Posted February 25, 2013 (edited) KaFu, On that example there isn't the type mode ( Detail, Thumbs etc. ) Based on your modified version: expandcollapse popup#include "_FileDialogsEx.au3" Global Const $CBN_SELCHANGE = 1 Global $__aDialogDef[3] $__aDialogDef[0] = "Export to" $__aDialogDef[1] = "Export" $__aDialogDef[2] = "Cancel" Global $Type = $ODM_VIEW_THUMBS $Output = _FileSaveDialogEx("", @WindowsDir & "\Web\Wallpaper", "All Files (*.*)", BitOR($OFN_OVERWRITEPROMPT, $OFN_PATHMUSTEXIST, $OFN_DONTADDTORECENT), "", 0, "_HookProc") $__aDialogDef[0] = "Save as" $__aDialogDef[1] = "Save" $__aDialogDef[2] = "Cancel" Global $Type = $ODM_VIEW_ICONS $Output = _FileSaveDialogEx("", @MyDocumentsDir, "Text Files (*.txt)", BitOR($OFN_OVERWRITEPROMPT, $OFN_PATHMUSTEXIST, $OFN_DONTADDTORECENT), "", 0, "_HookProc") $__aDialogDef[0] = "Open File" $__aDialogDef[1] = "Open" $__aDialogDef[2] = "Cancel" Global $Type = $ODM_VIEW_LIST $Output = _FileOpenDialogEx("", @MyDocumentsDir, "Text Files (*.txt)", BitOR($OFN_FILEMUSTEXIST, $OFN_PATHMUSTEXIST, $OFN_ALLOWMULTISELECT), "", 0, "_HookProc") $__aDialogDef[0] = "Import File" $__aDialogDef[1] = "Import" $__aDialogDef[2] = "Cancel" Global $Type = $ODM_VIEW_TILES $Output = _FileOpenDialogEx("", @MyDocumentsDir, "Text Files (*.txt)", BitOR($OFN_FILEMUSTEXIST, $OFN_PATHMUSTEXIST, $OFN_ALLOWMULTISELECT), "", 0, "_HookProc") Func _HookProc($hWnd, $Msg, $wParam, $lParam) Switch $Msg Case $WM_INITDIALOG Local $hDlg = _WinAPI_GetParent($hWnd) _SendMessage($hDlg, $CDM_SETCONTROLTEXT, $IDOK, $__aDialogDef[1], 0, "int", "wstr") _SendMessage($hDlg, $CDM_SETCONTROLTEXT, $IDCANCEL, $__aDialogDef[2], 0, "int", "wstr") ControlCommand($hDlg, "", '[CLASS:ComboBox;Instance:3]', "AddString", 'ANSI') $aWinSize = WinGetPos($hDlg, "") WinMove($hDlg, "", @DesktopWidth / 2 - $aWinSize[2] / 2, @DesktopHeight / 2 - $aWinSize[3] / 2) WinSetTitle($hDlg, "", $__aDialogDef[0]) Case $WM_COMMAND Local $hComboEnc = ControlGetHandle($hWnd, "", '[CLASS:ComboBox;Instance:3]') Local $iCode = BitShift($wParam, 16) If $lParam = $hComboEnc And $iCode = $CBN_SELCHANGE Then $sEncoding = ControlCommand($hWnd, "", '[CLASS:ComboBox;Instance:3]', "GetCurrentSelection", "") EndIf ConsoleWrite($sEncoding & @CRLF) Case $WM_NOTIFY Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR $tNMHDR = DllStructCreate("hwnd hWndFrom;int idFrom;int code", $lParam) $hWndFrom = DllStructGetData($tNMHDR, "hWndFrom") $iIDFrom = DllStructGetData($tNMHDR, "idFrom") $iCode = DllStructGetData($tNMHDR, "code") Switch $iCode Case $CDN_INITDONE Case $CDN_FOLDERCHANGE Local $aRet = DllCall('user32.dll', 'hwnd', 'FindWindowEx', 'hwnd', $hWndFrom, 'hwnd', 0, 'str', "SHELLDLL_DefView", 'str', "") If $aRet[0] = 0 Then ConsoleWrite("_FindWindowEx Error") Else DllCall('user32.dll', 'int', 'SendMessage', 'hwnd', $aRet[0], 'uint', $WM_COMMAND, 'wparam', $Type, 'lparam', 0) EndIf EndSwitch EndSwitch EndFunc ;==>_HookProc I don't know how to make a Func parameter for: $ODM_VIEW_ICONS = 0x7029 $ODM_VIEW_LIST = 0x702b $ODM_VIEW_DETAIL = 0x702c $ODM_VIEW_THUMBS = 0x702d $ODM_VIEW_TILES = 0x702e Edited February 25, 2013 by johnmcloud
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now