Jump to content

Keeping .Ink files out!


Recommended Posts

I've been using the Drag and Drop whole GUI code for a while to detect files being dropped. Only problem is, that I'm trying to detect when an .Ink file is dropped, but it not working, and It'll detect any other file extension. Here's my code:

Func On_WM_DROPFILES($hWnd, $Msg, $wParam, $lParam)
    Local $tDrop, $aRet, $iCount, $szDrive, $szDir, $szFName, $szExt, $listCount

    ;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]

    ;Use for loop to get dragged files
    For $i = 0 To $iCount - 1
        $listCount = _GUICtrlListView_GetItemCount($ftpListview)
        $aRet = DllCall("shell32.dll", "int", "DragQueryFile", _
                "hwnd", $wParam, _
                "uint", $i, _
                "ptr", DllStructGetPtr($tDrop), _
                "int", DllStructGetSize($tDrop) _
                )
        $filePath = DllStructGetData($tDrop, 1)
        $file = _PathSplit($filePath, $szDrive, $szDir, $szFName, $szExt)
        $fileName = $file[3] & $file[4]
        $fileExt = $file[4]

                ;Here I try to detect .Ink's..
                If $fileExt = ".Ink" Then ConsoleWrite("It's and .Ink!")

        _GUICtrlListView_BeginUpdate($ftpListview)

        _GUICtrlListView_AddItem($ftpListview, $fileName)
        _GUICtrlListView_AddSubItem($ftpListview, $listCount, $filePath, 1)
        _ListView_InsertProgressBar($ftpListview, $listCount, 2)

        _GUICtrlListView_EndUpdate($ftpListview)

    Next

    ;finalize
    DllCall("shell32.dll", "int", "DragFinish", "hwnd", $wParam)
    Return
EndFunc   ;==>On_WM_DROPFILES

Please help! Thanks!

Link to comment
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
 Share

  • Recently Browsing   0 members

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