Sign in to follow this  
Followers 0
AL3X

--

3 posts in this topic

#1 ·  Posted (edited)

--

Edited by AL3X

Share this post


Link to post
Share on other sites



Hi all :P

I have a problem with the GUI of my program. I have made a program for converting files between formats...

And it has a ListView. I set the opcions to accept Drag&Drop in the GUI, but I can't find out how can I make

the ListView to show the names of the files that have been dropped in the list.

Can anyone help me, pleeeeease :) ?

Thanks

Maybe this helps

#include <GUIConstants.au3>

$title = "accept filename dropped on listview"
$g1 = GUICreate($title,-1,-1,-1,-1,-1,$WS_EX_ACCEPTFILES);
$lv = GUICtrlCreateListView("column one",10,10,180,200)
GUISetState()

Const $WM_DROPFILES = 0x233
GUIRegisterMsg($WM_DROPFILES, "WM_DROPFILES")

while 1
    $msg = GUIGetMsg()

    if $msg = -3 then exit

WEnd

;Func copied from forum somewhere and modified
Func WM_DROPFILES($hWnd, $Msg, $wParam, $lParam)
    Local $tDrop, $aRet, $iCount
;string buffer for file path
    $tDrop = DllStructCreate("char[260]")
;get file count
    $aRet = DllCall("shell32.dll", "int", "DragQueryFile", "hwnd", $wParam, "uint", -1, "ptr", DllStructGetPtr($tDrop), "int", DllStructGetSize($tDrop))
    $iCount = $aRet[0]
;get file paths
    Local $CurInfo = GUIGetCursorInfo($g1)
    If IsArray($CurInfo) And $CurInfo[4] = $LV Then
        For $i = 0 To $iCount-1
            $aRet = DllCall("shell32.dll", "int", "DragQueryFile","hwnd", $wParam,"uint", $i,"ptr", DllStructGetPtr($tDrop),"int", DllStructGetSize($tDrop))
        ;ConsoleWrite(DllStructGetData($tDrop, 1) & @CRLF)
            GUICtrlCreateListViewItem(DllStructGetData($tDrop, 1),$lv)
        Next
    EndIf
;finalize
    DllCall("shell32.dll", "int", "DragFinish", "hwnd", $wParam)
    Return
EndFunc

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

--

Edited by AL3X

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  
Followers 0