Example #1
0
int beginPlugin(HINSTANCE h_instance)
{
    WNDCLASS wc;
    ZeroMemory(&wc, sizeof(wc));
    wc.lpfnWndProc = PluginProc;
    wc.hInstance = h_instance;
    wc.lpszClassName = pluginInfo(APPNAME);
    RegisterClass(&wc);

    hPluginWnd = CreateWindowEx(
        WS_EX_TOOLWINDOW,
        pluginInfo(APPNAME),
        NULL,
        WS_POPUP|WS_ICONIC,
        -4, -4, 0, 0,
        HWND_MESSAGE,
        NULL,
        h_instance,
        NULL
    );

    hProcess = GetCurrentProcess();
    SendMessage(GetBBWnd(), BB_REGISTERMESSAGE, (WPARAM)hPluginWnd, (LPARAM)bb_messages);
    return 0;
}
Example #2
0
void BBP_edit_file(const char *path)
{
    if (BBVERSION_LEAN) {
        SendMessage(GetBBWnd(), BB_EDITFILE, (WPARAM)-1, (LPARAM)path);
    } else {
        char szTemp[MAX_PATH];
        GetBlackboxEditor(szTemp);
        BBExecute(NULL, NULL, szTemp, path, NULL, SW_SHOWNORMAL, false);
    }
}
Example #3
0
   void handle_task_timer(void) {
	   KillTimer(m_hwnd, TASK_RISE_TIMER);
	   if (NULL == task_over) return;

	   DWORD ThreadID1 = GetWindowThreadProcessId(GetForegroundWindow(), NULL);
	   DWORD ThreadID2 = GetCurrentThreadId();
	   if (ThreadID1 != ThreadID2) {
		   AttachThreadInput(ThreadID1, ThreadID2, TRUE);
		   SetForegroundWindow(m_hwnd);
		   AttachThreadInput(ThreadID1, ThreadID2, FALSE);
	   }
	   PostMessage(GetBBWnd(), BB_BRINGTOFRONT, 0, (LPARAM)task_over);
   }
