Recognizing a mouse Dragged file onto a blitzmax
BlitzMax Forums/BlitzMax Beginners Area/Recognizing a mouse Dragged file onto a blitzmax
| ||
Hi.. Is there a way to get and recognize a mouse dragged File From a windows Folder into a blitzmax graphic window? but without using maxgui commands.. off course i need only the URL of the file.. tnx |
| ||
no help :( |
| ||
I'm quite sure the window created via Graphics doesnt' accept OS events like the ones created via MaxGUI. |
| ||
Yea your right degac// but i thought if i can capture the path of a dragged file some how from the system. all i need to do is recognize when the mouse is above the graphic windows and then drop it into the window. all i need is a way to read from system when a file is being dragged.. any clue how to read a windows event from blitzmax? tnx |
| ||
Drag & Drop is quite involved, especially on windows. But if you just want a list of dropped files, overriding the WindowProc with SetWindowLong and checking for the WM_DROPFILES message will do. Though you should read up on window procs and all that or you will mess things up ;) EDIT: I forgot, you allso need to call DragAcceptFiles before doing any of this. |
| ||
I saw that command DragAcceptFiles() but how do i get the hwnd address of blitzmax window and what is Faccept means? any chance for a little example? tnx |
| ||
ok i think i found how to get hwnd by using hWnd=GetActiveWindow() no how do i use the WM_DROPFILES ? and what is Faccept means ? i found this function SetWindowLongA() but it askes for an index and newlong which i dont know what they are.. |
| ||
GetActiveWindow() is not the right function to use, as you cant guarantee that your window is the active one when its called. After some digging i found an old sample and fixed it up a bit, should have all you need :) |
| ||
Great Grable! I'm gonna check that later. I'm dearly in depth to your effort so far. H.c |
| ||
No worries, i have plenty of samples.. Too many perhaps ;) hehe |
| ||
Great, it works on blitzmax windows. but when I turn on Xors3d window It doesnt.. Im gonna try to find out why.. hope I can solve it my self. Few mins later.. Ok.. iv switch the function to GetActiveWindow and it works. Since im running this function immediately after creating the xors3D win it always capture the right window. Just one thing I dont understand yet.. How does this function DragAcceptFiles runs when its out of the loop? and how can I read the directory Value? I know i can simply put the DragAcceptFiles Call function inside the loop.. but is it the right way to do that? Cheers |
| ||
DragAcceptFiles only signals to windows that your window can accept dropped files, so you only need to call this once. The real meat happens in the window proc under WM_DROPFILES, using DragQueryFile to extract the strings from the message. |
| ||
Great. Thats what I was missing. |
| ||
Im apologize garble, but i expected that this DragQueryFile will return String. But I dont know what to define in its values and how to get a string back.. 20 mins later.. Ok Ive managed to come up with a solution :) |
| ||
Im trying hard to do this simple thing which is making the blitzmax Window Topmost on desktop. how hard cat it be.. gees.. IVe used all this commands SetWindowPos(ThisWinAddress, HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE) ShowWindow(ThisWinAddress, 255) SetActiveWindow(ThisWinAddress) SetFocus(ThisWinAddress) still doesnt work omg.. what wrong.. only when i used SetWindowPos(ThisWinAddress, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE) it worked but then the window remains locked on topmost state.. |
| ||
Thats what topmost means in windows ;) SetFocus is only for keyboard focus btw. Oh, and you really should read up on these functions and others on MSDN, they are documented quite well. |
| ||
Hi, I believe that this is MS restriction (From Vista onwards) so that people wouldn't make popups when user is writing in active window. You can make application icon flash with 'SetForegroundWindow(hwnd)'. Here is some info found in codeproject website link -Henri |
| ||
Ah yes, you are right of course. i forgot about that one, sucks to have XP era knowledge :/ |
| ||
The thing is grable is that after I load the dragged file, Im trying to make the blitzmax window active again. I Do SetWindowPos(ThisWinAddress, HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE) SetActiveWindow(ThisWinAddress) And it works well once. But on second drag.. it doesn't.. how come? |
| ||
Well... If you had done what Henri said and used SetForegroundWindow instead, you would not have that problem. |
| ||
Sorry Grable. How could I missed that post..? I guess it's because I was reading it from a phone. Ok. problem solved thanks Henry |