[python-win32] Finding the selected file in Windows Explorer
Larry Bates
larry.bates at websafe.com
Tue Apr 22 21:19:50 CEST 2008
Daniel Gonçalves wrote:
> Larry Bates wrote:
>> Daniel Gonçalves wrote:
>>> Hi!
>>>
>>> I need to find the selected file(s) in a Windows Explorer window from
>>> another program (I'd look at the window that last had focus).
>
> <snip!>
>
>> Daniel,
>>
>> What do you mean by "find the selected files". Give us a little more
>> detail about your use case and we can help.
>>
>
> Hi!
>
>
> What I'm trying to do is to have a program that detects whenever some
> file(s) are dragged over an area of the screen. Not dropped there, but
> dragged over it (close to the screen border, for instance). AFAIK,
> Windows only generates events whenever something is dropped, which will
> be useless here.
>
> I will be using hooks to monitor mouse events and, when the mouse is
> over the defined region, I need to find out what is being dragged. A way
> to do estimate this might be to know that the currently focused window
> is an Explorer window, and query it for the selected items (they will be
> the ones being dragged). This is only an approximation but might be
> enough for my ends, if no better way is found.
>
> Of course, if there is a way of just asking the OS "what is being
> dragged right now", that would work even better :)
>
>
>
> Tks!
> Daniel
>
>
>
>> One way of knowing about files that are selected is this:
>>
>> If you selected several files and drag and drop them on a python
>> program the files that are selected will be passed into the program in
>> sys.argv. I don't know if that is what you are looking for or not.
>>
>> -Larry
>>
>> _______________________________________________
>> python-win32 mailing list
>> python-win32 at python.org
>> http://mail.python.org/mailman/listinfo/python-win32
>>
The reason for this is that a user can "changed their mind" before the drop. I
sometimes do that and press escape to cancel the operation. wxWindows has some
several functions that occur while the dragging is taking place and I "think"
you can actually tell what is being dragged during the process.
-Larry
More information about the python-win32
mailing list