{"id":21070797,"url":"https://github.com/fafalone/dragdropdemo","last_synced_at":"2026-03-16T18:35:46.595Z","repository":{"id":151901676,"uuid":"528962041","full_name":"fafalone/DragDropDemo","owner":"fafalone","description":null,"archived":false,"fork":false,"pushed_at":"2024-05-14T17:44:10.000Z","size":181,"stargazers_count":6,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-20T21:56:47.966Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Visual Basic 6.0","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fafalone.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-25T17:56:53.000Z","updated_at":"2024-05-14T17:44:13.000Z","dependencies_parsed_at":"2024-11-19T18:58:57.053Z","dependency_job_id":null,"html_url":"https://github.com/fafalone/DragDropDemo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fafalone%2FDragDropDemo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fafalone%2FDragDropDemo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fafalone%2FDragDropDemo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fafalone%2FDragDropDemo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fafalone","download_url":"https://codeload.github.com/fafalone/DragDropDemo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243513851,"owners_count":20303020,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-19T18:48:24.716Z","updated_at":"2025-12-27T22:24:42.522Z","avatar_url":"https://github.com/fafalone.png","language":"Visual Basic 6.0","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DragDropDemo v5\n\n(Project update: v5 adds force registration option to Attach to unregister an existing drop target. Primarily to sync with the VB6 version, as tB doesn't currently have the bug where it registers dragdrop for a form with windowless UC where neither enable dragdrop.\n\n(Project update: v4 suppresses errors from TotalCommander and others in the DragDropHelper object since file names can usually still be retrieved.\n\n(Project update: V2.1 updates to use Coclass syntax, requires twinBASIC Beta 167 or newer)\n\n(Project update: V2 fixes incorrect IEnumSTATDATA definition, and since LongLong can be used on both x86 and x64, ditches the separate definitions in favor of using LongLong+CopyMemory on both)\n\nA while back I posted this project:\n\n[[VB6] Register any control as a drop target that shows the Explorer drag image](https://www.vbforums.com/showthread.php?808125-VB6-Register-any-control-as-a-drop-target-that-shows-the-Explorer-drag-image)\n\n![img](http://i.imgur.com/y3SHMsH.jpg) ![img2](http://i.imgur.com/aUaniDK.jpg)\n\n\nI wanted to try my hand at using these interfaces in x64 apps. A 64-bit version of oleexp doesn't seem likely; there's seemingly insurmountable barriers to using midl with a project that needs to redefine things in the force-included headers, and the original types weren't preserved so every single interface would have to be manually reviewed and updated if it uses pointer types. But, twinBASIC lets you define interfaces as a native language feature. So I set about re-implementing all the necessary ones for this project:\n\n```\n[ InterfaceId (\"4657278B-411B-11D2-839A-00C04FD918D0\") ]\nInterface IDropTargetHelper Extends stdole.IUnknown\n    Sub DragEnter(ByVal hwndTarget As LongPtr, ByVal pDataObject As DragDropDemo.IDataObject, ppt As POINT, ByVal dwEffect As DROPEFFECTS)\n    Sub DragLeave()\n    Sub DragOver(ppt As POINT, ByVal dwEffect As DROPEFFECTS)\n    Sub Drop(ByVal pDataObject As DragDropDemo.IDataObject, ppt As POINT, ByVal dwEffect As DROPEFFECTS)\n    Sub Show(ByVal fShow As Long)\nEnd Interface\n\n[ InterfaceId (\"DE5BF786-477A-11D2-839D-00C04FD918D0\") ]\nInterface IDragSourceHelper Extends stdole.IUnknown\n    Sub InitializeFromBitmap(pshdi As SHDRAGIMAGE, pDataObject As DragDropDemo.IDataObject)\n    Sub InitializeFromWindow(ByVal hwnd As LongPtr, ppt As POINT, pDataObject As DragDropDemo.IDataObject)\nEnd Interface\n\n[ InterfaceId (\"83E07D0D-0C5F-4163-BF1A-60B274051E40\") ]\nInterface IDragSourceHelper2 Extends IDragSourceHelper\n\tSub SetFlags(ByVal dwFlags As DSH_FLAGS)\nEnd Interface\n\n[ InterfaceId (\"00000122-0000-0000-C000-000000000046\") ]\nInterface IDropTarget Extends stdole.IUnknown\n    Sub DragEnter(ByVal pDataObject As IDataObject, ByVal grfKeyState As Long, ByVal pt As LongLong, dwEffect As DROPEFFECTS)\n    Sub DragOver(ByVal grfKeyState As Long, ByVal pt As LongLong, pdwEffect As DROPEFFECTS)\n    Sub DragLeave()\n    Sub Drop(ByVal pDataObj As IDataObject, ByVal grfKeyState As Long, ByVal pt As LongLong, pdwEffect As DROPEFFECTS)\nEnd Interface\n\n[ InterfaceId (\"00000121-0000-0000-C000-000000000046\") ]\nInterface IDropSource Extends stdole.IUnknown\n    Sub QueryContinueDrag(ByVal fEscape As Long)\n    Sub GiveFeedback(ByVal grfKeyState As Long)\nEnd Interface\n\n[ InterfaceId (\"0000010f-0000-0000-C000-000000000046\") ]\nInterface IAdviseSink Extends stdole.IUnknown\n\tSub OnDataChange(pFormatEtc As FORMATETC, pStgMed As STGMEDIUM)\n    Sub OnViewChange(dwAspect As DVASPECT, ByVal lindex As Long)\n    Sub OnRename(ByVal pmk As LongPtr) 'As IMoniker\n    Sub OnSave()\n    Sub OnClose()\nEnd Interface\n\n[ InterfaceId (\"00000103-0000-0000-C000-000000000046\") ]\nInterface IEnumFormatETC Extends stdole.IUnknown\n    Sub Next(ByVal celt As Long, rgelt As FORMATETC, pceltFetched As Long)\n    Sub Skip(ByVal celt As Long)\n    Sub Reset()\n    Sub Clone(ppEnum As DragDropDemo.IEnumFormatETC)\nEnd Interface\n\n[ InterfaceId (\"00000105-0000-0000-C000-000000000046\") ]\nInterface IEnumSTATDATA Extends stdole.IUnknown\n    Sub Next(ByVal celt As Long, rgelt As STATDATA, pceltFetched As Long)\n    Sub Skip(ByVal celt As Long)\n    Sub Reset()\n    Sub Clone(ppEnum As DragDropDemo.IEnumSTATDATA)\nEnd Interface\n\n[ InterfaceId (\"0000010E-0000-0000-C000-000000000046\") ]\nInterface IDataObject Extends stdole.IUnknown\n    Sub GetData(pFormatEtcIn As FORMATETC, pMedium As STGMEDIUM)\n    Sub GetDataHere(pFormatEtc As FORMATETC, pMedium As STGMEDIUM)\n    Sub QueryGetData(pFormatEtc As FORMATETC)\n    Sub GetCanonicalFormatEtc(pFormatEtcIn As FORMATETC, pFormatEtcOut As FORMATETC)\n    Sub SetData(pFormatEtc As FORMATETC, pMedium As STGMEDIUM, ByVal fRelease As Long)\n    Function EnumFormatEtc(ByVal dwDirection As DATADIR) As DragDropDemo.IEnumFormatETC\n    Sub DAdvise(pFormatEtc As FORMATETC, ByVal advf As ADVF, pAdvSink As DragDropDemo.IAdviseSink)\n    Sub DUnadvise(ByVal dwConnection As Long)\n    Function EnumDAdvise() As DragDropDemo.IEnumSTATDATA\nEnd Interface\n\n'CLSID_DragDropHelper \n[ CoClassId (\"4657278A-411B-11D2-839A-00C04FD918D0\") ]\n[ COMCreatable ]\nCoClass DragDropHelper\n\t [ Default ] Interface IDropTargetHelper\n\tInterface IDragSourceHelper\n\tInterface IDragSourceHelper2\nEnd CoClass\n```\n\nI used functions for some to preserve as much compatibility as possible with oleexp-using code.\n\nThere were a couple tricky things here... it's always been an odd interface. Normally, UDTs as [in] are ByRef; MSDN lists the x,y coords as POINT, and we had to expand that to 2 ByVal Long's in x86. It's even weirder in x64; we have to use a single member, but it's also ByVal... so it's 8 bytes but not *actually* a pointer, so it's handled like this:\n\n```\n#If Win64 Then\nPrivate Sub IDropTarget_DragEnter(ByVal pDataObj As DragDropDemo.IDataObject, ByVal grfKeyState As Long, ByVal pt As LongPtr, pdwEffect As DragDropDemo.DROPEFFECTS)\n    Dim ptt As DragDropDemo.POINT\n    CopyMemory ptt, pt, LenB(ptt)\n#Else\nPrivate Sub IDropTarget_DragEnter(ByVal pDataObj As DragDropDemo.IDataObject, ByVal grfKeyState As Long, ByVal ptX As Long, ByVal ptY As Long, pdwEffect As DragDropDemo.DROPEFFECTS)\n    Dim ptt As DragDropDemo.POINT\n    ptt.x = ptX: ptt.y = ptY\n#End If\n```\n\nAlso, lots of things are fully qualified as there's currently an issue with conflicting types in the WinNativeForms package that are exposed to users.\n\nBut besides those quirks, the code works on x64 without major change, just updating to LongPtr where needed, and replacing the PictureBox with a Frame until that's available.\n\nEt voilà:\n\n![Imgur](https://i.imgur.com/gysxo6r.jpg)\n\n### Requirements\nWindows Vista or newer\n[twinBASIC Beta 167 or newer](https://github.com/twinbasic/twinbasic/releases)\n\nThanks to twinBASIC developer Wayne Phillips for his help getting this working, and of course for the continuing great work on twinBASIC itself :thumb:\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffafalone%2Fdragdropdemo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffafalone%2Fdragdropdemo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffafalone%2Fdragdropdemo/lists"}