jack3 schrieb:
> I want to make a top-most window like taskmanager in winxp by fltk.
> 
> u know a window always on top most even without focus on it.

You need to use the windows functions, look at this:

//===============================================================================
#include <FL/Fl.H>
#include <FL/x.H>
#include <Fl/Fl_Window.H>
#include <windows.h>

//----------------------------------------------------------------------------
void Show_Topmost(Fl_Window* pWindow)
{
        HWND hWnd= fl_xid(pWindow);     
        ShowWindow(hWnd, SW_SHOWNORMAL);
    SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
}

//----------------------------------------------------------------------------
bool Is_Topmost(Fl_Window* pWindow)
{
        HWND hWnd= fl_xid(pWindow);     
        WINDOWINFO pwi;
        if (GetWindowInfo(hWnd, &pwi)) return pwi.dwExStyle & WS_EX_TOPMOST;
        else return false;      
}

//----------------------------------------------------------------------------
void Clear_Topmost(Fl_Window* pWindow)
{
        HWND hWnd= fl_xid(pWindow);     
        ShowWindow(hWnd, SW_SHOWNORMAL);
    SetWindowPos(hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
}

//----------------------------------------------------------------------------
void Show_Foreground(Fl_Window* pWindow)
{
        HWND hWnd= fl_xid(pWindow);     
        ShowWindow(hWnd, SW_SHOWNORMAL);
        if (GetForegroundWindow() != hWnd)
    {
        DWORD fgwpid = GetWindowThreadProcessId(GetForegroundWindow(),NULL);
       DWORD mypid  = GetWindowThreadProcessId(hWnd, NULL);
       AttachThreadInput(mypid, fgwpid, TRUE);
       BringWindowToTop(hWnd);
       SetForegroundWindow(hWnd);
       AttachThreadInput(mypid, fgwpid, FALSE);
    }
}

//----------------------------------------------------------------------------
bool Is_Foreground(Fl_Window* pWindow)
{
        return GetForegroundWindow()== fl_xid(pWindow);
}

//----------------------------------------------------------------------------
void Show_Background(Fl_Window* pWindow)
{
        HWND hWnd= fl_xid(pWindow);     
        ShowWindow(hWnd, SW_SHOWNORMAL);
    SetWindowPos(hWnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
}

_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to