找回密码
 加入
搜索
查看: 1641|回复: 5

如何让输入框只接受拖放?

[复制链接]
发表于 2008-9-21 22:22:26 | 显示全部楼层 |阅读模式
func _run($usr,$dom,$pwd)
HotKeySet("{ENTER}", "null")       
GUIDelete($begin)
GuiCreate("运行", 160, 100,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS),$WS_EX_ACCEPTFILES)
$EdtFile = GuiCtrlCreateInput("", 1, 1, 158, 98,$ES_AUTOHSCROLL)
GUICtrlSetState(-1,$GUI_ACCEPTFILES)
GuiSetState()
$File=""
While 1
        $msg = GUIGetMsg()
        $sfile=GUICtrlRead($EdtFile)
        $ext=StringRight($sFile,4)
        if  $msg = $GUI_EVENT_CLOSE then
                Exit
        Else
                if $sFile = $File Then
                        ContinueLoop
                Else
                        If $ext<>".exe" And $ext<>".com" And $ext<>".bat" And $ext<>".cmd"  And $ext<>".scr" And $ext<>".lnk" Then
                                MsgBox(0,"出错了:(",$sfile&"不是一个可执行文件!")
                                $File = $sFile
                                ContinueLoop
                        Else
                                if $ext=".lnk" Then
                                        $lnk=FileGetShortcut(FileGetLongName($sFile))
                                        $file=$sfile
                                        $pid=runas($usr,$dom,$pwd,0,$lnk[0],@SystemDir)
                                Else
                                        $File = $sFile
                                        $pid = runas($usr,$dom,$pwd,0,$file,@SystemDir)
                                EndIf
                                ContinueLoop
                        EndIf
                endif
        EndIf
WEnd
EndFunc


今天做的一个脚本的子函数,请教一下高手大大们,如何能实现$EdtFile这个输入框只接受拖放,不接受键盘输入?

[ 本帖最后由 palkiller 于 2008-9-24 08:00 编辑 ]
发表于 2008-9-21 23:48:45 | 显示全部楼层
不知道怎么做,帮你顶一下吧`
 楼主| 发表于 2008-9-23 08:15:09 | 显示全部楼层
汗...昨天想到一个idea...去判断输入的字符数是否为1,如果是1,则自动清空...但还是跟自己想实现的效果有很大的出入...
发表于 2008-9-23 19:58:52 | 显示全部楼层

#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <EditConstants.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $hGui,$Edit
  
   ;$parent1 = GUICreate("Parent1")
    $hGui= GUICreate("Parent1", 300, 200, -1, -1, -1, $WS_EX_ACCEPTFILES)
    $Edit = GUICtrlCreateEdit("", 1, 1, 200, 100, $ES_AUTOVSCROLL + $WS_VSCROLL+$ES_READONLY) 
    GUICtrlSetState(-1, $GUI_DROPACCEPTED)
 
    GUISetState(@SW_SHOW)

    While GUIGetMsg() <> -3
        
    WEnd
    
EndFunc

 楼主| 发表于 2008-9-24 07:59:57 | 显示全部楼层
谢谢楼上两位...三恨的脚本解决了俺的问题...之前思路走到误区了,用GuiCtrlCreateInput()函数一路走到了黑...三恨能否帮俺看到热键的那个提问贴?现在就差那个未能解决了,谢了先...
发表于 2011-5-28 23:03:08 | 显示全部楼层
也帮助了我,谢谢
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-10-2 03:25 , Processed in 0.085659 second(s), 19 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表