Jason’s musings

I just need a little time

Python and windows

with 5 comments

It's a shame the following doesn't just work:

import win32gui
import win32api
import win32con
import struct
msnui = win32gui.FindWindowEx(0, 0, "MsnMsgrUIManager", "")
msndata = struct.pack('L6sB',0x547,"python",6)
win32api.SendMessage(msnui, win32con.WM_COPYDATA, 0, msndata)

Instead it seems I'll need to get the ctypes foreign module and use ARRAY and POINTER to supply arguments to the function just like you would in C. Though I'll dig deeper….

Oh, what I was trying to do was to change the "Now Playing" thingy in MSN messenger. Just for fun. I seen it in the 0.85 branch of the VLC source code.


Written by jasonmc

May 9, 2006 at 12:14 am

Posted in Computing, General, Python

5 Responses

Subscribe to comments with RSS.

  1. For the love of god man, use the almighty C!
    Just kidding 🙂

    btw, 3 blog entries, you really must be procrastinating


    May 10, 2006 at 12:13 am

  2. Can’t a guy just post on a blog without procrastinating?
    Maybe not…. but I did get on the whole OPML bandwagon this week. Publish your OPML!


    May 10, 2006 at 12:18 am

  3. Bloggin like it’s hot! It ain’t nothin but a thang to the PEG!

    That’s my hip-hop speak quota filled for this month.


    May 13, 2006 at 4:18 pm

  4. I was just trying to do this exact same thing, and this post is about the only reference to any attempts that have been made with python.

    As far as i can tell i’m getting the right data and managing to send the COPYDATA message, but i get no results.

    Did you ever manage to get this working?

    Glen Mailer

    July 20, 2006 at 2:41 pm

  5. I only spent literally 5 minutes trying that out myself and didn’t have the interest to take it further. I assume you’re using CTYPES to get the required ARRAY and pointer types? A good way I think to do this (given that using CTYPES is ugly in my opinion) would be to write an external c module that has a function to do this and then call that function from python.
    I might take a look at this again sometime when I’m less busy. However, all my main systems are now linux and I only connect to msn throw a Jabber transport!


    August 6, 2006 at 1:52 am

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: