Jump to content
Sign in to follow this  
JScript

WM_DROPFILES and #RequireAdmin, not work?!?!

Recommended Posts

JScript

WM_DROPFILES does not work if the program is compiled with the #RequireAdmin !!!

Try this:

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

#RequireAdmin

Global $WM_DROPFILES = 0x0233
Global $Msg

Global $hForm = GUICreate('MyGUI', 400, 200, -1, -1, -1, $WS_EX_ACCEPTFILES)
GUISetState()

GUIRegisterMsg($WM_DROPFILES, "_WM_DROPFILES")

; Main loop
While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Func _WM_DROPFILES($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg, $wParam, $lParam

    Switch $hWnd
        Case $hForm
            Local $FileList = _WinAPI_DragQueryFileEx($wParam)

            If IsArray($FileList) Then
                For $i = 1 To $FileList[0]
                    ToolTip($FileList[$i])
                Next
            EndIf
            _WinAPI_DragFinish($wParam)
            Return 0
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>_WM_DROPFILES

João Carlos


http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Share this post


Link to post
Share on other sites
trancexx

It should be like that.

Search the forum for ChangeWindowMessageFilterEx.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites
guinness

This works with latest beta on Windows 7 x64 >>

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7
#include <GUIConstantsEx.au3>
#include <WinAPIEx.au3>
#include <WindowsConstants.au3>
#RequireAdmin
Global $hGUI
$hGUI = GUICreate('WM_DROPFILES', 400, 200, -1, -1, -1, $WS_EX_ACCEPTFILES)
GUISetState()
GUIRegisterMsg(0x0233, "WM_DROPFILES")
While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd
 
 
Func WM_DROPFILES($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg, $wParam, $lParam
Local $aFileList
    Switch $hWnd
        Case $hGUI
            $aFileList = _WinAPI_DragQueryFileEx($wParam)
            If IsArray($aFileList) Then
                For $A = 1 To $aFileList[0]
                      ConsoleWrite($aFileList[$A] & @CRLF)
                Next
            EndIf
            _WinAPI_DragFinish($wParam)
            Return 0
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>_WM_DROPFILES
Edited by guinness

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
Yashied

Yes, trancexx absolutely right.

On Vista and Windows 7 you can't send messages to a process with a higher integrity level. If your process is being run as administrator then it will have a higher integrity level than explorer and so won't accept the dropped files. You should use ChangeWindowMessageFilterEx() to allow WM_DROPFILES to be received from lower privileged processes.

Edited by Yashied

Share this post


Link to post
Share on other sites
Yashied

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  

×