[python-win32] BringWindowToTop doesn't work,anyone have try it?

2010-10-22 Thread nathon py
#  Let's say a window with title 'D:\\labBufferSpace' exists.
#  Code below does not work in DOS, or just double it.
#  But it works well in  PythonWin.
#  I do not want to run it in PythonWin every time.
#  I take it as a bug, and reported it to sourceforge.net, did I do that
wrong?

import win32ui,win32con,pythoncom,win32gui,win32process,win32api
pwin = win32gui.FindWindow(0,'D:\\labBufferSpace')
win32gui.BringWindowToTop(pwin)
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] BringWindowToTop doesn't work, anyone have try it?

2010-10-22 Thread Tim Roberts
nathon py wrote:
 #  Let's say a window with title 'D:\\labBufferSpace' exists.
 #  Code below does not work in DOS, or just double it.
 #  But it works well in  PythonWin.
 #  I do not want to run it in PythonWin every time.
 #  I take it as a bug, and reported it to sourceforge.net
 http://sourceforge.net, did I do that wrong?
 
 import win32ui,win32con,pythoncom,win32gui,win32process,win32api
 pwin = win32gui.FindWindow(0,'D:\\labBufferSpace')
 win32gui.BringWindowToTop(pwin) 

If it is a bug, it is a bug in the Win32 API.  This same code also does
not work in a console app written in C.

Use SetForegroundWindow instead of BringWindowToTop.  That works.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.

___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Drag and Drop from Outlook

2010-10-22 Thread kc106_2005-win32
Thanks for the reply, Mark.

I did a copy from Outlook, and then run dump_clipboard.  Here's what comes up:

Dumping all clipboard formats...
Clipboard format 49161
 - got 4 bytes via HGLOBAL
 - got 4 bytes via IStream
Clipboard format 49955
 - got 168 bytes via HGLOBAL
 - got 168 bytes via IStream
Clipboard format 49778
 - got 336 bytes via HGLOBAL
 - got 336 bytes via IStream
Clipboard format 49374
 - got 668 bytes via HGLOBAL
 - got 668 bytes via IStream
Clipboard format 49373
Traceback (most recent call last):
  File C:\Python25\Lib\site-packages\win32com\demos\dump_clipboard.py, line 61
, in module
DumpClipboard()
  File C:\Python25\Lib\site-packages\win32com\demos\dump_clipboard.py, line 32
, in DumpClipboard
medium = do.GetData(fetc_query)
pywintypes.com_error: (-2147024882, 'Not enough storage is available to complete
 this operation.', None, None)

Now, if I drag a message from Outlook and drop it onto a wxpython application 
and then run dump_clipboard.py.  Here's what I got:

Dumping all clipboard formats...
Clipboard format 49161
 - got 4 bytes via HGLOBAL
 - got 4 bytes via IStream
Clipboard format 49655
 - got 36 bytes via HGLOBAL
 - got 36 bytes via IStream
Clipboard format 49379
 - got 269 bytes via HGLOBAL
 - got 269 bytes via IStream
Clipboard format 49729
 - got 490 bytes via HGLOBAL
 - got 490 bytes via IStream
Clipboard format 49730
 - got 8 bytes via HGLOBAL
 - got 8 bytes via IStream
Clipboard format CF_UNICODETEXT
 - got 36 bytes via HGLOBAL
 - got 36 bytes via IStream
Clipboard format CF_TEXT
 - got 18 bytes via HGLOBAL
 - got 18 bytes via IStream
Clipboard format 49731
 - got 146 bytes via HGLOBAL
 - got 146 bytes via IStream
Clipboard format 49171
 - got 312 bytes via HGLOBAL
 - got 312 bytes via IStream
Clipboard format CF_LOCALE
 - got 4 bytes via HGLOBAL
 - got 4 bytes via IStream
Clipboard format CF_OEMTEXT
 - got 18 bytes via HGLOBAL
 - got 18 bytes via IStream

Does that give you any hints?

Mark Hammond wrote: 
On 20/10/2010 4:46 PM, kc106_2005-wi...@yahoo.com wrote: 

Unfortunately, the above code doesn't work.  CF_HDROP is not a format 
GetClipboardData recognizes, and DragQueryFile returns None.  Anybody know 
what 

the proper way of retrieving the dropped Outlook info? 

I'm not sure what you mean by CF_HDROP not being recognized - it works  for me. 
 
Using Windows Explorer, select a file and copy it to the  clipboard.  Then 
run 
the following script: 


import win32clipboard, win32con 
win32clipboard.OpenClipboard() 
try: 
got = win32clipboard.GetClipboardData(win32con.CF_HDROP) 
print got 
finally: 
win32clipboard.CloseClipboard() 

You should get back a tuple listing the filenames on the clipboard.  I'm  not 
sure what outlook does here, but you may also like to copy the  outlook object 
to the clipboard and run the  win32com/demos/dump_clipboard.py script to see 
what can be found. 


HTH, 

Mark 



 --
John Henry

___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] BringWindowToTop doesn't work, anyone have try it?

2010-10-22 Thread nathon py
guys, thanks a lot, i will try and share the result

2010/10/23 Tim Roberts t...@probo.com

 nathon py wrote:
  #  Let's say a window with title 'D:\\labBufferSpace' exists.
  #  Code below does not work in DOS, or just double it.
  #  But it works well in  PythonWin.
  #  I do not want to run it in PythonWin every time.
  #  I take it as a bug, and reported it to sourceforge.net
  http://sourceforge.net, did I do that wrong?
  
  import win32ui,win32con,pythoncom,win32gui,win32process,win32api
  pwin = win32gui.FindWindow(0,'D:\\labBufferSpace')
  win32gui.BringWindowToTop(pwin)

 If it is a bug, it is a bug in the Win32 API.  This same code also does
 not work in a console app written in C.

 Use SetForegroundWindow instead of BringWindowToTop.  That works.

 --
 Tim Roberts, t...@probo.com
 Providenza  Boekelheide, Inc.

 ___
 python-win32 mailing list
 python-win32@python.org
 http://mail.python.org/mailman/listinfo/python-win32

___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32