Click to See Complete Forum and Search --> : Drag and Drop


Guidosoft
March 17th, 2006, 10:28 AM
Is there a way to implement drag and drop between windows and applications without the use of OLE? I need it really badly. Also I need to know how to drag and drop files from the explorer to the application and back.

Somone please helpeth me.

Edit: Actually this is meant for the WINAPI forum. Can someone please move it to the WINAPI section. I don't want MFC.

ovidiucucu
March 17th, 2006, 10:34 AM
Edit: Actually this is meant for the WINAPI forum. Can someone please move it to the WINAPI section. I don't want MFC.
OK, as you wish.

[ Redirected thread ]

golanshahar
March 17th, 2006, 11:07 AM
OK, as you wish.

[ Redirected thread ]

10,000,000$ Please...:D

Cheers

ovidiucucu
March 17th, 2006, 11:10 AM
10,000,000$ Please...:D
Wait a second.

Guidosoft
March 17th, 2006, 11:23 AM
Can someone help me please?

btw, about that money. You should just write a good novel. That lady who wrote Harry Potter went from nothing to being a million air.

Igor Vartanov
March 17th, 2006, 01:27 PM
Is there a way to implement drag and drop between windows and applications without the use of OLE?Sure it is. You just have to duplicate the whole functionality MS writers had done for D'n'D. It means you must catch the mouse moving with clasped button, decide whether something was caught to be drawn, set mouse captured by source window, set appropriate cursor icon and keep setting it on all further mouse moves until button release, meanwhile detecting if window under cursor is ready to catch the drop and change cursor shape appropriately. When negotiations were successful and button was released, release mouse capture, detect what window appeared under cursor when button was released, discover what process owns that window and comunicate to it for make it catch what's been dropped.

I've always been wondered why people prefere build bicycle on their own instead of lending it from nearest neighbour...

I need it really badly. Also I need to know how to drag and drop files from the explorer to the application and back.Since explorer expects D'n'D done usual OLE way you must either obey common rules or hack that poor fellow badly, right just like you need this, really.

Igor Vartanov
March 17th, 2006, 01:35 PM
Can someone help me please?

btw, about that money. You should just write a good novel. That lady who wrote Harry Potter went from nothing to being a million air.Yeah, about the money... That lady who wrote Harry Potter had written not a good novell, but novel which was merely bought by other people. People are habitually buy various garbage and sometime even like do that.

Guidosoft
March 17th, 2006, 02:47 PM
How do I detect when the cursor leaves my window?
How do I detect which window is under the mouse if any?
How do I ignore if it tells me the desktop is under the window? Like how would I know the desktop handle?
I just need to know those things so I can do it. I already know how to use WM_COPYDATA when the time is right.

Oh, so I should take a shot at a novel, maybe then I won't have to go homeless when I grow up. I mean, if the software company that me and my friends are gona try to run doesn't work out, at least I will habe tried something else.

golanshahar
March 17th, 2006, 03:58 PM
How do I detect when the cursor leaves my window?

WM_MOUSELEAVE (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/userinput/mouseinput/mouseinputreference/mouseinputmessages/wm_mouseleave.asp)


How do I detect which window is under the mouse if any?


::GetCursorPos() (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/resources/cursors/cursorreference/cursorfunctions/getcursorpos.asp)
::WindowFromPoint () (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowfunctions/windowfrompoint.asp)



How do I ignore if it tells me the desktop is under the window? Like how would I know the desktop handle?

if ::WindowFromPoint(..) return handle equal to ::GetDesktopWindow() (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowfunctions/getdesktopwindow.asp) you can ignore it ;)

Cheers

Guidosoft
March 20th, 2006, 12:30 PM
Hey guess what, thanx to no help from you guys, I've developed GDD (Guido's Drag & Drop)

It's really cool.

It uses SetCapture and some extra new messages. GDDM_DROP, GDDM_HOVER, GDDM_REPORT, GDDM_REPORTHOVER, GDDM_ACCEPT.

It uses WM_COPYDATA to copy the data.

And the GDD functions handle it all for you.

See what it does is:

1. On initiating drag, sets mouse icon and captures mouse to the source window.
2. Enumerate through all windows finding there rects and determining using GetCursorPos() & ScreenToClient() whether the mouse is over the window. If so, it sends the window a GDDM_HOVER message with some crapola info.
3. On release, a message is sent to the destination window found through enumeration GDDM_DROP.
4. The destination window on recieving GDDM_DROP decides if it wants to accept. It sends the source window GDDM_ACCEPT and awaits the next WM_COPYDATA which contains the drop data.

So what do you think?

Unfortianitly I can't post the source code right now because my CD-ROM drive and Disk drives are broke and I can't install my cable modem drivers. I am accessing the computer from school. As soon as I get this fixed I will definiatly post the code.

Igor Vartanov
March 20th, 2006, 12:44 PM
So what do you think?Good. It seems you gonna be next Linus Torvalds... :)

Guidosoft
March 20th, 2006, 02:00 PM
Who's that?

philkr
March 20th, 2006, 02:21 PM
The creator of the Linux OS.

Guidosoft
March 21st, 2006, 11:21 AM
He wrote it from scratch?

MrViggy
March 21st, 2006, 11:39 AM
http://www.linux.org/

Viggy