mike1950r Posted June 14, 2021 Share Posted June 14, 2021 Hi, how can I disable Drag and Drop from and To RichEdit Control. Thanks for advice. Cheers mike Link to comment Share on other sites More sharing options...
Danp2 Posted June 14, 2021 Share Posted June 14, 2021 Hi Mike, What have you tried? Have you checked out GUICtrlSetState in the help file? Dan Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
mike1950r Posted June 14, 2021 Author Share Posted June 14, 2021 Hi Dan, thanks for your answer. I tried GUICtrlSetState($hGlo_WE_Control, $GUI_NODROPACCEPTED) but unfortunately this has no effect to the richedit control. cheers mike Link to comment Share on other sites More sharing options...
Danp2 Posted June 14, 2021 Share Posted June 14, 2021 Please post a short script that we can run. As is, we can only guess at the contents of $hGlo_WE_Control. 😉 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
mike1950r Posted June 14, 2021 Author Share Posted June 14, 2021 Hi Dan, OK i made a short extract from my program, which contents the WindowEdit. You can drag photos from internet pages into, which i want to disable. Hope this helps Cheers mike expandcollapse popup#include <WinAPISys.au3> #include <WinAPIsysinfoConstants.au3> #include <GUIConstantsEx.au3> #include <GuiRichEdit.au3> #include <WindowsConstants.au3> WindowEdit("TEST") Func WindowEdit($sTitle) Global $hGlo_WE_Control, $hGlo_WE_GUI Global $idGlo_WE_Close, $idGlo_WE_Copy, $idGlo_WE_Cut, $idGlo_WE_Delete, $idGlo_WE_Find, $idGlo_WE_MenuEdit, $idGlo_WE_MenuFile, $idGlo_WE_New Global $idGlo_WE_Open, $idGlo_WE_Paste, $idGlo_WE_Play, $idGlo_WE_PlayHelp, $idGlo_WE_Save, $idGlo_WE_SaveAs, $idGlo_WE_SelectAll, $idGlo_WE_Undo Local $aClientSize, $hExStyle, $hStyle, $hWnd, $iHeight, $iLeft, $iTop, $iWidth, $sText $hWnd = GUICreate("") $iWidth = ScreenSizeAvailableGet()[0] - 6 $iHeight = ScreenSizeAvailableGet()[1] - 25 $iLeft = 0 $iTop = 0 $hStyle = BitOR($WS_CAPTION, $WS_SYSMENU) $hExStyle = $WS_EX_DLGMODALFRAME $hGlo_WE_GUI = GUICreate($sTitle, $iWidth , $iHeight, $iLeft, $iTop, $hStyle, $hExStyle, $hWnd) $hStyle = BitOR($ES_MULTILINE, $ES_WANTRETURN, $ES_NOHIDESEL, $WS_VSCROLL, $WS_HSCROLL, $ES_AUTOVSCROLL, $ES_AUTOHSCROLL) $hExStyle = $WS_EX_CLIENTEDGE $hGlo_WE_Control = _GUICtrlRichEdit_Create($hGlo_WE_GUI, "", 0, 0, $iWidth, $iHeight - 19, $hStyle, $hExStyle) ; File Menu $idGlo_WE_MenuFile = GUICtrlCreateMenu("File") $idGlo_WE_New = GUICtrlCreateMenuItem("New ..." & @TAB & "Strg+N", $idGlo_WE_MenuFile) $idGlo_WE_Open = GUICtrlCreateMenuItem("Open" & @TAB & "Strg+O", $idGlo_WE_MenuFile) $idGlo_WE_Save = GUICtrlCreateMenuItem("Save" & @TAB & "Strg+S", $idGlo_WE_MenuFile) $idGlo_WE_SaveAs = GUICtrlCreateMenuItem("Save As ...", $idGlo_WE_MenuFile) GUICtrlCreateMenuItem("", $idGlo_WE_MenuFile, 5) $idGlo_WE_Close = GUICtrlCreateMenuItem("Close" & @TAB & "Alt+F4", $idGlo_WE_MenuFile) ; File Menu End ---------------------------------------------------------------------------- ; Edit Menu $idGlo_WE_MenuEdit = GUICtrlCreateMenu("Edit") $idGlo_WE_Undo = GUICtrlCreateMenuItem("Undo" & @TAB & "Strg+Z", $idGlo_WE_MenuEdit) GUICtrlCreateMenuItem("", $idGlo_WE_MenuEdit, 2) $idGlo_WE_Cut = GUICtrlCreateMenuItem("Cut" & @TAB & "Strg+X", $idGlo_WE_MenuEdit) $idGlo_WE_Copy = GUICtrlCreateMenuItem("Copy" & @TAB & "Strg+C", $idGlo_WE_MenuEdit) $idGlo_WE_Paste = GUICtrlCreateMenuItem("Paste" & @TAB & "Strg+V", $idGlo_WE_MenuEdit) $idGlo_WE_Delete = GUICtrlCreateMenuItem("Delete" & @TAB & "Del", $idGlo_WE_MenuEdit) GUICtrlCreateMenuItem("", $idGlo_WE_MenuEdit, 7) $idGlo_WE_Find = GUICtrlCreateMenuItem("Find" & @TAB & "Strg+F", $idGlo_WE_MenuEdit) GUICtrlCreateMenuItem("", $idGlo_WE_MenuEdit, 9) $idGlo_WE_SelectAll = GUICtrlCreateMenuItem("Select All" & @TAB & "Strg+A", $idGlo_WE_MenuEdit) ; Edit Menu End ---------------------------------------------------------------------------- GUISetState(@SW_SHOW, $hGlo_WE_GUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idGlo_WE_Close ExitLoop EndSwitch WEnd GUIDelete($hGlo_WE_GUI) GUIDelete($hGlo_WE_Control) EndFunc ;==>WindowEdit Func ScreenSizeAvailableGet() Local $tWorkArea Local $aResult[2] $tWorkArea = DllStructCreate($tagRECT) _WinAPI_SystemParametersInfo($SPI_GETWORKAREA, 0, DllStructGetPtr($tWorkArea)) $aResult[0] = DllStructGetData($tWorkArea, "Right") - DllStructGetData($tWorkArea, "Left") $aResult[1] = DllStructGetData($tWorkArea, "Bottom") - DllStructGetData($tWorkArea, "Top") Return $aResult EndFunc ;==>ScreenSizeAvailableGet Link to comment Share on other sites More sharing options...
Solution Danp2 Posted June 14, 2021 Solution Share Posted June 14, 2021 (edited) Unsure if there's a simple way to accomplish this. Found this earlier discussion -- Edit: Found a way using DragDropEvent_Revoke found here. Add this line immediately after the control is created -- DragDropEvent_Revoke($hGlo_WE_Control) The function looks like this -- Func DragDropEvent_Revoke($hWnd) DllCall("ole32.dll", "int", "RevokeDragDrop", "hwnd", $hWnd) EndFunc Edited June 14, 2021 by Danp2 mike1950r 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
mike1950r Posted June 14, 2021 Author Share Posted June 14, 2021 Dan, you are a genius. Works exellent, thanks so much. Cheers mike Link to comment Share on other sites More sharing options...
HurleyShanabarger Posted April 7, 2022 Share Posted April 7, 2022 In case you are using _GUICtrlRichEdit_SetText within the script, the line DragDropEvent_Revoke($hGlo_WE_Control) should be called afterwards, as _GUICtrlRichEdit_SetText is revoking the RevokeDragDrop again. Link to comment Share on other sites More sharing options...
mike1950r Posted April 7, 2022 Author Share Posted April 7, 2022 Hi HurleyShanabarger thanks for the informaton. Cheers mike Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now