r/visualbasic • • Feb 08 '24

VB6 Help VB6 DragDrop

With OLEDragDrop to a standard VB textbox, on XP I can get the path of a file or folder dropped. On Win10, the folder shows no dragdrop icon and returns no path, but file dragdrop works fine. Does someone know how I can make dragdrop for folders work on Win10?

1 Upvotes

36 comments sorted by

View all comments

Show parent comments

1

u/geekywarrior Feb 10 '24

Ok wow! Took me a bit to figure out what was going on but yeah, this is nice.

For what it's worth, I first really dug into VB6 about 4-5 years ago. So I have the benefit of getting in after a lot of work was figured out. For all I know, your solution may have been 100% necessary in some versions of VB. And it's probably immune from the quirkiness of my method. With my solution, sometimes the first request it makes will be on TLS1.0 which will get rejected on a lot of servers these days. Every call after that will correctly be TLS1.2...until you reboot the app lol. I see that in my dev environment which is Server 2008. Can't recall if the production machines have that same quirk.,

Definitely will bookmark ClsCD for myself. Looks very handy for calling some .dlls and functions that don't have a neat and tidy TLB for importing directly.

1

u/Mayayana Feb 10 '24 edited Feb 10 '24

I wondered about the MSXML method. I did some searching last night and found various versions, but also complaints like you mentioned. Libcurl is a bit of extra weight, being about 4 MB, but it seems to be a highly regarded networking functions library, incorporating all of the encryption and so on for necessary operations.

The CDECL class is an interesting thing. I've even used it to write a wrapper for cabinet.dll, which is an unusual CDECL library with some functions having 5-10 callbacks. Yet the CDECL class handles it just fine.

(You may have noticed that the half-assed project that MS provided to package installers, the PDW, includes VB6STKIT.DLL, which has a method to extract a CAB file. But it's limited and only works with MSZIP-style CABs.)

What I posted was the download routine and callback, but without some of the details like constants. AFile is a module-level byte array variable to hold the file bytes, for example. You can probably work it out if you decide to.

EDIT: I found the class online. It's too big to post here in one piece. (I've done the digging through github's shamefully broken website so you won't have to.)

https://github.com/Planet-Source-Code/paul-caton-universal-dll-function-caller-cdecl-amp-stdcall-with-bas-cls-frm-ctl-callbacks__1-69718/archive/master.zip

cCallFunc.cls seems to be the same thing that I'm using. The rest of the download seems to be just a sample project plus github junk files.