Fanatic Live: [C#] MSN DP changer based on WA current song - Fanatic Live

Jump to content

This is not a support forum!

This forum is intended for users to post source they have created and want to share, it is not to be used for asking for source. New topics made here require moderator approval, and questions will be deleted.
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[C#] MSN DP changer based on WA current song Rate Topic: -----

#1 User is offline   stormed

  • One post hero!
  • Pip
Group:
Members
Posts:
1
Joined:
26-July 05

Posted 26 July 2005 - 11:32 AM

this is a little experiment of me, this program checks winamp for the current song an looks into the directory of that song for a folder.jpg, and if exists it sets that file as the MSN Display picture.
download here
Code preview:
CODE
private void mainThread()
 {
     int WinampWindow;
     int WinampStatus;
     int OldSongPosition;
     int i;

     MessengerAPI.MessengerClass MSN = new MessengerAPI.MessengerClass();

     try
     {
   while (true)
   {
       WinampWindow = FindWindow("Winamp v1.x", null);

       //if winamp is running
       if (WinampWindow != 0)
       {
     //write playlist
     SendMessage(WinampWindow, 1024, 0, WM_WRITEPLAYLIST);
     //get winampstatus
     WinampStatus = SendMessage(WinampWindow, WM_USER, 0, WM_GETSTATUS);
     switch (WinampStatus)
     {
         case 1:
       lblWinampState.Text = "Playing";
       groupBox2.Visible = true;
       break;
         case 3:
       lblWinampState.Text = "Paused";
       groupBox2.Visible = true;
       break;
         default:
       groupBox2.Visible = false;
       lblWinampState.Text = "Stopped";
       break;
     }
     //get old song position
     OldSongPosition = CurrentSongPosition;
     //get new song position
     CurrentSongPosition = SendMessage(WinampWindow, 1024, 0, WM_PLAYLISTPOSITION);

     //if new song isnt the old song (new track)
     if (OldSongPosition != CurrentSongPosition)
     {
         StreamReader streamread = new StreamReader("C:\\Program Files\\Winamp\\Winamp.m3u");
         string curLine;
         i = 0;
         while ((curLine = streamread.ReadLine()) != null)
         {
       //prevent line which start with # to be counted
       if (curLine.StartsWith("#"))
           continue;
       //if we reached the current file
       if (i == CurrentSongPosition)
       {
           //getting fileinfo of current song
           FileInfo fileinfo = new FileInfo(curLine);

           if (pictureBox1.Image != null)
         pictureBox1.Image.Dispose();
         
           //getting MP3 tags
           MP3File mp3File = ShellID3TagReader.ReadID3Tags(curLine);
           txtFilename.Text = curLine;
           txtArtist.Text = mp3File.ArtistName;
           txtAlbum.Text = mp3File.AlbumName;
           txtTitle.Text = mp3File.SongTitle;

           //if there is a folder.jpg in the directory of the current playing song
           if (File.Exists(fileinfo.Directory + "\\folder.jpg"))
           {
         pictureBox1.Visible = true;
         pictureBox1.Image = new Bitmap(Image.FromFile(fileinfo.Directory + "\\folder.jpg"), 100, 100);
         //setting the folder.jpg as the MSN DP
         MSN.set_MyProperty((MessengerAPI.MCONTACTPROPERTY)2, fileinfo.Directory + "\\folder.jpg");
           }
           else
         pictureBox1.Visible = false;

           break;
       }
       i++;
         }
         streamread.Close();
     }
       }
       else
       {
     groupBox2.Visible = false;
     lblWinampState.Text = "Closed";
       }

       Thread.Sleep(500);
   }
     }
     catch (Exception E)
     {
   
     }
 }


And if anyone knows how to remove a Display picture from the list in MSN please let me know!

Attached File(s)


0

#2 User is offline   Doggie

  • Plays with messenger too much
  • Icon
Group:
Admins
Posts:
5,296
Joined:
04-February 02
Location:
YA MUM
Interests:
Females, Friends, Sports, Alcoholic Beverages and all things geeky.

Posted 27 July 2005 - 12:26 AM

what do you mean remove? from msn messenger itself or the directory of the display pictures?
0

#3 User is offline   Liiam

  • :pray:
  • Icon
Group:
Valued Members
Posts:
455
Joined:
23-March 05

Posted 27 July 2005 - 07:18 AM

nice work, i actually wrote one of these for iTunes last night, however i tied it into my own website, so it downloads the art graphic automatically for you if you dont have it biggrin.gif
0

#4 User is offline   Dody

  • Liveā„¢ |) () |) '/
  • Icon
