Click here to Skip to main content
12,456,128 members (54,609 online)
Click here to Skip to main content

Stats

78.7K views
2.7K downloads
52 bookmarked
Posted

Using screensavers inside the Windows Media Player

, 15 Jul 2011 CPOL
Wrapping a screensaver inside a WMP visualization plug-in.
SheepWMP.exe
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.

You may also be interested in...

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