[python-win32] win32gui and UpdateLayeredWindow
Alexandru Ionescu
q_crack at yahoo.com
Sun Aug 22 12:02:35 CEST 2010
First I will like to thank Tim Roberts for his answer about GWL_EXSTYL. I
replaced all the hex values with dec values. Now I don't get any error about the
handles but I get another error:
error:(317,'UpdateLayeredWindow','The system cannot find message text for
message number 0x%1 in the message fie for %2.')
Please, can you tell me how to properly use the UpdateLayeredWindow?
My latest code version is:
import wx
import time
import win32gui
import win32api #for RGB
GWL_EXSTYLE = -20
WS_EX_LAYERED = 524288
WS_EX_TRANSPARENT = 32
LWA_ALPHA = 2
LWA_COLORKEY = 1
class MyFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, wx.ID_ANY, title = "Test")
hwnd = self.GetHandle()
gwl = win32api.GetWindowLong(hwnd, GWL_EXSTYLE)
win32gui.SetWindowLong(hwnd, GWL_EXSTYLE, (gwl | WS_EX_LAYERED))
self.bmp = wx.EmptyBitmap(800,600)
jpg1 = wx.Image('Multiple alpha.png', wx.BITMAP_TYPE_PNG)
self.bmp = jpg1.ConvertToBitmap()
w1, h1 = self.bmp.GetWidth(), self.bmp.GetHeight()
self.SetClientSize( (w1, h1) )
screenDC = win32gui.GetDC(None)
cScreenDC = win32gui.CreateCompatibleDC(screenDC)
win32gui.SelectObject(cScreenDC, self.bmp.GetHandle())
p = (50,50)
p2 = (0,0)
s = (816,612)
blend = (0,0,200,1)
crkey = win32api.RGB(255,255,0)
flags = (LWA_ALPHA | LWA_COLORKEY)
print win32gui.UpdateLayeredWindow(hwnd,
screenDC,
p,
s,
cScreenDC,
p2,
crkey,
blend,
flags)
app = wx.App()
frame = MyFrame()
frame.Show()
app.SetTopWindow(frame)
app.MainLoop()
Thank you very much,
Alexandru Ionescu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20100822/c54d76fc/attachment.html>
More information about the python-win32
mailing list