Jump to content
Sign in to follow this  
myspacee

WinSetOnTop FileOpenDialog

Recommended Posts

myspacee

hello,

can't set on top using my code :

$message = "Choose profile to join with " & $focused_window

        $var = FileOpenDialog($message, @ScriptDir & "\", "xpadderprofile (*.xpadderprofile)", 1 + 4 )
        WinSetOnTop($message, "", 1)

can help to correct it ?

m.

Share this post


Link to post
Share on other sites
PsaltyDS

hello,

can't set on top using my code :

$message = "Choose profile to join with " & $focused_window

        $var = FileOpenDialog($message, @ScriptDir & "\", "xpadderprofile (*.xpadderprofile)", 1 + 4 )
        WinSetOnTop($message, "", 1)

can help to correct it ?

m.

It doesn't work because the script is blocked while the FileOpenDialog() window is open. The next line is not executed until the selection is completed and the window closed.

Since AutoIt is single threaded, there is no way to operate on that window with the same process that launched it, same with MsgBox().

There are gimicks that can be used to launch a separate process to operate on your dialog, like run a batch file just before opening the window.

:P


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
FireFox

I think there is kind of UDF or DllCall for do that...

Cheers, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
Authenticity

I believe AdlibEnable with 500 ms is sufficient for the "Open file" dialog box and then executing the code in the adlib function, supposed to work.

Share this post


Link to post
Share on other sites
MrCreatoR

This method can do the trick:

$Message = "Choose profile to join with " ;& $focused_window

_FileOpenDialog($Message, @ScriptDir & "\", "xpadderprofile (*.xpadderprofile)", 1 + 4, "", 1)

Func _FileOpenDialog($sTitle, $sInitDir, $sFilter, $iOptions=0, $sDefaultName="", $iOnTopOrhWnd=0)
    Local $hWnd_GUI = $iOnTopOrhWnd
    
    If $iOnTopOrhWnd = 1 Then
        $hWnd_GUI = GUICreate("", 0, 0, 0, 0)
        WinSetOnTop($hWnd_GUI, "", 1)
    EndIf
    
    Local $sRet = FileOpenDialog($sTitle, $sInitDir, $sFilter, $iOptions, $sDefaultName, $hWnd_GUI)
    
    If $iOnTopOrhWnd = 1 Then GUIDelete($hWnd_GUI)
    
    Return SetError(@error, @extended, $sRet)
EndFunc
Edited by MrCreatoR

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites
PsaltyDS

This method can do the trick:

$Message = "Choose profile to join with ";& $focused_window

_FileOpenDialog($Message, @ScriptDir & "\", "xpadderprofile (*.xpadderprofile)", 1 + 4, "", 1)

Func _FileOpenDialog($sTitle, $sInitDir, $sFilter, $iOptions=0, $sDefaultName="", $iOnTopOrhWnd=0)
    Local $hWnd_GUI = $iOnTopOrhWnd
    
    If $iOnTopOrhWnd = 1 Then
        $hWnd_GUI = GUICreate("", 0, 0, 0, 0)
        WinSetOnTop($hWnd_GUI, "", 1)
    EndIf
    
    Local $sRet = FileOpenDialog($sTitle, $sInitDir, $sFilter, $iOptions, $sDefaultName, $hWnd_GUI)
    
    If $iOnTopOrhWnd = 1 Then GUIDelete($hWnd_GUI)
    
    Return SetError(@error, @extended, $sRet)
EndFunc
Neat trick! Sets the OnTop property on an invisible parent GUI and makes the dialog a child of that.

:unsure:

I believe AdlibEnable with 500 ms is sufficient for the "Open file" dialog box and then executing the code in the adlib function, supposed to work.

This method doesn't work because when AutoIt calls the external dialog, AdLibEnable() is not allowed to interrupt:
AdlibEnable("_MakeOnTop", 100)
Global $sWinTitle = "WinTitle"
Global $sRet = FileOpenDialog($sWinTitle, @ScriptDir, "(*.*)", 1+4)
ConsoleWrite("$sRet = " & $sRet & @LF)

Func _MakeOnTop()
    $hWND = WinGetHandle("[CLASS:#32770; TITLE:" & $sWinTitle & "]", "") 
    If IsHWnd($hWND) Then 
        ConsoleWrite("Window found, setting on top..." & @LF)
        WinActivate($hWND)
        WinSetOnTop($hWND, "", 1)
    Else
        ConsoleWrite("Window not found, waiting for dialog..." & @LF)
    EndIf
EndFunc

:P

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
rover

@myspacee

if you're feeling adventurous you can use a custom FileOpen dialog

this gives you the option to set dialog with topmost z-order, centre on your gui form or desktop,

change text of dialog labels or hide unwanted controls etc.

this example is a modification of Siao's post:

File Open/Save Dialogs customization

http://www.autoitscript.com/forum/index.php?showtopic=64057

more info: _WinAPI_GetOpenFileName() and $tagOPENFILENAME in StructureConstants Management section of help file

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <WindowsConstants.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

;=
; Customizable File Open/Save dialogs
; by Siao
;=

#Region OFN Constants
;~ already declared in WinAPI.au3
;~ Global Const $OFN_ALLOWMULTISELECT = 0x200
;~ Global Const $OFN_CREATEPROMPT = 0x2000
;~ Global Const $OFN_DONTADDTORECENT = 0x2000000
;~ Global Const $OFN_ENABLEHOOK = 0x20
;~ Global Const $OFN_ENABLEINCLUDENOTIFY = 0x400000
;~ Global Const $OFN_ENABLESIZING = 0x800000
;~ Global Const $OFN_ENABLETEMPLATE = 0x40
;~ Global Const $OFN_ENABLETEMPLATEHANDLE = 0x80
;~ Global Const $OFN_EXPLORER = 0x80000
;~ Global Const $OFN_EXTENSIONDIFFERENT = 0x400
;~ Global Const $OFN_EX_NOPLACESBAR = 0x1
;~ Global Const $OFN_FILEMUSTEXIST = 0x1000
;~ Global Const $OFN_FORCESHOWHIDDEN = 0x10000000
;~ Global Const $OFN_HIDEREADONLY = 0x4
;~ Global Const $OFN_LONGNAMES = 0x200000
;~ Global Const $OFN_NOCHANGEDIR = 0x8
;~ Global Const $OFN_NODEREFERENCELINKS = 0x100000
;~ Global Const $OFN_NOLONGNAMES = 0x40000
;~ Global Const $OFN_NONETWORKBUTTON = 0x20000
;~ Global Const $OFN_NOREADONLYRETURN = 0x8000
;~ Global Const $OFN_NOTESTFILECREATE = 0x10000
;~ Global Const $OFN_NOVALIDATE = 0x100
;~ Global Const $OFN_OVERWRITEPROMPT = 0x2
;~ Global Const $OFN_PATHMUSTEXIST = 0x800
;~ Global Const $OFN_READONLY = 0x1
;~ Global Const $OFN_SHAREAWARE = 0x4000
;~ Global Const $OFN_SHOWHELP = 0x10
Global Const $OFN_SHAREFALLTHROUGH = 2
Global Const $OFN_SHARENOWARN = 1
Global Const $OFN_SHAREWARN = 0
Global Const $OFN_USEMONIKERS = 0x1000000
Global Const $OFS_MAXPATHNAME = 128


Global Const $CDM_FIRST = 1124
Global Const $CDM_GETFILEPATH = $CDM_FIRST + 0x1
Global Const $CDM_GETFOLDERIDLIST = $CDM_FIRST + 0x3
Global Const $CDM_GETFOLDERPATH = $CDM_FIRST + 0x2
Global Const $CDM_GETSPEC = $CDM_FIRST + 0x0
Global Const $CDM_HIDECONTROL = $CDM_FIRST + 0x5
Global Const $CDM_SETCONTROLTEXT = $CDM_FIRST + 0x4
Global Const $CDM_SETDEFEXT = $CDM_FIRST + 0x6
Global Const $CDM_LAST = 1224

Global Const $CDN_FIRST = -601
Global Const $CDN_INITDONE = $CDN_FIRST - 0x0
Global Const $CDN_INCLUDEITEM = $CDN_FIRST - 0x7
Global Const $CDN_FOLDERCHANGE = $CDN_FIRST - 0x2
Global Const $CDN_HELP = $CDN_FIRST - 0x4
Global Const $CDN_SELCHANGE = $CDN_FIRST - 0x1
Global Const $CDN_TYPECHANGE = $CDN_FIRST - 0x6
Global Const $CDN_SHAREVIOLATION = $CDN_FIRST - 0x3
Global Const $CDN_FILEOK = $CDN_FIRST - 0x5
Global Const $CDN_LAST = -699

;;explorer style dialog control indentifiers
Global Const $chx1 = 0x410;The read-only check box
Global Const $cmb1 = 0x470;Drop-down combo box that displays the list of file type filters
Global Const $stc2 = 0x441;Label for the cmb1 combo box
Global Const $cmb2 = 0x471;Drop-down combo box that displays the current drive or folder, and that allows the user to select a drive or folder to open
Global Const $stc4 = 0x443;Label for the cmb2 combo box
Global Const $edt1 = 0x480;Edit control that displays the name of the current file, or allows the user to type the name of the file to open. Compare with cmb13.
Global Const $stc3 = 0x442;Label for the cmb13 combo box and the edt1 edit control
Global Const $lst1 = 0x460;List box that displays the contents of the current drive or folder
Global Const $stc1 = 0x440;Label for the lst1 list box
;~ Global Const $IDOK = 1;The OK command button (push button)
;~ Global Const $IDCANCEL = 2;The Cancel command button (push button)
Global Const $pshHelp = 0x040e;The Help command button (push button)

;; reverse-engineered command codes for SHELLDLL_DefView (Paul DiLascia, MSDN Magazine  March 2004)
Global Const $ODM_VIEW_ICONS = 0x7029
Global Const $ODM_VIEW_LIST = 0x702b
Global Const $ODM_VIEW_DETAIL = 0x702c
Global Const $ODM_VIEW_THUMBS = 0x702d
Global Const $ODM_VIEW_TILES = 0x702e
#EndRegion

;$iCentre = 0  - file dialog default of top left corner of screen
;$iCentre = 1  - file dialog centred on desktop (only if $iLeft = -1 $iTop = -1)
;$iLeft = X $iTop = Y - file dialog placed by X,Y co-ordinates ($iCentre = 1 and $hParentGui = hWnd ignored)
;$hParentGui = hWnd - file dialog centred on parent form if $iCentre = 1 otherwise default of top left corner of screen or placed by X,Y co-ordinates

Global $iLeft = -1, $iTop = -1, $iCentre = 1, $hParentGui = 0
;$iCentre = 0
;$hParentGui = _WinAPI_GetDesktopWindow()
;$iTop = 200

Global $message = "Choose profile to join with "; & $focused_window
;$var = FileOpenDialog($message, @ScriptDir & "\", "xpadderprofile (*.xpadderprofile)", 1 + 4 )

;$OFNConstants = BitOR($OFN_FILEMUSTEXIST, $OFN_ALLOWMULTISELECT, $OFN_PATHMUSTEXIST, $OFN_EX_NOPLACESBAR, $OFN_DONTADDTORECENT)

;seems to work without using $OFN_ENABLEHOOK, $OFN_EXPLORER as suggested.
;$OFNConstants = BitOR($OFN_ENABLESIZING, $OFN_ENABLEHOOK, $OFN_EXPLORER, $OFN_FILEMUSTEXIST, _
;$OFN_ALLOWMULTISELECT, $OFN_PATHMUSTEXIST, $OFN_DONTADDTORECENT)

Global $OFNConstants = BitOR($OFN_FILEMUSTEXIST, $OFN_ALLOWMULTISELECT, $OFN_ENABLEHOOK)
Global $Input = _FileOpenDialogEx($message, @ScriptDir, "xpadderprofile (*.xpadderprofile)", $OFNConstants, "", $hParentGui, "_FileOpen_HookProc")
If @error Then
   ;MsgBox(0,'Error','No file selected.' & @CRLF)
Else
    ConsoleWrite($Input & @CRLF)
EndIf

Func _FileOpen_HookProc($hWnd, $Msg, $wParam, $lParam)
    #forceref $wParam, $lParam
    Switch $Msg
    ;Case $WM_INITDIALOG
        Case $WM_SHOWWINDOW
            Local $hDlg = _WinAPI_GetParent($hWnd)
            If Not IsHWnd($hDlg) Then Return False
            WinSetOnTop($hDlg, "", 1); set topmost z-order
            _SendMessage($hDlg, $CDM_SETCONTROLTEXT, $stc3, "File profile name:", 0, "int", "wstr") ;rename combobox filename label
            _SendMessage($hDlg, $CDM_SETCONTROLTEXT, $stc2, "File type:", 0, "int", "wstr")                 ;rename combobox filetype label
        ;_SendMessage($hDlg, $CDM_HIDECONTROL, $stc2, 0, 0, "wParam", "lParam")                                 ;hide filetype combobox label
        ;_SendMessage($hDlg, $CDM_HIDECONTROL, $cmb1, 0, 0, "wParam", "lParam")                         ;hide filetype combobox 
        ;centre file dialog on desktop or parent form
            If $iCentre = 1 And $iLeft = -1 And $iTop = -1 Then
                Local $aSize1 = WinGetPos($hDlg), $aSize2
                If IsHWnd($hParentGui) Then
                    $aSize2 = WinGetPos($hParentGui)
                Else
                    $aSize2 = WinGetPos(_WinAPI_GetDesktopWindow())
                EndIf
                If Not IsArray($aSize1) Or Not IsArray($aSize2) Then Return False
                $iLeft = $aSize2[0] + ($aSize2[2] / 2) - ($aSize1[2] / 2)
                $iTop = $aSize2[1] + ($aSize2[3] / 2) - ($aSize1[3] / 2)
            EndIf
            If $iLeft <> -1 Or $iTop <> -1 Then WinMove($hDlg, "", $iLeft, $iTop)
        Case Else
    EndSwitch
    Return False
EndFunc

Exit


;#
;   _FileOpenDialogEx()
;           Initiates a customizable Open File Dialog.
;   Parameters:
;           $sTitle - dialog title, see FileOpenDialog()
;           $sInitDir - initial folder, see FileOpenDialog()
;           $sFilter - file type filter, see FileOpenDialog()
;           $iOptions - can be one or combination of the following:
;                       $OFN_FILEMUSTEXIST
;                       $OFN_PATHMUSTEXIST
;                       $OFN_ALLOWMULTISELECT
;                       $OFN_CREATEPROMPT
;                       $OFN_ENABLESIZING
;                       $OFN_DONTADDTORECENT
;                       $OFN_FORCESHOWHIDDEN
;                       $OFN_NONETWORKBUTTON
;                       $OFN_EX_NOPLACESBAR
;
;           $sDefaultName - default filename, see FileOpenDialog()
;           $hParent - handle of dialog's parent window (0 if none)
;           $sHookName - name of user defined dialog hook procedure ("" if none). See examples.
;           $hTemplate - handle to a file or memory object containing custom dialog template (0 if none). See examples.
;           $sTemplateName - name of a dialog template resource in the module identified by the $hTemplate ("" if none or if $hTemplate is memory object handle). See examples.
;   Return values:
;           Success: string value of chosen filename(s), see FileOpenDialog()
;           Failure: Sets @error to 1
;   Remarks:
;           Using hook function you can customize dialog to greater extent - hide/show controls, change text of controls, and do other neat things.
;           Hook function should have 4 params ($hWnd, $Msg, $wParam, $lParam) and works similar to GuiRegisterMsg() functions. For more information refer http://msdn2.microsoft.com/en-us/library/ms646960(VS.85).aspx
;           Using custom templates you can add controls to a common dialog. To handle these custom controls, use hook function.
;#
Func _FileOpenDialogEx($sTitle = "", $sInitDir = "", $sFilter = "All Files (*.*)", $iOptions = 0, $sDefaultName = "", $hParent=0, $sHookName="", $hTemplate=0, $sTemplateName="")

    Local $sRet = _GetOpenSaveFileName('GetOpenFileName', $sHookName, $hTemplate, $sTemplateName, $hParent, $sTitle, $sInitDir, $sFilter, $iOptions, $sDefaultName)
    If @error Then SetError(@error)
    Return $sRet
    
EndFunc

;###################################
;#
;   _GetOpenSaveFileName()
;           Internal
;#
Func _GetOpenSaveFileName($sFunction, $sHookProc, $hTemplate, $sTemplateName, $hParent, $sTitle, $sInitDir, $sFilter, $iOptions, $sDefaultName)
    Local $taFilters, $tFile, $_OFN_HookProc = 0, $iFlagsEx = 0, $iFlagsForced = BitOR($OFN_EXPLORER,$OFN_HIDEREADONLY,$OFN_NODEREFERENCELINKS)
    $iOptions = BitOR($iFlagsForced, $iOptions)
    If BitAND($iOptions, $OFN_EX_NOPLACESBAR) Then
        $iOptions = BitXOR($iOptions, $OFN_EX_NOPLACESBAR)
        $iFlagsEx = $OFN_EX_NOPLACESBAR
    EndIf
;Local $iBufferSize = 4095
    Local $aFilters = StringSplit($sFilter, "|"), $saFilters = "", $aFiltSplit, $i
    For $i = 1 To $aFilters[0]
        $aFiltSplit = StringRegExp($aFilters[$i], "(?U)\A\h*(.+)\h*\((.*)\)", 1)
        $saFilters &= $aFilters[$i] & Chr(0) & $aFiltSplit[1] & Chr(0)
    Next
    $taFilters = DllStructCreate("wchar[" & StringLen($saFilters)+3 & "]")
    DllStructSetData($taFilters, 1, $saFilters)
    Local $tagFileBuffer = "wchar[32768]", $iFileBufferSize = 32767
    $tFile = DllStructCreate($tagFileBuffer);Win2000/XP: should be 32k for ansi, unlimited for unicode
    If $sDefaultName <> "" Then DllStructSetData($tFile, 1, $sDefaultName)
    Local $tOFN = DllStructCreate('dword lStructSize;hwnd hwndOwner;hwnd hInstance;' & _
                                    'ptr lpstrFilter;ptr lpstrCustomFilter;dword nMaxCustFilter;dword nFilterIndex;' & _
                                    'ptr lpstrFile;dword nMaxFile;ptr lpstrFileTitle;dword nMaxFileTitle;ptr lpstrInitialDir;ptr lpstrTitle;' & _
                                    'dword Flags;short nFileOffset;short nFileExtension;ptr lpstrDefExt;dword lCustData;ptr lpfnHook;ptr lpTemplateName;' & _
                                    'dword Reserved[2];dword FlagsEx')
    DllStructSetData($tOFN, 'lStructSize', DllStructGetSize($tOFN))
    If IsHWnd($hParent) Then DllStructSetData($tOFN, 'hwndOwner', $hParent)
    DllStructSetData($tOFN, 'lpstrFilter', DllStructGetPtr($taFilters))
    DllStructSetData($tOFN, 'nFilterIndex', 1)
    DllStructSetData($tOFN, 'lpstrFile', DllStructGetPtr($tFile))
    DllStructSetData($tOFN, 'nMaxFile', $iFileBufferSize)
    DllStructSetData($tOFN, 'FlagsEx', $iFlagsEx)
    If $hTemplate <> 0 Then
        If $sTemplateName <> "" Then
            $iOptions = BitOr($iOptions, $OFN_ENABLETEMPLATE)
            DllStructSetData($tOFN, 'hInstance', $hTemplate)
            Local $tTemplateName = DllStructCreate("wchar[4096]")
            DllStructSetData($tTemplateName, 1, $sTemplateName)
            DllStructSetData($tOFN, 'lpTemplateName', DllStructGetPtr($tTemplateName))
        Else
            $iOptions = BitOr($iOptions, $OFN_ENABLETEMPLATEHANDLE)
            DllStructSetData($tOFN, 'hInstance', $hTemplate)
        EndIf
    EndIf
    If $sHookProc <> "" Then
        $iOptions = BitOr($iOptions, $OFN_ENABLEHOOK, $OFN_ENABLEINCLUDENOTIFY)
        $_OFN_HookProc = DllCallbackRegister($sHookProc, "int", "hwnd;uint;wparam;lparam")
        DllStructSetData($tOFN, 'lpfnHook', DllCallbackGetPtr($_OFN_HookProc))
    EndIf   
    If $sTitle <> "" Then
        Local $tTitle = DllStructCreate("wchar[4096]")
        DllStructSetData($tTitle, 1, String($sTitle))
        DllStructSetData($tOFN, "lpstrTitle", DllStructGetPtr($tTitle))
    EndIf
    If $sInitDir <> "" Then
        Local $tInitDir = DllStructCreate("wchar[4096]")
        DllStructSetData($tInitDir, 1, String($sInitDir))
        DllStructSetData($tOFN, "lpstrInitialDir", DllStructGetPtr($tInitDir))
    EndIf
    DllStructSetData($tOFN, 'Flags', $iOptions)
    $sFunction &= 'W'
    Local $aRet = DllCall('comdlg32.dll','int',$sFunction, 'ptr',DllStructGetPtr($tOFN)), $iError = @error
    If $_OFN_HookProc <> 0 Then DllCallbackFree($_OFN_HookProc)
    If $iError Then 
        Return SetError(2,$iError,"")
    ElseIf $aRet[0] Then
        Local $iChar = 1
        While $iChar < $iFileBufferSize+1
            If DllStructGetData($tFile, 1, $iChar) = "" Then
                If DllStructGetData($tFile, 1, $iChar+1) = "" Then ExitLoop
                DllStructSetData($tFile, 1, "|", $iChar)
            EndIf
            $iChar += 1
        WEnd
        Return SetError(0,0,DllStructGetData($tFile, 1))
    Else
        Return SetError(1,0,"")
    EndIf
EndFunc

I see fascists...

Share this post


Link to post
Share on other sites
buymeapc

I know this is an old topic, but I was curious if anyone has ever tried adding controls to a FileOpen dialog before such as a listview or a button. Heck, is it even possible??

Share this post


Link to post
Share on other sites
GEOSoft

It won't work with the normal FileOpen dialog because that is a standard Windows dialog.

You could do it by creating a custom dialog as shown in a previous post.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
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
Sign in to follow this  

×