[python-win32] Not able to paste file in windows explorer using SetClipboardData

Mark Hammond skippy.hammond at gmail.com
Thu May 22 08:15:16 CEST 2014


I'd suggest you experiment with EnumClipboardFormats() and see all the 
formats actually in the clipboard - I'm guessing there is another format 
preferred over CF_HDROP.  Similarly, you probably want to call 
EmptyClipboard so the other formats which refer to the initial image are 
removed (and if you do this, you might find it unnecessary to use a 
different format for your replacement image)

HTH,

Mark

On 22/05/2014 1:21 PM, game4 sale wrote:
> I tested my code today on Win 7 64 bit, and it worked almost perfect
> like Tim said.
>
> If the previous clipboard content was Text, my code works perfectly.
>
> The failure part is:
> 1) Copy *Image1* from Explorer
> 2) Run my code to update clipboard with *Image2*
> 3) Paste operation in Wordpad application or Explorer ends up with only
> *Image1*
>
> Any clues please?Am i missing something?
> Also how about the OleSetClipboard()? Do you guys think it will improve
> my case?
> *
> *
>
>
> On Thu, May 22, 2014 at 1:02 AM, game4 sale <gamz4sale at gmail.com
> <mailto:gamz4sale at gmail.com>> wrote:
>
>     Thank you very much for your time.
>
>     Thats strange. For the login user, i think its same. In my
>     Taskmanager, under User tab, both the processes are running under
>     same user.
>
>     I also tried to run my script from command prompt with Admin
>     previlege. Still same, i cannot paste the file in Explorer.
>
>     Also, i found out another problem in my code. I can paste the image
>     in Wordpad application only if the last clipboard content was text.
>     If the last one was image, i cannot paste my new image. It pastes
>     only the old image.
>
>
>
>
>     On Thu, May 22, 2014 at 12:29 AM, Tim Roberts <timr at probo.com
>     <mailto:timr at probo.com>> wrote:
>
>         game4 sale wrote:
>>
>>
>>         I am trying to copy an image file to windows clipboard using
>>         my code and paste it manually in any folder in windows
>>         explorer. I am using *Windows 8* *64bit *laptop, running
>>         *Python 2.7 *and*pywin32-218* for win32 APIs
>>
>>         I managed to paste my file in Wordpad application. But, i
>>         cannot paste inside windows explorer. The Paste menu is
>>         disabled. Any help/suggestions would be much appreciated.
>>
>
>         I'm confused.  I just ran your exact code on Win 7 64 with
>         Python 2.7.5 32, unchanged except for the file name, and it
>         worked perfectly.
>
>         Is the script running as the same login user as Explorer?
>
>         --
>         Tim Roberts,timr at probo.com  <mailto:timr at probo.com>
>         Providenza & Boekelheide, Inc.
>
>
>         _______________________________________________
>         python-win32 mailing list
>         python-win32 at python.org <mailto:python-win32 at python.org>
>         https://mail.python.org/mailman/listinfo/python-win32
>
>
>
>
>
> _______________________________________________
> python-win32 mailing list
> python-win32 at python.org
> https://mail.python.org/mailman/listinfo/python-win32
>



More information about the python-win32 mailing list