Click here to Skip to main content
11,415,390 members (83,461 online)
Click here to Skip to main content
Add your own
alternative version

Using screensavers inside the Windows Media Player

, 15 Jul 2011 CPOL
Wrapping a screensaver inside a WMP visualization plug-in.
sheepwmp_demo.zip
SheepWMP.exe
sheepwmp_src.zip
SheepWMP
SheepWMP.NET
Properties
SheepWMP.NET.csproj.user
SheepWMP.Setup
SheepWMP.Setup.vdproj
SheepWMP.def
SheepWMP.rgs
SheepWMP.vcxproj.filters
SheepWMP.vcxproj.user
//------------------------------------------------------------------------------

#include "stdafx.h"
#include "resource.h"
#include <initguid.h>
#include "wmpplug.h"
#include "SheepWMP_h.h"
#include "SheepWMP_i.c"
#include "SheepWMP.h"

//------------------------------------------------------------------------------

CComModule _Module;

//------------------------------------------------------------------------------

BEGIN_OBJECT_MAP(ObjectMap)
OBJECT_ENTRY(CLSID_SheepWMP, CSheepWMP)
END_OBJECT_MAP()

//------------------------------------------------------------------------------

HINSTANCE gThisInstance = NULL ;

//------------------------------------------------------------------------------

extern "C"
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
{
    if (dwReason == DLL_PROCESS_ATTACH)
    {
		gThisInstance = hInstance ;

        _Module.Init(ObjectMap, hInstance, &LIBID_SHEEPWMPLib);
        DisableThreadLibraryCalls(hInstance);
    }
    else if (dwReason == DLL_PROCESS_DETACH)
        _Module.Term();
    return TRUE;    // ok
}

//------------------------------------------------------------------------------

STDAPI DllCanUnloadNow(void)
{
    return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

//------------------------------------------------------------------------------

STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
{
    return _Module.GetClassObject(rclsid, riid, ppv);
}

//------------------------------------------------------------------------------

STDAPI DllRegisterServer(void)
{
    // registers object, typelib and all interfaces in typelib

    HRESULT hr = _Module.RegisterServer();

    // Notify WMP that plugin has been added

    WMPNotifyPluginAddRemove();

    return hr;
}

//------------------------------------------------------------------------------

STDAPI DllUnregisterServer(void)
{
    HRESULT hr = _Module.UnregisterServer();

    // Notify WMP that plugin has been removed

    WMPNotifyPluginAddRemove();

    return hr;
}

//------------------------------------------------------------------------------

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Justin Hallet
Web Developer
Australia Australia
Developing windows applications for over 15 years now starting on Win 3.1 with Object Oriented Pascal, progressed to C++ and OWL, in 1996 switch to MFC and never looked back, now focusing on .NET/Mono.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.150427.4 | Last Updated 15 Jul 2011
Article Copyright 2006 by Justin Hallet
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid