Skip to main content
Topic: Help Needed With Subclassing (Read 1729 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Help Needed With Subclassing

i want to try and add a lil bit of somthing to the WM_PAINT, ie, i wanna overwrite the standard win32 ghey gray windows.. with somthing a lil more nice looking, but with what i have at the min... it just locks the window up...
Code: [Select]
#include "../SDK/foobar2000.h"

LRESULT CALLBACK nWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
HWND foowind;
WNDPROC oldProcAddr;

class startup_main : public initquit
{
public:
    virtual void on_init();
    virtual void on_quit();
};

void startup_main::on_init() {
    foowind = FindWindow("FOOBAR2000_CLASS",NULL);
    oldProcAddr = (WNDPROC)SetWindowLong(foowind,GWL_WNDPROC,(long)nWndProc);
    InvalidateRect(foowind, NULL, TRUE);
}

void startup_main::on_quit() {
    SetWindowLong(foowind,GWL_WNDPROC,(long)oldProcAddr);
}

LRESULT CALLBACK nWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
    switch(uMsg) {
 case WM_PAINT: {
     HDC hdc;
     hdc = GetDCEx(hwnd, (HRGN)wParam, DCX_WINDOW|DCX_INTERSECTRGN);
     //paint code will end up here
     ReleaseDC(hwnd, hdc);
     CallWindowProc(oldProcAddr,hwnd,uMsg,wParam,lParam);
 }
 break;
 default:
     CallWindowProc(oldProcAddr,hwnd,uMsg,wParam,lParam);
 break;
    }
    return 1;
}

static service_factory_single_t<initquit,startup_main> foo;

DECLARE_COMPONENT_VERSION("Test","0.0",0)

can anyone see were im going wrong?

 

Help Needed With Subclassing

Reply #1
Subclassing is a simple way to get you banned from here for violation of forum rule #11, just like with X-Fixer, and get all your components into the banlist. "Components" that operate outside legal APIs and blow up when eg. loaded with different UI are not welcome here. If you want to change appearance of foobar2000, please write your own UI instead.

 
SimplePortal 1.0.0 RC1 © 2008-2019