#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt('MustDeclareVars', 1)

Global $msg, $w, $h, $Input, $Radio1, $Radio2, $Radio3, $Button, $file
$w = 640
$h = 480
GUICreate("Test", $w, $h, -1, -1, $WS_SIZEBOX + $WS_SYSMENU, $WS_EX_ACCEPTFILES)

GUICtrlCreatePic(@SystemDir & "\oobe\msoobe.jpg", 0,0, $w, $h - 80)

$Input = GUICtrlCreateInput("", 8, 430, 517, 21, $ES_READONLY)
$Radio1 = GUICtrlCreateRadio("C:\", 8, 408, 57, 17)
$Radio2 = GUICtrlCreateRadio("D:\", 304, 408, 57, 17)
$Radio3 = GUICtrlCreateRadio("E:\", 568, 408, 57, 17)
$Button = GUICtrlCreateButton("OK", 560, 430, 57, 21)

GUIRegisterMsg(0x0233, "WM_DROPFILES") ;0x0233 = $WM_DROPFILES

GUISetState()

While 1
	$msg = GUIGetMsg()

	If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
GUIDelete()

Func WM_DROPFILES($hwnd, $msg, $wParam, $lParam)
    Local $tBuffer = DllStructCreate("char[256]")
    Local $iString

    ;Get dropped items count
    Local $aRet = DllCall("shell32.dll", "int", "DragQueryFile", "int", $wParam, "int", -1, "ptr", 0, "int", 0)

    ;Getting name only from 1st dropped item
    DllCall("shell32.dll", "int", "DragQueryFile", "int", $wParam, "int", 0, "ptr", DllStructGetPtr($tBuffer), "int", DllStructGetSize($tBuffer))
    $iString = DllStructGetData($tBuffer, 1)
    DllCall("shell32.dll", "none", "DragFinish", "int", $wParam)

    GUICtrlSetData($Input, $iString)
	If StringLeft($iString, 1) = "c" Then GUICtrlSetState($Radio1, $GUI_CHECKED)
	If StringLeft($iString, 1) = "d" Then GUICtrlSetState($Radio2, $GUI_CHECKED)
	If StringLeft($iString, 1) = "e" Then GUICtrlSetState($Radio3, $GUI_CHECKED)

    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_DROPFILES