Group:
Valued Members
Posts:
1,145
Joined:
26-October 04
Location:
DK
Interests:
Guitar, c++, Hacking, Religions, Debating...

Posted 27 July 2005 - 10:41 AM

that is a nice work though, and I need to look at your site Spooner biggrin.gif
0

#5 User is offline   Liiam

  • :pray:
  • Icon
Group:
Valued Members
Posts:
455
Joined:
23-March 05

Posted 27 July 2005 - 01:17 PM

btw stormed, it would have been nice of you to thank the bloke from codeproject for your MP3File class smile.gif
0

#6 User is offline   BrutuZ

  • I'm getting there
  • Pip
Group:
Members
Posts:
4
Joined:
29-March 06

Posted 29 March 2006 - 04:08 AM

Oops, the host is down sad.gif. Could you please fix it? It's EXACTLY what i'm looking for smile.gif
0

#7 User is offline   xebeth

  • I'm getting there
  • Pip
Group:
Members
Posts:
3
Joined:
29-April 06

Posted 29 April 2006 - 08:05 AM

QUOTE(BrutuZ @ Mar 29 2006, 05:08 AM) View Post
Oops, the host is down sad.gif. Could you please fix it? It's EXACTLY what i'm looking for smile.gif

I second that.
0

#8 User is offline   hmaster

  • Mr One Hundred
  • PipPipPipPip
Group:
Members
Posts:
167
Joined:
29-August 05
Location:
England/home

Posted 29 April 2006 - 09:00 AM

What about some compatibilty with iTunes tongue.gif
0

#9 User is offline   xebeth

  • I'm getting there
  • Pip
Group:
Members
Posts:
3
Joined:
29-April 06

Posted 30 April 2006 - 04:02 PM

I've been trying to recreate that functionnality but it seems I can't find a way to change the display picture...
It seems there is no way to set a property. I'm using MSN Live Messenger 8.0.566 typelib.

This post has been edited by xebeth: 30 April 2006 - 04:54 PM

0

#10 User is offline   Doggie

  • Plays with messenger too much
  • Icon
Group:
Admins
Posts:
5,296
Joined:
04-February 02
Location:
YA MUM
Interests:
Females, Friends, Sports, Alcoholic Beverages and all things geeky.

Posted 01 May 2006 - 01:06 AM

you can change your display picture with the leaked version add-in system i believe. where that is, you'll have to find yourself
0

#11 User is offline   xebeth

  • I'm getting there
  • Pip
Group:
Members
Posts:
3
Joined:
29-April 06

Posted 01 May 2006 - 06:54 AM

QUOTE(Doggie @ May 1 2006, 03:06 AM) View Post
you can change your display picture with the leaked version add-in system i believe. where that is, you'll have to find yourself

I already have that version but I pretty much hate the fact that I'd have to do what mess patch does by hand. I'll give it a go though I heard you can only have 1 addin at a time... As a workaround, would it be possible to copy the image in memory and trigger a DP change event?

This post has been edited by xebeth: 01 May 2006 - 08:17 AM

0

#12 User is offline   atlantis11500

  • A slave of the house
  • PipPip
Group:
Members
Posts:
26
Joined:
04-July 06

Posted 17 July 2006 - 02:53 AM

QUOTE(xebeth @ May 1 2006, 06:54 AM) View Post
I already have that version but I pretty much hate the fact that I'd have to do what mess patch does by hand. I'll give it a go though I heard you can only have 1 addin at a time... As a workaround, would it be possible to copy the image in memory and trigger a DP change event?


Does this work on WLM?
0

#13 User is offline   simonemoticon

  • A slave of the house
  • PipPip
Group:
Members
Posts:
25
Joined:
22-July 05

Posted 18 July 2006 - 07:19 AM

iTunes2MSN
http://projects.r9pa...s2MSN/index.php

iTunes Art Importer 0.9.2
http://www.yvg.com/i...timporter.shtml
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users