- Now you can disable Drag even only for special objects (Image,Link,....etc)
- Ascii\Unicode
Tested with XP x86 - Win 7 x64
Code: Select all
;GadgetID(0) No Drag
;GadgetID(1) No Drop
Prototype.l AccessibleObjectFromPoint(x,y,*ia,*var)
Global AccessibleObjectFromPoint.AccessibleObjectFromPoint,Value.string,vt.VARIANT,*pIAcc.IAccessible
Olelib = OpenLibrary(#PB_Any,"Oleacc.dll")
AccessibleObjectFromPoint=GetFunction(Olelib,"AccessibleObjectFromPoint")
Procedure ObjectFromPoint( *Value.String,x,y)
If AccessibleObjectFromPoint(x,y,@*pIAcc,@vt)=#S_OK
*Value\s=""
If *pIAcc\get_accValue(vt, @pName) = #S_OK
Len = SysStringLen_(pName)
*Value\s = Space(Len)
WideCharToMultiByte_(#CP_ACP, 0,pName, -1, @*Value\s, len, 0, 0)
CompilerIf #PB_Compiler_Unicode
value\s = PeekS(@*Value\s,len,#PB_UTF8)
CompilerEndIf
SysFreeString_(pName)
EndIf
*pIAcc\Release()
EndIf
ProcedureReturn #True
EndProcedure
OpenWindow(0, 0, 0, 930, 600, "WebGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
WebGadget(0, 10, 10, 450, 580, "http://www.purebasic.com")
WebGadget(1, 470, 10, 450, 580, "http://www.purebasic.com")
WebObject.IWebBrowser2 = GetWindowLongPtr_(GadgetID(1), #GWL_USERDATA)
WebObject\put_RegisterAsDropTarget(#VARIANT_FALSE)
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Quit = 1
Case #PB_Event_Gadget
Select EventGadget()
Case 0
EndSelect
Case #WM_MOUSEMOVE
GetCursorPos_ (@p.POINT)
x = p\x
y = p\y
ScreenToClient_ (WindowID(0), @p)
hGad = ChildWindowFromPoint_ (WindowID(0), p\y<< 32+p\x)
Select hGad
Case GadgetID(0)
GetClientRect_(GadgetID(0),r.RECT)
ObjectFromPoint(@value,x,y)
If p\x > r\left And p\x < (r\right -25) And p\y > r\top And p\y < (r\bottom-25) And value\s <> ""
ReleaseCapture_()
EndIf
EndSelect ;
EndSelect
Until Quit = 1
CloseLibrary(Olelib)