Funktionreferenz


_WinAPI_EnumMRUList


Enumerates the contents of the most recently used (MRU) list

#include <WinAPIReg.au3>
_WinAPI_EnumMRUList ( $hMRU, $iItem )

Parameter

$hMRU Handle of the MRU list, obtained when the list was created.
$iItem The item to return. If this value is (-1), the function returns the number of items in the MRU list.

Rückgabewert

Success: The item requested in $iItem. If $iItem is (-1), the number of items in the MRU list.
Failure: 0 and sets the @error flag to non-zero.

Bemerkungen

None.

Siehe auch

Suche nach EnumMRUListW in der MSDN Bibliothek.

Beispiel

#include <APIRegConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <WinAPIReg.au3>

Local $hMRU = _WinAPI_CreateMRUList($HKEY_CURRENT_USER, 'Software\MyProg\MRU', 5)

; Erstellt eine MRU-Liste in der Registry (nur beim ersten Start des Beispiels)
RegRead('HKCU\Software\MyProg\MRU', 'MRUList')
If @error Then
    For $i = 5 To 1 Step -1
        _WinAPI_AddMRUString($hMRU, 'String' & $i)
    Next
EndIf

GUICreate('Test ' & StringReplace(@ScriptName, '.au3', '()'), 320, 92)
Local $idCombo = GUICtrlCreateCombo(_WinAPI_EnumMRUList($hMRU, 0), 10, 20, 300, 21, $CBS_DROPDOWNLIST)
Local $iCount = _WinAPI_EnumMRUList($hMRU, -1)
Local $sData = ''
For $i = 1 To $iCount - 1
    $sData &= _WinAPI_EnumMRUList($hMRU, $i) & '|'
Next
GUICtrlSetData(-1, $sData)
Local $idButton = GUICtrlCreateButton('OK', 125, 58, 70, 23)
GUISetState(@SW_SHOW)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $idButton
            _WinAPI_AddMRUString($hMRU, GUICtrlRead($idCombo))
            ExitLoop
    EndSwitch
WEnd

_WinAPI_FreeMRUList($hMRU)