Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > AutoIt
You last visited: Today at 16:10

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



"Drag and Drop" noch möglich ?

Discussion on "Drag and Drop" noch möglich ? within the AutoIt forum part of the Coders Den category.

Reply
 
Old   #1
 
Croco™'s Avatar
 
elite*gold: 235
Join Date: Jan 2012
Posts: 920
Received Thanks: 377
"Drag and Drop" noch möglich ?

Hi,
ich versuche gerade eine GUI zu erstellen auf die man eine Datei ziehen kann.
Nur leider klappt es mit keinem bis jetzt gefundenen Script. Was habe ich falsch gemacht ?

Code:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("", 490, 301, -1,-1,-1,0x00000018)
GUISetIcon("icon.ico", -1)
$ListView1 = GUICtrlCreateListView("Skin", 0, 0, 312, 300, -1, BitOR($WS_EX_CLIENTEDGE,$LVS_EX_CHECKBOXES))
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, -2)
$ListView1_0 = GUICtrlCreateListViewItem("Test", $ListView1)
$Group1 = GUICtrlCreateGroup("Drop new Skins her", 316, 4, 169, 109)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1 = GUICtrlCreateButton("Löschen", 316, 116, 167, 25)
$Button2 = GUICtrlCreateButton("Speichern", 316, 144, 167, 25)
$Label1 = GUICtrlCreateLabel("", 320, 172, 46, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit
		Case $GUI_EVENT_DROPPED
			 MsgBox(4096, "drag drop file", @GUI_DRAGFILE)
	EndSwitch
WEnd
Croco™ is offline  
Old 04/07/2013, 18:00   #2
 
Achat's Avatar
 
elite*gold: 528
Join Date: Jan 2012
Posts: 2,127
Received Thanks: 2,404
Beispiel:

Code:
#RequireAdmin
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=arrow.ico
#AutoIt3Wrapper_UseX64=n
#AutoIt3Wrapper_Res_Description=epvpImg Uploader
#AutoIt3Wrapper_Res_Fileversion=1.0.0.0
#AutoIt3Wrapper_Res_Field=Compile Date|%date% %time%
#AutoIt3Wrapper_Res_Field=AutoItVersion|%autoitver%
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Array.au3>

#region ### START Koda GUI section ### Form=C
Global $FormEPVPIMG = GUICreate("FormEPVPIMG", 445, 192, 197, 130, -1, BitOR($WS_EX_ACCEPTFILES, $WS_EX_WINDOWEDGE))
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlSetTip(-1, "Drag && Drop images here... ")
#endregion ### END Koda GUI section ###

Global $aDropFiles[1]

GUICtrlCreateLabel('', 0, 0, 368, 173)
GUICtrlSetBkColor(-1, -2)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
GUISetBkColor(0xFFFFFF)

GUISetState(@SW_SHOW)

If IsAdmin() Then ; Allow to receive this messages if run elevated
	_ChangeWindowMessageFilterEx($FormEPVPIMG, 0x233, 1) ; $WM_DROPFILES
	_ChangeWindowMessageFilterEx($FormEPVPIMG, $WM_COPYDATA, 1) ; redundant?
	_ChangeWindowMessageFilterEx($FormEPVPIMG, 0x0049, 1) ; $WM_COPYGLOBALDATA
EndIf

GUIRegisterMsg($WM_DROPFILES, "WM_DROPFILES_FUNC")

While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case -3
			Exit
		Case $GUI_EVENT_DROPPED
				_ArrayDisplay($aDropFiles)
	EndSwitch
WEnd

Func _ChangeWindowMessageFilterEx($hWnd, $iMsg, $iAction) ; http://www.autoitscript.com/forum/topic/124406-drag-and-drop-with-uac/#entry864050
	Local $aCall = DllCall("user32.dll", "bool", "ChangeWindowMessageFilterEx", _
			"hwnd", $hWnd, _
			"dword", $iMsg, _
			"dword", $iAction, _
			"ptr", 0)
	If @error Or Not $aCall[0] Then Return SetError(1, 0, 0)
	Return 1
EndFunc   ;==>_ChangeWindowMessageFilterEx

Func WM_DROPFILES_FUNC($hWnd, $msgID, $wParam, $lParam)
	Local $nSize, $pFileName
	Local $nAmt = DllCall("shell32.dll", "int", "DragQueryFile", "hwnd", $wParam, "int", 0xFFFFFFFF, "ptr", 0, "int", 255)
	For $i = 0 To $nAmt[0] - 1
		$nSize = DllCall("shell32.dll", "int", "DragQueryFile", "hwnd", $wParam, "int", $i, "ptr", 0, "int", 0)
		$nSize = $nSize[0] + 1
		$pFileName = DllStructCreate("char[" & $nSize & "]")
		DllCall("shell32.dll", "int", "DragQueryFile", "hwnd", $wParam, "int", $i, "ptr", DllStructGetPtr($pFileName), "int", $nSize)
		ReDim $aDropFiles[$i + 1]
		$aDropFiles[$i] = DllStructGetData($pFileName, 1)
		$pFileName = 0
	Next
EndFunc   ;==>WM_DROPFILES_FUNC
Multidrop geht auch.

MfG
Achat is offline  
Thanks
1 User
Old 04/07/2013, 18:03   #3
 
Croco™'s Avatar
 
elite*gold: 235
Join Date: Jan 2012
Posts: 920
Received Thanks: 377
Hat sich da etwas in den Jahren verändert ?
Ich habe ältere Scripte die alle nicht mehr gehen !?
Croco™ is offline  
Old 04/07/2013, 18:05   #4
 
Achat's Avatar
 
elite*gold: 528
Join Date: Jan 2012
Posts: 2,127
Received Thanks: 2,404
Ka, aber wenn du dein Script mit Adminrechten startest, brauchst du diese Zusatzfunktionen, damit es funktioniert (sind in meinem Script enthalten).

MfG
Achat is offline  
Old 04/07/2013, 18:07   #5
 
Croco™'s Avatar
 
elite*gold: 235
Join Date: Jan 2012
Posts: 920
Received Thanks: 377
Wie immer ist verlass auf dich
Danke
Croco™ is offline  
Reply


Similar Threads Similar Threads
"the other world" 3.3? noch möglich?
02/04/2010 - World of Warcraft - 9 Replies
Ich suche nach einem WEG mit 3.3 in die "otherworld" zu kommen. exploit oder hack egal. sobald mit da jemand geholfen hat werd ich hier einen fettes tutorial posten wie ihr alle bosse und alle mobs ingame solo´n könnt. wer nicht weiss was die otherworld ist hier ein altes tutorial wie es vor 3.3 ging YouTube - World of Warcraft "Other world" Exploration Explained! vielen dank im vorraus. sry das ich hier ne frage stelle aber es ist ja nur zu guten von mir und der community :D



All times are GMT +2. The time now is 16:10.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.