DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3

Hybrid View

  1. #1
    Halstein Presthus Guest

    Ok.... WinAmp Plugin

    Hi!
    Ok..... I've decided to make an WinAmp Plugin with C#. But I need some help!
    I need to get in "touch" with the WinAmp window.
    For VB this is:

    Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    Dim hwndWinamp as long
    hwndWinamp = FindWindow("Winamp v1.x",vbNullString)


    For C/C++:

    HWND hwndWinamp = FindWindow("Winamp v1.x",NULL);

    Delphi Pascal:


    var hwndWinamp : THandle;
    hwndWinamp := FindWindow('Winamp v1.x', nil);



    But what is it for C#?

    And... How can I use WM commands?



    Thomas


  2. #2
    Mattias Sjögren Guest

    Re: Ok.... WinAmp Plugin

    Halstein,

    >But what is it for C#?


    using System.Runtime.InteropServices;

    --

    [DllImport("user32.dll", CharSet=CharSet.Auto)]
    static extern int FindWindow(string lpClassName, string lpWindowName);

    --

    Console.WriteLine("WinAmp hwnd: 0x{0:X}",
    FindWindow("Winamp v1.x", null) );


    >And... How can I use WM commands?


    [DllImport("user32.dll", CharSet=CharSet.Auto)]
    static extern int SendMessage(int hWnd, int Msg, int wParam, int
    lParam);

    const int WM_USER = 0x400;

    --

    Console.WriteLine("WinAmp version: 0x{0:X}",
    SendMessage(hwndWinamp, WM_USER, 0, 0) );


    You'll probably have to add a few overloads for SendMessage to get the
    different parameter types right. Take a look at the PInvoke docs and
    samples in the .NET SDK.


    Mattias

    ====================================
    Mattias Sjögren - mattias @ mvps.org
    http://www.msjogren.net/dotnet/

    CodeHound - The Software Developer's Search Engine
    http://www.codehound.com

  3. #3
    Dillon Guest

    RE: Re: Ok.... WinAmp Plugin

    John Lemp, over at illdata has made a winampcontroller class that will pretty much answer any questions you have. It is part of a C# Winamp Server (that I have yet to get working), but his winampcontroller class works like a charm. Take a look at it:

    http://illdata.com/main/stories/2003...rInCSharp.html

    Dillon

    >Halstein,
    >
    >>But what is it for C#?

    >
    >using System.Runtime.InteropServices;
    >
    >--
    >
    >[DllImport("user32.dll", CharSet=CharSet.Auto)]
    >static extern int FindWindow(string lpClassName, string lpWindowName);
    >
    >--
    >
    >Console.WriteLine("WinAmp hwnd: 0x{0:X}",
    > FindWindow("Winamp v1.x", null) );
    >
    >
    >>And... How can I use WM commands?

    >
    >[DllImport("user32.dll", CharSet=CharSet.Auto)]
    >static extern int SendMessage(int hWnd, int Msg, int wParam, int
    >lParam);
    >
    >const int WM_USER = 0x400;
    >
    >--
    >
    >Console.WriteLine("WinAmp version: 0x{0:X}",
    > SendMessage(hwndWinamp, WM_USER, 0, 0) );
    >
    >
    >You’ll probably have to add a few overloads for SendMessage to get the
    >different parameter types right. Take a look at the PInvoke docs and
    >samples in the .NET SDK.
    >
    >
    >Mattias
    >
    >====================================
    >Mattias Sjögren - mattias @ mvps.org
    >http://www.msjogren.net/dotnet/
    >
    >CodeHound - The Software Developer’s Search Engine
    >http://www.codehound.com


    Message sent from http://www.aewnet.com

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links