void bbTooltip::Start(HINSTANCE h_host_instance, HWND h_host, bbTooltipInfo *p_info)
{
    WNDCLASS wc;
    m_bInitial = true;
    m_WindowName = "_bbTooltip";
    m_hCore = GetBBWnd();

    ZeroMemory((void*)&m_TipList, sizeof(m_TipList));

    m_hostInstance = h_host_instance;
    m_hHost = h_host;
    m_pInfo = p_info;

    ZeroMemory(&wc,sizeof(wc));
    wc.lpfnWndProc = _WndProc;
    wc.hInstance = m_hostInstance;
    wc.lpszClassName = m_WindowName;
    //wc.style = CS_SAVEBITS;
    RegisterClass(&wc);

    m_TipHwnd = CreateWindowEx(
        WS_EX_TOOLWINDOW,
        m_WindowName,
        NULL,
        WS_POPUP,
        0,
        0,
        0,
        0,
        NULL,
        NULL,
        m_hostInstance,
        NULL);

    SetWindowLongPtr(m_TipHwnd, GWLP_USERDATA, (LONG_PTR)this);

    m_hSecondaryBuf = CreateCompatibleDC(NULL);
    m_hBitmapNull = (HBITMAP)SelectObject(m_hSecondaryBuf, CreateCompatibleBitmap(m_hSecondaryBuf, 2, 2));
    m_hFontNull = (HFONT)SelectObject(m_hSecondaryBuf, CreateStyleFont(m_pInfo->pStyle));
    SetBkMode(m_hSecondaryBuf, TRANSPARENT);

    ZeroMemory(&m_bmpInfo, sizeof(m_bmpInfo));
    m_bmpInfo.biSize = sizeof(m_bmpInfo);
    m_bmpInfo.biPlanes = 1;
    m_bmpInfo.biCompression = BI_RGB;
    m_bmpInfo.biWidth = _MAX_WIDTH;
    m_bmpInfo.biHeight = _MAX_HEIGHT;

    UpdateSettings();
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//beginPlugin
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
int beginPlugin(HINSTANCE hMainInstance)
{
	if (plugin_hwnd_blackbox)
	{
		MessageBox(plugin_hwnd_blackbox, "Dont load me twice!", szAppName, MB_OK|MB_SETFOREGROUND);
		return 1;
	}

	//Deal with instances
	plugin_instance_plugin = hMainInstance;
	plugin_hwnd_blackbox = GetBBWnd();

	const char *bbv = GetBBVersion();
	if (0 == _memicmp(bbv, "bblean", 6)) BBVersion = BBVERSION_LEAN;
	else
	if (0 == _memicmp(bbv, "bb", 2)) BBVersion = BBVERSION_XOB;
	else BBVersion = BBVERSION_09X;

	//Deal with os info
	plugin_getosinfo();

#ifdef BBINTERFACE_ALPHA_SOFTWARE
	int result = BBMessageBox(plugin_hwnd_blackbox,
		"WARNING!\n\n"
		"This is ALPHA software! Use at your own risk!\n\n"
		"The authors are not responsible in the event that:\n - your configuration is lost,\n - your computer blows up,\n - you are hit by a truck, or\n - anything else at all.\n\n"
		"Do you wish to continue loading this ALPHA software?",
		"BBInterface ALPHA Warning",
		MB_ICONWARNING|MB_DEFBUTTON2|MB_YESNO);
	if (result != IDYES) return 0;
#endif

	//Startup
	plugin_load = true;
	plugin_startup();

	return 0;
}
Example #6
0
int beginPlugin(HINSTANCE hPluginInstance)
{
    if (BBhwnd)
    {
        MessageBox(NULL, "Dont load me twice!", szAppName, MB_OK|MB_TOPMOST|MB_SETFOREGROUND);
        return 1;
    }

    BBhwnd = GetBBWnd();

    if (0 == memicmp(GetBBVersion(), "bblean", 6))
    {
        MessageBox(NULL, "This plugin is not required with bblean", szAppName, MB_OK|MB_TOPMOST|MB_SETFOREGROUND);
        return 1;
    }


    WNDCLASS wc;
    ZeroMemory(&wc, sizeof(wc));
    wc.lpfnWndProc = BBNoteProc;            // our window procedure
    wc.hInstance = hPluginInstance;
    wc.lpszClassName = szAppName;           // our window class name
    RegisterClass(&wc);
    
    hNoteWnd = CreateWindowEx(
        WS_EX_TOOLWINDOW,                   // exstyles
        wc.lpszClassName,                   // our window class name
        NULL,                               // use description for a window title
        WS_POPUP,
        0, 0,                               // position
        0, 0,                               // width & height of window
        NULL,                               // parent window
        NULL,                               // no menu
        (HINSTANCE)wc.hInstance,            // hInstance of DLL
        NULL);

    return 0;
}
Example #7
0
int beginPlugin(HINSTANCE hPluginInstance)
{
    if (BBhwnd)
    {
        MessageBox(NULL, "Dont load me twice!", szAppName, MB_OK|MB_TOPMOST|MB_SETFOREGROUND);
        return 1;
    }

    g_hInstance = hPluginInstance;
    usingNT = 0 == (GetVersion() & 0x80000000);
    BBhwnd = GetBBWnd();

    WNDCLASS wc;
    ZeroMemory(&wc, sizeof(wc));
    wc.lpfnWndProc = HotkeyProc;    // our window procedure
    wc.hInstance = g_hInstance;     
    wc.lpszClassName = szAppName;   // our window class name

    if (!RegisterClass(&wc))
        return 1;

    CreateWindowEx(
        WS_EX_TOOLWINDOW,       // exstyles
        wc.lpszClassName,       // our window class name
        NULL,                   // use description for a window title
        WS_POPUP,
        0, 0,                   // position
        0, 0,                   // width & height of window
        NULL,                   // parent window
        NULL,                   // no menu
        g_hInstance,        // hInstance of DLL
        NULL
        );

    return 0;
}
Example #8
0
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//beginPlugin
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
int beginPlugin(HINSTANCE hMainInstance)
{
	if (plugin_hwnd_blackbox)
	{
		MessageBox(plugin_hwnd_blackbox, "Dont load me twice!", szAppName, MB_OK|MB_SETFOREGROUND);
		return 1;
	}

	//Deal with instances
	plugin_instance_plugin = hMainInstance;
	plugin_hwnd_blackbox = GetBBWnd();

	const char *bbv = GetBBVersion();
	
	if (NULL != strstr(bbv, "Clean")) BBVersion = BBVERSION_CLEAN;
	else
	if (0 == memicmp(bbv, "bblean", 6)) BBVersion = BBVERSION_LEAN;
	else
	if (0 == memicmp(bbv, "bb", 2)) BBVersion = BBVERSION_XOB;
	else BBVersion = BBVERSION_09X;

	//Deal with os info
	plugin_getosinfo();

#ifdef BBINTERFACE_ALPHA_SOFTWARE
	int result = MessageBox(plugin_hwnd_blackbox,
		"WARNING!\n\n"
		"This is ALPHA software! Use at your own risk!\n\n"
		"The authors are not responsible in the event that:\n - your configuration is lost,\n - your computer blows up,\n - you are hit by a truck, or\n - anything else at all.\n\n"
		"Do you wish to continue loading this ALPHA software?",
		"BBInterface ALPHA Warning",
		MB_ICONWARNING|MB_DEFBUTTON2|MB_YESNO);
	if (result != IDYES) return 0;
#endif
	if(!com_initialized){
		if(SUCCEEDED(::CoInitialize(NULL)) ){
			_Module.Init(NULL, ::GetModuleHandle(NULL),NULL);
			com_initialized = true;
		}else{
			MessageBox(0, "Error initializing COM", szAppName, MB_OK | MB_ICONERROR | MB_TOPMOST);
			return 1;
		}
	}

	//get font list 
	if(!flist_initialized){
		flist_initialized = true;
		HDC hdc;
		LOGFONT lf;
		lf.lfCharSet = DEFAULT_CHARSET;
		lf.lfPitchAndFamily = 0;
		lf.lfFaceName[0]=0;
		hdc = GetDC(plugin_hwnd_blackbox);
		EnumFontFamiliesEx(hdc,&lf,(FONTENUMPROC)EnumFontFamExProc,NULL,0);
		ReleaseDC(plugin_hwnd_blackbox,hdc);
		fontList.sort();
	}

	
	
	//Startup
	plugin_load = true;

	
	plugin_startup();

	return 0;
}
Example #9
0
LRESULT slit_info::wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, LRESULT *ret)
{
    static unsigned int msgs[] = { BB_REDRAWGUI, 0 };
    PluginInfo *p, **pp;

    if (ret)
        return *ret;

    switch(message)
    {
        //=============================================

        case WM_CREATE:
            SendMessage(GetBBWnd(), BB_REGISTERMESSAGE, (WPARAM)hwnd, (LPARAM)msgs);
            break;

        case WM_DESTROY:
            SendMessage(GetBBWnd(), BB_UNREGISTERMESSAGE, (WPARAM)hwnd, (LPARAM)msgs);
            if (this->bufbmp)
                DeleteObject(this->bufbmp), this->bufbmp = NULL;
            SetDesktopMargin(hwnd, 0, 0);
            for (pp = &this->m_pInfo; NULL != (p = *pp); *pp = p->next, m_free(p));
            break;

        //=============================================

        case SLIT_ADD:
            //pdbg ((HWND) lParam, "add");
            for (pp = &this->m_pInfo; NULL != (p = *pp); pp = &p->next);
            *pp = p = (PluginInfo*)m_alloc(sizeof(struct PluginInfo));
            memset(p, 0, sizeof *p);
            /* if (!IsBadStringPtr((const char*)wParam, 80))
                ... */
            p->hwnd = (HWND)lParam;
            SetWindowLong(p->hwnd, GWL_STYLE,
                (GetWindowLong(p->hwnd, GWL_STYLE) & ~WS_POPUP) | WS_CHILD);
            SetParent(p->hwnd, hwnd);
            SetTimer(hwnd, 2, 20, NULL);
            break;

        case SLIT_REMOVE:
            //pdbg ((HWND) lParam, "remove");
            for (pp = &this->m_pInfo; NULL != (p = *pp) && p->hwnd != (HWND)lParam; pp = &p->next);
            if (p) {
                if (IsWindow(p->hwnd)) {
                    SetParent(p->hwnd, NULL);
                    SetWindowLong(p->hwnd, GWL_STYLE,
                        (GetWindowLong(p->hwnd, GWL_STYLE) & ~WS_CHILD) | WS_POPUP);
                }
                *pp = p->next;
                m_free(p);
            }
            SetTimer(hwnd, 2, 20, NULL);
            this->suspend_autohide = 0;
            break;

        case SLIT_UPDATE:
            //pdbg ((HWND) lParam, "update");
            SetTimer(hwnd, 2, 20, NULL);
            break;

        case WM_TIMER:
            if (2 == wParam) {
                KillTimer(hwnd, wParam);
                this->calculate_frame();
            }
            break;

        //=============================================
        // support bbStyleMaker under bbLean 1.16
        case WM_COPYDATA:
            return BBReceiveData(hwnd, lParam, NULL);

        case BB_SETSTYLESTRUCT:
            if (SN_SLIT == wParam)
                memcpy(&m_style, (void*)lParam, sizeof m_style);
            break;

        case BB_REDRAWGUI:
            if (wParam & BBRG_SLIT)
            {
                int m = margin;
                int p = padding;
                if (this->bufbmp)
                    DeleteObject(this->bufbmp), this->bufbmp = NULL;

                if (bblean_version >= 1170) {
                    getStyleSettings();
                } else {
                    // Workaround under bbLean 1.16
                    padding = m_style.marginWidth;
                    margin = m_style.marginWidth + m_style.borderWidth;
                }

                if (m != margin || p != padding)
                    this->calculate_frame();
                else
                    InvalidateRect(hwnd, NULL, FALSE);
            }
            break;

        case BB_RECONFIGURE:
            if (this->bufbmp)
                DeleteObject(this->bufbmp), this->bufbmp = NULL;
            getStyleSettings();
            this->getRCSettings();
            SetTimer(hwnd, 2, 20, NULL);
            break;

        //=============================================

        case WM_PAINT:
        {
            PAINTSTRUCT ps;
            HDC hdc = BeginPaint(hwnd, &ps);
            HDC buf = CreateCompatibleDC(NULL);
            HGDIOBJ otherbmp;

            if (this->bufbmp
             && (this->bmp_width != this->width || this->bmp_height != this->height))
                DeleteObject(this->bufbmp), this->bufbmp = NULL;

            if (NULL == this->bufbmp) {
                this->bufbmp = CreateCompatibleBitmap(hdc,
                    this->bmp_width = this->width,
                    this->bmp_height = this->height
                    );
                otherbmp = SelectObject(buf, this->bufbmp);
                RECT r = { 0, 0, this->bmp_width, this->bmp_height };
                MakeStyleGradient(buf, &r, &m_style, m_style.bordered);
            } else {
                otherbmp = SelectObject(buf, this->bufbmp);
            }

            BitBltRect(hdc, buf, &ps.rcPaint);
            SelectObject(buf, otherbmp);
            DeleteDC(buf);
            EndPaint(hwnd, &ps);
            break;
        }

        //=============================================

        // Right mouse button clicked?
        case WM_RBUTTONUP:
            this->show_menu (true);
            break;

        case WM_LBUTTONDBLCLK:
            BBP_set_autoHide(this, false == this->autoHide);
            this->show_menu (false);
            break;
    
        //=============================================
        default:
            return DefWindowProc(hwnd, message, wParam, lParam);
    }

    return 0;
}
Example #10
0
int beginPlugin(HINSTANCE hPluginInstance)
{
	WNDCLASS wc;
	hwndBlackbox = GetBBWnd();
	hInstance = hPluginInstance;

	ZeroMemory(&osvinfo, sizeof(osvinfo));
	osvinfo.dwOSVersionInfoSize = sizeof (osvinfo);
	GetVersionEx(&osvinfo);
	usingWin2kXP =
		osvinfo.dwPlatformId == VER_PLATFORM_WIN32_NT
		&& osvinfo.dwMajorVersion > 4;

	// Register the window class...
	ZeroMemory(&wc,sizeof(wc));
	wc.lpfnWndProc = WndProc;			// our window procedure
	wc.hInstance = hPluginInstance;		// hInstance of .dll
	wc.lpszClassName = szAppName;		// our window class name
	if (!RegisterClass(&wc)) {
		MessageBox(hwndBlackbox, "Error registering window class", szAppName, MB_OK | MB_ICONERROR | MB_TOPMOST);
		return 1;
	}

	// Get plugin and style settings...
	ReadRCSettings();

	if(!loadPlayerControl(hPluginInstance, playerType)){
		MessageBox(hwndBlackbox, "Player control plugin not found", szAppName, MB_OK | MB_ICONERROR | MB_TOPMOST);
		return 1;
	}

	GetStyleSettings();
	dragging = false;
	track_needsupdate = true;
	knob_needsupdate = true;

	ScreenWidth  = GetSystemMetrics(SM_CXVIRTUALSCREEN);
	ScreenHeight = GetSystemMetrics(SM_CYVIRTUALSCREEN);

	// Create the window...
	hwndPlugin = CreateWindowEx(
			usingWin2kXP ? WS_EX_TOOLWINDOW | WS_EX_LAYERED : WS_EX_TOOLWINDOW, // window style
			szAppName, // our window class name
			NULL, // NULL -> does not show up in task manager!
			WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, // window parameters
			xpos, // x position
			ypos, // y position
			width, // window width
			height, // window height
			NULL, // parent window
			NULL, // no menu
			hPluginInstance, // hInstance of .dll
			NULL);

	if (!hwndPlugin){						   
		MessageBox(0, "Error creating window", szAppName, MB_OK | MB_ICONERROR | MB_TOPMOST);
		// Unregister Blackbox messages...
		SendMessage(hwndBlackbox, BB_UNREGISTERMESSAGE, (WPARAM)hwndPlugin, (LPARAM)msgs);
		return 1;
	}

	// Register to receive Blackbox messages...
	SendMessage(hwndBlackbox, BB_REGISTERMESSAGE, (WPARAM)hwndPlugin, (LPARAM)msgs);
	// Make the window sticky
	MakeSticky(hwndPlugin);
	// Make the window AlwaysOnTop?
	if (alwaysOnTop) SetWindowPos(hwndPlugin, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE);

	SetWindowModes();

	// Show the window and force it to update...
	ShowWindow(hwndPlugin, SW_SHOW);
	InvalidateRect(hwndPlugin, NULL, true);

  	//====================

	INITCOMMONCONTROLSEX ic;
	ic.dwSize = sizeof(INITCOMMONCONTROLSEX);
	ic.dwICC = ICC_BAR_CLASSES;

        if (InitCommonControlsEx(&ic))
        { // Load "tab" controls, including tooltips.
	        hToolTips = CreateWindowEx(
		        WS_EX_TOPMOST,
		        TOOLTIPS_CLASS, // "tooltips_class32"
		        NULL, //"BBSBTT",
		        WS_POPUP | TTS_ALWAYSTIP | TTS_NOPREFIX,
		        CW_USEDEFAULT,
		        CW_USEDEFAULT,
		        CW_USEDEFAULT,
		        CW_USEDEFAULT,
		        NULL,
		        NULL,
		        hPluginInstance,
		        NULL);

	        SendMessage(hToolTips, TTM_SETMAXTIPWIDTH, 0, 300);

	        //SendMessage(hToolTips, TTM_SETDELAYTIME, TTDT_AUTOMATIC, 200);

	        SendMessage(hToolTips, TTM_SETDELAYTIME, TTDT_AUTOPOP, 4000);
	        SendMessage(hToolTips, TTM_SETDELAYTIME, TTDT_INITIAL, 120);
	        SendMessage(hToolTips, TTM_SETDELAYTIME, TTDT_RESHOW,   60);

                if (NULL != hToolTips)
                      SetAllowTip(allowtip);
                else
                      SetAllowTip(false);
	} 
	else
        SetAllowTip(false);

	// Start the monitoring threads...
	hThread_Time = CreateThread(NULL, 0, TimeProc, NULL, 0, &dwThreadId_Time);

  return 0;
}
Example #11
0
LRESULT CALLBACK BBP_WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    static UINT msgs[] = { BB_RECONFIGURE, BB_BROADCAST, BB_DESKCLICK, 0};

    LRESULT Result = 0;
    plugin_info *PI  = (plugin_info *)GetWindowLongPtr(hwnd, 0);

    //dbg_printf("message %x", message);

    if (NULL == PI)
    {
        if (WM_NCCREATE == message)
        {
            // bind the window to the structure
            PI = (plugin_info *)((CREATESTRUCT*)lParam)->lpCreateParams;
            PI->hwnd = hwnd;
            SetWindowLongPtr(hwnd, 0, (LONG_PTR)PI);
        }
        return DefWindowProc(hwnd, message, wParam, lParam);
    }

    switch (message)
    {
        case WM_CREATE:
            SendMessage(GetBBWnd(), BB_REGISTERMESSAGE, (WPARAM)hwnd, (LPARAM)msgs);
            MakeSticky(hwnd);
            goto pass_nothing;

        case WM_DESTROY:
            SendMessage(GetBBWnd(), BB_UNREGISTERMESSAGE, (WPARAM)hwnd, (LPARAM)msgs);
            RemoveSticky(hwnd);
            goto pass_nothing;

        // ==========
        case BB_BROADCAST:
        {
            const char *temp = (LPCSTR)lParam;
            int f, len;

            if (0 == stricmp(temp, "@BBShowPlugins")) {
                PI->toggled_hidden = false;
                BBP_set_window_modes(PI);
                goto pass_result;
            }
            if (0 == stricmp(temp, "@BBHidePlugins")) {
                if (PI->pluginToggle) {
                    PI->toggled_hidden = true;
                    BBP_set_window_modes(PI);
                }
                goto pass_result;
            }

            if ('@' != *temp++)
                goto pass_nothing;

            len = PI->broam_key_len;
            if (len && 0 == memicmp(temp, PI->broam_key, len) && '.' == temp[len]) {
                f = 0;
                temp += len + 1;
                goto do_broam;
            }

            if (PI->next)
                goto pass_nothing;

            len = PI->broam_key_len_common;
            if (len && 0 == memicmp(temp, PI->broam_key, len)) {
                f = BBP_BROAM_COMMON;
                temp += len;
                goto do_broam;
            }

            goto pass_nothing;

        do_broam:
            f |= BBP_handle_broam(PI, temp);
            PI->process_broam(_THIS_ temp, f);
            goto pass_result;
        }

        // ==========

        case BB_DESKCLICK:
            if (lParam == 0
             && PI->clickRaise
             && false == PI->alwaysOnTop
             && false == PI->inSlit)
                SetWindowPos(hwnd, HWND_TOP,
                    0,0,0,0, SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOSIZE);
            goto pass_nothing;

        // ==========

        case WM_WINDOWPOSCHANGING:
            if (PI->is_moving) {
                if (false == PI->inSlit
                 && 0 == (0x8000 & GetAsyncKeyState(VK_SHIFT)))
				 SnapWindowToEdge((WINDOWPOS*)lParam, PI->snapWindow, true);
                if (PI->is_sizing) {
                    WINDOWPOS* wp = (WINDOWPOS*)lParam;
                    if (wp->cx < 12) wp->cx = 12;
                    if (wp->cy < 12) wp->cy = 12;
                }
            }
            goto pass_nothing;

        case WM_WINDOWPOSCHANGED:
            if (PI->is_sizing) {
                WINDOWPOS* wp = (WINDOWPOS*)lParam;
                PI->width = wp->cx;
                PI->height = wp->cy;
                InvalidateRect(hwnd, NULL, FALSE);
            }
			SnapWindowToEdge((WINDOWPOS*)lParam, PI->snapWindow, true);
            goto pass_nothing;

        case WM_ENTERSIZEMOVE:
            PI->is_moving = true;
            goto pass_nothing;

        case WM_EXITSIZEMOVE:
            BBP_exit_moving(PI);
            BBP_set_autoHide(PI, PI->autoHide);
            if (PI->inSlit)
                SendMessage(PI->hSlit, SLIT_UPDATE, 0, (LPARAM)PI->hwnd);
            goto pass_nothing;

        // ==========
        case WM_LBUTTONDOWN:
            SetFocus(hwnd);
            UpdateWindow(hwnd);
            if (false == PI->inSlit && (MK_CONTROL & wParam)) {
                // start moving, when control-key is held down
                PostMessage(hwnd, WM_SYSCOMMAND, 0xf012, 0);
                goto pass_result;
            }
            goto pass_nothing;

        case WM_MOUSEMOVE:
            if (false == PI->mouse_over)
            {
                PI->mouse_over = true;
                set_autohide_timer(PI, true);
            }

            if (PI->auto_hidden)
            {
                PI->auto_shown = true;
                BBP_set_window_modes(PI);
                goto pass_result;
            }

            goto pass_nothing;

        case WM_TIMER:
            if (AUTOHIDE_TIMER != wParam)
                goto pass_nothing;

            if (check_mouse(hwnd))
                goto pass_result;
#if 0
            {
                POINT pt;
                GetCursorPos(&pt);
                if (PI->hMon != GetMonitorRect(&pt, NULL, GETMON_FROM_POINT))
                    goto pass_result;
            }
#endif
            if (PI->mouse_over) {
                POINT pt;
                GetCursorPos(&pt);
                ScreenToClient(hwnd, &pt);
                PostMessage(hwnd, WM_MOUSELEAVE, 0, MAKELPARAM(pt.x, pt.y));
                PI->mouse_over = false;
            }

            if (PI->auto_shown) {
                if (PI->suspend_autohide && BBVERSION_LEAN)
                    goto pass_result;
                PI->auto_shown = false;
                BBP_set_window_modes(PI);
            }

            set_autohide_timer(PI, false);
            goto pass_result;


        case BB_AUTOHIDE:
            if (PI->inSlit)
                PostMessage(PI->hSlit, message, wParam, lParam);

            if (wParam)
                PI->suspend_autohide |= lParam;
            else
                PI->suspend_autohide &= ~lParam;

            if (PI->suspend_autohide && PI->auto_hidden) {
                PI->auto_shown = true;
                BBP_set_window_modes(PI);
            }

            set_autohide_timer(PI, true);
            goto pass_result;

        case WM_CLOSE:
            goto pass_result;

        case WM_ERASEBKGND:
            Result = TRUE;
            goto pass_result;

        default:
        pass_nothing:
            return PI->wnd_proc(_THIS_ hwnd, message, wParam, lParam, NULL);
    }
pass_result:
    return PI->wnd_proc(_THIS_ hwnd, message, wParam, lParam, &Result);
}
Example #12
0
/* slit interface */
int beginPluginEx(HINSTANCE hPluginInstance, HWND hSlit)
{
    WNDCLASS wc;

    /* --------------------------------------------------- */
    /* This plugin can run in one instance only. If BBhwnd
       is set it means we are already loaded. */

    if (BBhwnd)
    {
        MessageBox(BBhwnd, "Do not load me twice!", szVersion,
                MB_OK | MB_ICONERROR | MB_TOPMOST);
        return 1; /* 1 = failure */
    }

    /* --------------------------------------------------- */
    /* grab some global information */

    BBhwnd = GetBBWnd();
    g_hInstance = hPluginInstance;
    g_hSlit = hSlit;

    if (0 == memicmp(GetBBVersion(), "bbLean", 6))
        under_bblean = true;
    else if (0 == memicmp(GetBBVersion(), "bb", 2))
        under_xoblite = true;

    /* --------------------------------------------------- */
    /* register the window class */

    memset(&wc, 0, sizeof wc);
    wc.lpfnWndProc  = WndProc;      /* window procedure */
    wc.hInstance    = g_hInstance;  /* hInstance of .dll */
    wc.lpszClassName = szAppName;    /* window class name */
    wc.hCursor      = LoadCursor(NULL, IDC_ARROW);
    wc.style        = CS_DBLCLKS;

    if (!RegisterClass(&wc))
    {
        MessageBox(BBhwnd,
            "Error registering window class", szVersion,
                MB_OK | MB_ICONERROR | MB_TOPMOST);
        return 1; /* 1 = failure */
    }

    /* --------------------------------------------------- */
    /* Zero out variables, read configuration and style */

    memset(&my, 0, sizeof my);
    ReadRCSettings();
    GetStyleSettings();

    /* --------------------------------------------------- */
    /* create the window */

    my.hwnd = CreateWindowEx(
        WS_EX_TOOLWINDOW,   /* window ex-style */
        szAppName,          /* window class name */
        NULL,               /* window caption text */
        WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, /* window style */
        0,                  /* x position */
        0,                  /* y position */
        0,                  /* window width */
        0,                  /* window height */
        NULL,               /* parent window */
        NULL,               /* window menu */
        g_hInstance,        /* hInstance of .dll */
        NULL                /* creation data */
        );

    /* set window location and properties */
    set_window_modes();

    /* show window (without stealing focus) */
    ShowWindow(my.hwnd, SW_SHOWNA);
    return 0; /* 0 = success */
}
Example #13
0
void endPlugin(HINSTANCE h_instance)
{
    DestroyWindow(hPluginWnd);
    SendMessage(GetBBWnd(), BB_UNREGISTERMESSAGE, (WPARAM)hPluginWnd, (LPARAM)bb_messages);
    UnregisterClass(pluginInfo(APPNAME), h_instance);
}
extern "C" BOOL WINAPI DllMain(HINSTANCE hi, DWORD reason, LPVOID reserved)
{
	if (reason==DLL_PROCESS_ATTACH)
	{
		hInstance = hi;
		WNDCLASS wc;
		RECT dt;

		if (BBhwnd)
		{
			MessageBox(BBhwnd, "Dont load me twice!", szAppName, MB_OK|MB_SETFOREGROUND);
			return FALSE;
		}

		const char *bbv = GetBBVersion();
		if (0 == memicmp(bbv, "bblean", 6)) BBVersion = 2;
		else
			if (0 == memicmp(bbv, "bb", 2)) BBVersion = 1;
			else BBVersion = 0;

		BBhwnd = GetBBWnd();
		set_my_path(rcpath, "bbLeanSkin.rc");

		ZeroMemory(&wc, sizeof(wc));
		wc.lpszClassName = szAppName;
		wc.hInstance = hInstance;
		wc.lpfnWndProc = WndProc;

		// ##### COMMENTED OUT DUE TO COMPATIBILITY REASONS #####
		// ###### -> WAS THIS CHECK USED TO DETECT BBLEAN? ######
		// if (NULL == GetSettingPtr(SN_WINUNFOCUS_TITLE))
		//	return FALSE;
		// ######################################################

		if (FindWindow(wc.lpszClassName, NULL) || FALSE == RegisterClass(&wc))
			return FALSE;

		// center the window
		SystemParametersInfo(SPI_GETWORKAREA, 0, &dt, 0);
		int width = 480;
		int height = 300;
		int xleft = (dt.left+dt.right-width)/2;
		int ytop = (dt.top+dt.bottom-height)/2;

		CreateWindow(
			wc.lpszClassName,
			"bbLeanSkin Log",
			//WS_OVERLAPPEDWINDOW,
			WS_POPUP|WS_CAPTION|WS_SIZEBOX|WS_SYSMENU|WS_MAXIMIZEBOX|WS_MINIMIZEBOX,
			xleft, ytop, width, height,
			NULL,
			NULL,
			wc.hInstance,
			NULL
		);
	}
	else
		if (reason==DLL_PROCESS_DETACH)
		{
			stopEngine();
			DestroyWindow(m_hwnd);
			UnregisterClass(szAppName, hInstance);
		}
	return TRUE;
}
Example #15
0
// no-slit interface
int beginPlugin(HINSTANCE hInstance)
{
    // Console.CreateConsole(OUTPUT_CONS);
    // ---------------------------------------------------
    // grab some global information

    BBhwnd          = GetBBWnd();
    //hInstance       = hPluginInstance;
    //hSlit_present   = hSlit;
    is_bblean       = 0 == my_substr_icmp(GetBBVersion(), "bblean");

    // ---------------------------------------------------
    // register the window class

    WNDCLASS wc;
    ZeroMemory(&wc, sizeof wc);

    wc.lpfnWndProc      = WndProc;      // window procedure
    wc.hInstance        = hInstance;    // hInstance of .dll
    wc.lpszClassName    = szAppName;    // window class name
    wc.hCursor          = LoadCursor(NULL, IDC_ARROW);
    wc.style            = CS_DBLCLKS;

    if (!RegisterClass(&wc))
    {
        MessageBox(BBhwnd,
                   "Error registering window class", szVersion,
                   MB_OK | MB_ICONERROR | MB_TOPMOST);
        return 1;
    }

    // ---------------------------------------------------
    // Zero out variables, read configuration and style

    ZeroMemory(&my, sizeof my);

    // ReadRCSettings();

    // ---------------------------------------------------
    // create the window

    my.hwnd = CreateWindowEx(
                  WS_EX_TOOLWINDOW,   // window ex-style
                  szAppName,          // window class name
                  NULL,               // window caption text
                  WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, // window style
                  my.xpos,            // x position
                  my.ypos,            // y position
                  my.width,           // window width
                  my.height,          // window height
                  NULL,               // parent window
                  NULL,               // window menu
                  hInstance,          // hInstance of .dll
                  NULL                // creation data
              );

    bbLuaInstance.init();
    bbLuaInstance.loadFile("bblua.lua");

    return 0;
}
Example #16
0
int beginPlugin(HINSTANCE hPluginInstance)
{
//	WNDCLASS wc;
	hwndBlackbox = GetBBWnd();
//	hInstance = hPluginInstance;

	// Register the window class...
//	ZeroMemory(&wc,sizeof(wc));
//	wc.lpfnWndProc = WndProc;			// our window procedure
//	wc.hInstance = hPluginInstance;		// hInstance of .dll
//	wc.lpszClassName = szAppName;		// our window class name
/*	if (!RegisterClass(&wc)) 
	{
		MessageBox(hwndBlackbox, "Error registering window class", szAppName, MB_OK | MB_ICONERROR | MB_TOPMOST);
		return 1;
	}
*/
	// Get plugin and style settings...
	ReadRCSettings();
	if(!hSlit) inSlit = false;
	else inSlit = wantInSlit;
	//initialize the plugin before getting style settings
	InitBBNoter();
	GetStyleSettings();
	
	// Create the window...
	hwndBBNoter = CreateWindowEx(
						WS_EX_TOOLWINDOW,								// window style
						"EDIT",										// our window class name
						NULL,											// NULL -> does not show up in task manager!
						WS_POPUP|WS_VISIBLE |ES_MULTILINE|ES_AUTOVSCROLL,										// window parameters
						xpos,											// x position
						ypos,											// y position
						width,											// window width
						height,											// window height
						NULL,											// parent window
						NULL,											// no menu
						hPluginInstance,								// hInstance of .dll
						NULL);
	if (!hwndBBNoter)
	{
//		UnregisterClass(szAppName, hPluginInstance);
		MessageBox(0, "Error creating window", szAppName, MB_OK | MB_ICONERROR | MB_TOPMOST);
		return 1;
	}


	wpEditProc = (WNDPROC)SetWindowLong(hwndBBNoter, GWL_WNDPROC,(long)EditProc);
	MakeSticky(hwndBBNoter);
	//Start the plugin timer
	mySetTimer();
	if(inSlit && hSlit)// Yes, so Let's let BBSlit know.
		SendMessage(hSlit, SLIT_ADD, NULL, (LPARAM)hwndBBNoter);
	else inSlit = false;

	setStatus();	
	// Register to receive Blackbox messages...
	SendMessage(hwndBlackbox, BB_REGISTERMESSAGE, (WPARAM)hwndBBNoter, (LPARAM)msgs);
	// Set magicDWord to make the window sticky (same magicDWord that is used by LiteStep)...
	//SetWindowLong(hwndBBNoter, GWL_USERDATA, magicDWord);
	
	// Make the window AlwaysOnTop?
	if(alwaysOnTop) SetWindowPos(hwndBBNoter, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE);
	// Show the window and force it to update...
	ShowWindow(hwndBBNoter, SW_SHOW);
	
	
	GetClientRect(hwndBBNoter, &r);

	if(drawBorder)
			{
				r.left = r.left + (bevelWidth + borderWidth);
				r.top = r.top + (bevelWidth + borderWidth);
				r.bottom = (r.bottom - (bevelWidth + borderWidth));
				r.right = (r.right - (bevelWidth + borderWidth));
			}
	SendMessage(hwndBBNoter, EM_SETRECT, 0, (LPARAM)&r);


	InvalidateRect(hwndBBNoter, NULL, true);
	
	return 0;
}