Exemplo n.º 1
0
HOOKFUNC LONG WINAPI MySetWindowLongA(HWND hWnd, int nIndex, LONG dwNewLong)
{
	debuglog(LCF_WINDOW|LCF_FREQUENT, __FUNCTION__ "(%d, 0x%X) called on 0x%X.\n", nIndex, dwNewLong, hWnd);
	if(nIndex == GWL_WNDPROC)
	{
		// the game is trying to change this window's procedure.
		// since we need it to stay replaced with our own winproc,
		// update our pointer to the original winproc instead.
		LONG rv = MyGetWindowLongA(hWnd, nIndex);
		debuglog(LCF_WINDOW|LCF_FREQUENT, __FUNCTION__ "hwndToOrigHandler[0x%X] = 0x%X.\n", hWnd, dwNewLong);
		debuglog(LCF_WINDOW|LCF_FREQUENT, __FUNCTION__ "rv = 0x%X.\n", rv);
		hwndToOrigHandler[hWnd] = (WNDPROC)dwNewLong;
		SetWindowLongA(hWnd, GWL_WNDPROC, (LONG)MyWndProcA);
		return rv;
	}
	if(nIndex == GWL_STYLE)
	{
		// some SDL apps create a window, attach d3d,
		// then modify the window style for fullscreen.
		// disallow that last step if the window has been fake-fullscreen locked.
		if(IsWindowFakeFullscreen(hWnd))
		{
			return MyGetWindowLongA(hWnd, nIndex);
		}
	}
	LONG rv = SetWindowLongA(hWnd, nIndex, dwNewLong);
	debuglog(LCF_WINDOW|LCF_FREQUENT, __FUNCTION__ "RV = 0x%X.\n", rv);
	return rv;
}
Exemplo n.º 2
0
Arquivo: updown.c Projeto: Jactry/wine
static void test_UDS_SETBUDDYINT(void)
{
    HWND updown;
    DWORD style, ret;
    CHAR text[10];

    /* cleanup buddy */
    text[0] = '\0';
    SetWindowTextA(g_edit, text);

    /* creating without UDS_SETBUDDYINT */
    updown = create_updown_control(UDS_ALIGNRIGHT, g_edit);
    /* try to set UDS_SETBUDDYINT after creation */
    style = GetWindowLongA(updown, GWL_STYLE);
    SetWindowLongA(updown, GWL_STYLE, style | UDS_SETBUDDYINT);
    style = GetWindowLongA(updown, GWL_STYLE);
    ok(style & UDS_SETBUDDYINT, "Expected UDS_SETBUDDY to be set\n");
    SendMessageA(updown, UDM_SETPOS, 0, 20);
    GetWindowTextA(g_edit, text, ARRAY_SIZE(text));
    ok(lstrlenA(text) == 0, "Expected empty string\n");
    DestroyWindow(updown);

    /* creating with UDS_SETBUDDYINT */
    updown = create_updown_control(UDS_SETBUDDYINT | UDS_ALIGNRIGHT, g_edit);
    GetWindowTextA(g_edit, text, ARRAY_SIZE(text));
    /* 50 is initial value here */
    ok(lstrcmpA(text, "50") == 0, "Expected '50', got '%s'\n", text);
    /* now remove style flag */
    style = GetWindowLongA(updown, GWL_STYLE);
    SetWindowLongA(updown, GWL_STYLE, style & ~UDS_SETBUDDYINT);
    SendMessageA(updown, UDM_SETPOS, 0, 20);
    GetWindowTextA(g_edit, text, ARRAY_SIZE(text));
    ok(lstrcmpA(text, "20") == 0, "Expected '20', got '%s'\n", text);
    /* set edit text directly, check position */
    strcpy(text, "10");
    SetWindowTextA(g_edit, text);
    ret = SendMessageA(updown, UDM_GETPOS, 0, 0);
    expect(10, ret);
    strcpy(text, "11");
    SetWindowTextA(g_edit, text);
    ret = SendMessageA(updown, UDM_GETPOS, 0, 0);
    expect(11, LOWORD(ret));
    expect(0,  HIWORD(ret));
    /* set to invalid value */
    strcpy(text, "21st");
    SetWindowTextA(g_edit, text);
    ret = SendMessageA(updown, UDM_GETPOS, 0, 0);
    expect(11, LOWORD(ret));
    expect(TRUE, HIWORD(ret));
    /* set style back */
    style = GetWindowLongA(updown, GWL_STYLE);
    SetWindowLongA(updown, GWL_STYLE, style | UDS_SETBUDDYINT);
    SendMessageA(updown, UDM_SETPOS, 0, 30);
    GetWindowTextA(g_edit, text, ARRAY_SIZE(text));
    ok(lstrcmpA(text, "30") == 0, "Expected '30', got '%s'\n", text);
    DestroyWindow(updown);
}
Exemplo n.º 3
0
void ProcessDetach()
{
    //要进行clean up
#ifdef HOOK_HOME
    if (g_bUnicode)
    {
        CleanUP_Unicode();
    }
    else
    {
        CleanUP();
    }
    
    DeleteCriticalSection(&g_cs);
#else
    if (g_bUnicode)
    {
        SetWindowLongW(g_hCalc, GWL_WNDPROC, (LONG)g_pfnOld);
    }
    else
    {
        SetWindowLongA(g_hCalc, GWL_WNDPROC, (LONG)g_pfnOld);
    }
    
#endif//end for Hook_Home
}
Exemplo n.º 4
0
MainWindow::MainWindow()
        : QMainWindow(NULL, "mainwnd",
                      WType_TopLevel | WStyle_Customize |
                      WStyle_Title | WStyle_NormalBorder| WStyle_SysMenu),
        EventReceiver(LowestPriority)
{
    m_grip	 = NULL;
    h_lay	 = NULL;
    m_bNoResize = false;

    SET_WNDPROC("mainwnd");
    m_icon = "ICQ";
    setIcon(Pict(m_icon.c_str()));
    setTitle();

#ifdef WIN32
    pMain = this;
    if (IsWindowUnicode(winId())){
        oldProc = (WNDPROC)SetWindowLongW(winId(), GWL_WNDPROC, (LONG)wndProc);
    }else{
        oldProc = (WNDPROC)SetWindowLongA(winId(), GWL_WNDPROC, (LONG)wndProc);
    }
#endif

    bar = NULL;

    main = new MainWindowWidget(this);
    setCentralWidget(main);

    lay = new QVBoxLayout(main);

    QStatusBar *status = statusBar();
    status->hide();
    status->installEventFilter(this);
}
Exemplo n.º 5
0
void MCStack::sethints()
{
	if (!opened || MCnoui || window == DNULL)
		return;
	MCStack *sptr = MCdefaultstackptr == this ? MCtopstackptr : MCdefaultstackptr;
	if (sptr != NULL && sptr != this && sptr->getw() != DNULL
	        && GetWindowLongA((HWND)window->handle.window, 0) == 0)
		SetWindowLongA((HWND)window->handle.window, 0, (LONG)sptr->getw()->handle.window);
}
Exemplo n.º 6
0
void setWndProc(QWidget *w)
{
    WNDPROC p;
    if (IsWindowUnicode(w->winId())){
        p = (WNDPROC)SetWindowLongW(w->winId(), GWL_WNDPROC, (LONG)WndProc);
    }else{
        p = (WNDPROC)SetWindowLongA(w->winId(), GWL_WNDPROC, (LONG)WndProc);
    }
    if (oldWndProc == NULL) oldWndProc = p;
}
Exemplo n.º 7
0
static void MCIWND_Create(HWND hWnd, LPCREATESTRUCTA cs)
{
   MCI_DGV_OPEN_PARMSA	mdopn;
   MCI_DGV_RECT_PARMS	mdrct;
   MMRESULT		mmr;
   int			cx, cy;
   HWND			hChld;
   MCIWndInfo* 		mwi = (MCIWndInfo*)cs->lpCreateParams;

   SetWindowLongA(hWnd, 0, (LPARAM)mwi);
   mwi->hWnd = hWnd;

   /* now open MCI player for AVI file */
   memset(&mdopn, 0, sizeof(mdopn));
   mdopn.lpstrElementName = mwi->lpName;
   mdopn.dwStyle = WS_VISIBLE|WS_CHILD;
   mdopn.hWndParent = hWnd;

   mmr = mciSendCommandA(0,  MCI_OPEN, MCI_OPEN_ELEMENT|MCI_DGV_OPEN_PARENT|MCI_DGV_OPEN_WS, (LPARAM)&mdopn);
   if (mmr) {
      MessageBoxA(GetTopWindow(hWnd), "Cannot open file", "MciWnd", MB_OK);
      return;
   }
   mwi->mci = mdopn.wDeviceID;

   /* grab AVI window size */
   memset(&mdrct, 0, sizeof(mdrct));
   mmr = mciSendCommandA(mwi->mci,  MCI_WHERE, MCI_DGV_WHERE_DESTINATION, (LPARAM)&mdrct);
   if (mmr) {
      WARN("Cannot get window rect\n");
      return;
   }
   cx = mdrct.rc.right - mdrct.rc.left;
   cy = mdrct.rc.bottom - mdrct.rc.top;

   AdjustWindowRect(&mdrct.rc, GetWindowLongA(hWnd, GWL_STYLE), FALSE);
   SetWindowPos(hWnd, 0, 0, 0, mdrct.rc.right - mdrct.rc.left,
		mdrct.rc.bottom - mdrct.rc.top + 32, SWP_NOMOVE|SWP_NOZORDER);

   /* adding the other elements: play/stop button, menu button, status */
   hChld = CreateWindowExA(0, "BUTTON", "Play", WS_CHILD|WS_VISIBLE, 0, cy, 32, 32,
			   hWnd, (HMENU)CTL_PLAYSTOP, GetWindowLongA(hWnd, GWL_HINSTANCE), 0L);
   TRACE("Get Button1: %04x\n", hChld);
   hChld = CreateWindowExA(0, "BUTTON", "Menu", WS_CHILD|WS_VISIBLE, 32, cy, 32, 32,
			   hWnd, (HMENU)CTL_MENU, GetWindowLongA(hWnd, GWL_HINSTANCE), 0L);
   TRACE("Get Button2: %04x\n", hChld);
   hChld = CreateWindowExA(0, TRACKBAR_CLASSA, "", WS_CHILD|WS_VISIBLE, 64, cy, cx - 64, 32,
			   hWnd, (HMENU)CTL_TRACKBAR, GetWindowLongA(hWnd, GWL_HINSTANCE), 0L);
   TRACE("Get status: %04x\n", hChld);
   SendMessageA(hChld, TBM_SETRANGEMIN, 0L, 0L);
   SendMessageA(hChld, TBM_SETRANGEMAX, 1L, MCIWND_Get(mwi, MCI_STATUS_LENGTH));

   /* FIXME: no need to set it if child window */
   MCIWND_SetText(mwi);
}
Exemplo n.º 8
0
static void test_dts_shownone(void)
{
    HWND hwnd;
    DWORD style;

    /* it isn't allowed to change DTS_SHOWNONE after creation */
    hwnd = create_datetime_control(0);
    style = GetWindowLongA(hwnd, GWL_STYLE);
    SetWindowLongA(hwnd, GWL_STYLE, style | DTS_SHOWNONE);
    style = GetWindowLongA(hwnd, GWL_STYLE);
    ok(!(style & DTS_SHOWNONE), "Expected DTS_SHOWNONE not to be set\n");
    DestroyWindow(hwnd);

    hwnd = create_datetime_control(DTS_SHOWNONE);
    style = GetWindowLongA(hwnd, GWL_STYLE);
    SetWindowLongA(hwnd, GWL_STYLE, style & ~DTS_SHOWNONE);
    style = GetWindowLongA(hwnd, GWL_STYLE);
    ok(style & DTS_SHOWNONE, "Expected DTS_SHOWNONE to be set\n");
    DestroyWindow(hwnd);
}
Exemplo n.º 9
0
void QWinWidget::init() 
{
    Q_ASSERT(hParent);

    if (hParent) {
	// make the widget window style be WS_CHILD so SetParent will work
	QT_WA({
	    SetWindowLong(winId(), GWL_STYLE, WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
	}, {
	    SetWindowLongA(winId(), GWL_STYLE, WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
	})
Exemplo n.º 10
0
/*************************************************************************
 *  DragAcceptFiles		[SHELL32.@]
 */
void WINAPI DragAcceptFiles(HWND hWnd, BOOL b)
{
	LONG exstyle;

	if( !IsWindow(hWnd) ) return;
	exstyle = GetWindowLongA(hWnd,GWL_EXSTYLE);
	if (b)
	  exstyle |= WS_EX_ACCEPTFILES;
	else
	  exstyle &= ~WS_EX_ACCEPTFILES;
	SetWindowLongA(hWnd,GWL_EXSTYLE,exstyle);
}
Exemplo n.º 11
0
WNDPROC SubclassWindow(HWND hWnd, WNDPROC newWndProc) {
  WNDPROC origProc;
  if (IsWindowUnicode(hWnd)) {
    origProc = (WNDPROC)GetWindowLongW(hWnd, GWL_WNDPROC);
    SetWindowLongW(hWnd, GWL_WNDPROC, (LONG)newWndProc);
  }
  else {
    origProc = (WNDPROC)GetWindowLongA(hWnd, GWL_WNDPROC);
    SetWindowLongA(hWnd, GWL_WNDPROC, (LONG)newWndProc);
  }
  return origProc;
}
Exemplo n.º 12
0
void WinDockPlugin::uninit()
{
    QWidget *main = getMainWindow();
    if (main && oldProc){
        appBarMessage(ABM_REMOVE);
        WNDPROC p;
        p = (WNDPROC)SetWindowLongW(main->winId(), GWL_WNDPROC, (LONG)oldProc);
        if (p == 0)
            p = (WNDPROC)SetWindowLongA(main->winId(), GWL_WNDPROC, (LONG)oldProc);
		oldProc = NULL;
    }
}
Exemplo n.º 13
0
static void test_updown_buddy(void)
{
    HWND updown, buddyReturn, buddy;
    WNDPROC proc;
    DWORD style;

    updown = create_updown_control(UDS_ALIGNRIGHT, g_edit);

    flush_sequences(sequences, NUM_MSG_SEQUENCES);

    buddyReturn = (HWND)SendMessageA(updown, UDM_GETBUDDY, 0 , 0 );
    ok(buddyReturn == g_edit, "Expected edit handle\n");

    buddyReturn = (HWND)SendMessageA(updown, UDM_SETBUDDY, (WPARAM) g_edit, 0);
    ok(buddyReturn == g_edit, "Expected edit handle\n");

    buddyReturn = (HWND)SendMessageA(updown, UDM_GETBUDDY, 0 , 0 );
    ok(buddyReturn == g_edit, "Expected edit handle\n");

    ok_sequence(sequences, UPDOWN_SEQ_INDEX, test_updown_buddy_seq, "test updown buddy", TRUE);
    ok_sequence(sequences, EDIT_SEQ_INDEX, add_updown_with_edit_seq, "test updown buddy_edit", FALSE);

    DestroyWindow(updown);

    buddy = create_edit_control();
    proc  = (WNDPROC)GetWindowLongPtrA(buddy, GWLP_WNDPROC);

    updown= create_updown_control(UDS_ALIGNRIGHT, buddy);
    ok(proc == (WNDPROC)GetWindowLongPtrA(buddy, GWLP_WNDPROC), "No subclassing expected\n");

    style = GetWindowLongA(updown, GWL_STYLE);
    SetWindowLongA(updown, GWL_STYLE, style | UDS_ARROWKEYS);
    style = GetWindowLongA(updown, GWL_STYLE);
    ok(style & UDS_ARROWKEYS, "Expected UDS_ARROWKEYS\n");
    /* no subclass if UDS_ARROWKEYS set after creation */
    ok(proc == (WNDPROC)GetWindowLongPtrA(buddy, GWLP_WNDPROC), "No subclassing expected\n");

    DestroyWindow(updown);

    updown= create_updown_control(UDS_ALIGNRIGHT | UDS_ARROWKEYS, buddy);
    ok(proc != (WNDPROC)GetWindowLongPtrA(buddy, GWLP_WNDPROC), "Subclassing expected\n");

    if (pSetWindowSubclass)
    {
        /* updown uses subclass helpers for buddy on >5.8x systems */
        ok(GetPropA(buddy, "CC32SubclassInfo") != NULL, "Expected CC32SubclassInfo property\n");
    }

    DestroyWindow(updown);

    DestroyWindow(buddy);
}
Exemplo n.º 14
0
void WinDockPlugin::uninit()
{
    QWidget *main = getMainWindow();
    if (main && oldProc){
        appBarMessage(ABM_REMOVE);
        if (IsWindowUnicode(pMain->winId())){
            SetWindowLongW(main->winId(), GWL_WNDPROC, (LONG)oldProc);
        }else{
            SetWindowLongA(main->winId(), GWL_WNDPROC, (LONG)oldProc);
        }
        oldProc = NULL;
    }
}
Exemplo n.º 15
0
void WinDockPlugin::init()
{
    pMain = getMainWindow();
    if (pMain){
        if (IsWindowUnicode(pMain->winId())){
            oldProc = (WNDPROC)SetWindowLongW(pMain->winId(), GWL_WNDPROC, (LONG)dockWndProc);
            if (oldProc == 0)
                oldProc = (WNDPROC)SetWindowLongA(pMain->winId(), GWL_WNDPROC, (LONG)dockWndProc);
        }
        appBarMessage(ABM_NEW);
        m_bInit = true;
        setBarState();
    }
}
Exemplo n.º 16
0
static void test_status_ownerdraw(void)
{
    HWND hWndStatus;
    int r;
    const char* statustext = "STATUS TEXT";
    LONG oldstyle;

    /* subclass the main window and make sure it is visible */
    g_wndproc_saved = (WNDPROC) SetWindowLongPtrA( g_hMainWnd, GWLP_WNDPROC,
                      (LONG_PTR)ownerdraw_test_wndproc );
    ok( g_wndproc_saved != 0, "failed to set the WndProc\n");
    SetWindowPos( g_hMainWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE);
    oldstyle = GetWindowLongA( g_hMainWnd, GWL_STYLE);
    SetWindowLongA( g_hMainWnd, GWL_STYLE, oldstyle | WS_VISIBLE);
    /* create a status child window */
    ok((hWndStatus = CreateWindowA(SUBCLASS_NAME, "", WS_CHILD|WS_VISIBLE, 0, 0, 100, 100,
                                   g_hMainWnd, NULL, NULL, 0)) != NULL, "CreateWindowA failed\n");
    /* set text */
    g_wmdrawitm_ctr = 0;
    r = SendMessageA(hWndStatus, SB_SETTEXTA, 0, (LPARAM)statustext);
    ok( r == TRUE, "Sendmessage returned %d, expected 1\n", r);
    ok( 0 == g_wmdrawitm_ctr, "got %d drawitem messages expected none\n", g_wmdrawitm_ctr);
    /* set same text, with ownerdraw flag */
    g_wmdrawitm_ctr = 0;
    r = SendMessageA(hWndStatus, SB_SETTEXTA, SBT_OWNERDRAW, (LPARAM)statustext);
    ok( r == TRUE, "Sendmessage returned %d, expected 1\n", r);
    ok( 1 == g_wmdrawitm_ctr, "got %d drawitem messages expected 1\n", g_wmdrawitm_ctr);
    /* and again */
    g_wmdrawitm_ctr = 0;
    r = SendMessageA(hWndStatus, SB_SETTEXTA, SBT_OWNERDRAW, (LPARAM)statustext);
    ok( r == TRUE, "Sendmessage returned %d, expected 1\n", r);
    ok( 1 == g_wmdrawitm_ctr, "got %d drawitem messages expected 1\n", g_wmdrawitm_ctr);
    /* clean up */
    DestroyWindow(hWndStatus);
    SetWindowLongA( g_hMainWnd, GWL_STYLE, oldstyle);
    SetWindowLongPtrA( g_hMainWnd, GWLP_WNDPROC, (LONG_PTR)g_wndproc_saved );
}
Exemplo n.º 17
0
void ShortcutsPlugin::init()
{
    if (m_bInit)
        return;
    QWidget *main = getMainWindow();
    if (main){
        if (IsWindowUnicode(main->winId())){
            oldProc = (WNDPROC)SetWindowLongW(main->winId(), GWL_WNDPROC, (LONG)keysWndProc);
        }else{
            oldProc = (WNDPROC)SetWindowLongA(main->winId(), GWL_WNDPROC, (LONG)keysWndProc);
        }
        m_bInit = true;
        applyKeys();
    }
}
Exemplo n.º 18
0
ShortcutsPlugin::~ShortcutsPlugin()
{
#ifdef WIN32
    QWidget *main = getMainWindow();
    if (main && oldProc){
        if (IsWindowUnicode(main->winId())){
            SetWindowLongW(main->winId(), GWL_WNDPROC, (LONG)oldProc);
        }else{
            SetWindowLongA(main->winId(), GWL_WNDPROC, (LONG)oldProc);
        }
    }
#endif
    releaseKeys();
    free_data(shortcutsData, &data);
}
Exemplo n.º 19
0
void MCStack::sethints()
{
	if (!opened || MCnoui || window == DNULL)
		return;
	if (flags & F_RESIZABLE)
	{
		rect.width = MCU_max(minwidth, rect.width);
		rect.width = MCU_min(maxwidth, rect.width);
		rect.height = MCU_max(minheight, rect.height);
		rect.height = MCU_min(maxheight, rect.height);
	}
	MCStack *sptr = MCdefaultstackptr == this ? MCtopstackptr : MCdefaultstackptr;
	if (sptr != NULL && sptr != this && sptr->getw() != DNULL
	        && GetWindowLongA((HWND)window->handle.window, 0) == 0)
		SetWindowLongA((HWND)window->handle.window, 0, (LONG)sptr->getw()->handle.window);
}
Exemplo n.º 20
0
void WinDockPlugin::init()
{
    if (m_bInit)
        return;
    pMain = getMainWindow();
    if (pMain){
        if (IsWindowUnicode(pMain->winId())){
            oldProc = (WNDPROC)SetWindowLongW(pMain->winId(), GWL_WNDPROC, (LONG)dockWndProc);
        }else{
            oldProc = (WNDPROC)SetWindowLongA(pMain->winId(), GWL_WNDPROC, (LONG)dockWndProc);
        }
        appBarMessage(ABM_NEW);
        m_bInit = true;
        setBarState();
        pMain->installEventFilter(this);
    }
}
Exemplo n.º 21
0
LRESULT CALLBACK HookCallback(int code, WPARAM wParam, LPARAM lParam) {
#ifdef _M_X64
	if (*(DWORD *)(lParam + 16) == 0x1EB && !HookCallbackClue)
#else
	if (*(DWORD *)(lParam + 8) == 0x1EB && !HookCallbackClue)
#endif
	{
		HookCallbackClue = 1;
		if (UnhookWindowsHook(WH_CALLWNDPROC, HookCallback)) {
#ifdef _M_X64
			lpPrevWndFunc = (WNDPROC)SetWindowLongPtr(*(HWND *)(lParam + 24), GWLP_WNDPROC, (ULONG_PTR)HookCallbackTwo);
#else
			lpPrevWndFunc = (WNDPROC)SetWindowLongA(*(HWND *)(lParam + 12), GWLP_WNDPROC, (LONG)HookCallbackTwo);
#endif
		}
	}
	return CallNextHookEx(0, code, wParam, lParam);
}
Exemplo n.º 22
0
ShortcutsPlugin::~ShortcutsPlugin()
{
#ifdef WIN32
    QWidget *main = getMainWindow();
    if (main && oldProc) {
        if (IsWindowUnicode(main->winId())) {
            SetWindowLongW(main->winId(), GWL_WNDPROC, (LONG)oldProc);
        } else {
            SetWindowLongA(main->winId(), GWL_WNDPROC, (LONG)oldProc);
        }
    }
#else
#ifndef USE_KDE
    qt_set_x11_event_filter(oldFilter);
#endif
#endif
    releaseKeys();
    free_data(shortcutsData, &data);
}
Exemplo n.º 23
0
static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
#ifdef SKYRIM_PROC_INVESTIGATION
    /* Thar be majick here -- I remembered this from DS >.< */
    switch (msg)
    {
#define DECLARE_WM(x) \
    case x: \
    { \
        LRESULT r = SKYRIM_PROC; \
        DebugMsg("-> " #x); \
        DebugMsg("  -> wParam: %X", wParam); \
        DebugMsg("  -> lParam: %X", lParam); \
        DebugMsg("  -> RETURN VALUE: %X", r); \
        return r; \
    }
#include "WM.inl"
    default:
        return SKYRIM_PROC;
    }
#endif

#ifndef SKYRIM_PROC_INVESTIGATION
    switch (msg)
    {
    case WM_ACTIVATE:
        if (wParam != WA_INACTIVE)
            for (int i = ShowCursor(FALSE); i >= 0; i = ShowCursor(FALSE));
        return DEF_PROC;
    case WM_ACTIVATEAPP:
        DebugMsg("WM_ACTIVATEAPP %X %X", wParam, GetWindowLongA(hwnd, GWL_STYLE));
        if (wParam)
        {
            LONG ws = GetWindowLongA(hwnd, GWL_STYLE) & ~WS_MINIMIZE;
            SetWindowLongA(hwnd, GWL_STYLE, ws);
        }
        return SKYRIM_PROC;
    default:
        return SKYRIM_PROC;
    }
#endif
}
Exemplo n.º 24
0
	BOOL WINAPI DetourWeSetMenu(HWND hWnd, HMENU hMenu)
	{
		if (hWnd == gWeMainWindowHandle)
		{
			// Main window menu
			gWeMainMenuHandle = hMenu;

			// Call menu initialization
			CYDWEEventData eventData;
			eventData.setEventData("main_window_handle", hWnd);
			eventData.setEventData("main_menu_handle", hMenu);
			event_array[EVENT_INIT_MENU](eventData);

			// Hook window
			pgTrueWeWindowProc = (decltype(pgTrueWeWindowProc))GetWindowLongPtrA(gWeMainWindowHandle, GWL_WNDPROC);
			SetWindowLongA(gWeMainWindowHandle, GWL_WNDPROC, reinterpret_cast<LONG>(DetourWeWindowProc));
		}

		return aero::std_call<BOOL>(pgTrueSetMenu, hWnd, hMenu);
	}
Exemplo n.º 25
0
	BOOL WINAPI DetourWeSetMenu(HWND hWnd, HMENU hMenu)
	{
		if (hWnd == gWeMainWindowHandle)
		{
			gWeMainMenuHandle = hMenu;
			int results = event_array[EVENT_INIT_MENU]([&](lua_State* L, int idx){
				lua_pushstring(L, "main_window_handle");
				lua_pushinteger(L, (lua_Integer)hWnd);
				lua_settable(L, idx);
				lua_pushstring(L, "main_menu_handle");
				lua_pushinteger(L, (lua_Integer)hMenu);
				lua_settable(L, idx);
			});

			// Hook window
			pgTrueWeWindowProc = (decltype(pgTrueWeWindowProc))GetWindowLongPtrA(gWeMainWindowHandle, GWL_WNDPROC);
			SetWindowLongA(gWeMainWindowHandle, GWL_WNDPROC, reinterpret_cast<LONG>(DetourWeWindowProc));
		}

		return base::std_call<BOOL>(pgTrueSetMenu, hWnd, hMenu);
	}
Exemplo n.º 26
0
//--------------------------------------------------------------------------
void WindowsVideoDevice::_SetWindowBordered(VeWindow::Data* pkWindow,
	VE_BOOL bBordered) noexcept
{
	VE_ASSERT(pkWindow);
	HWND hWnd = ((VeWindowData*)pkWindow->m_spDriverdata)->m_hWnd;
	DWORD dwStyle = GetWindowLongA(hWnd, GWL_STYLE);

	if (bBordered)
	{
		dwStyle &= ~STYLE_BORDERLESS;
		dwStyle |= STYLE_NORMAL;
	}
	else {
		dwStyle &= ~STYLE_NORMAL;
		dwStyle |= STYLE_BORDERLESS;
	}

	SetWindowLongA(hWnd, GWL_STYLE, dwStyle);
	SetWindowPositionInternal(pkWindow, SWP_NOCOPYBITS | SWP_FRAMECHANGED
		| SWP_NOREPOSITION | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSENDCHANGING);
}
Exemplo n.º 27
0
//******************************************************************
static bool term_notify(HWND hwnd, LPARAM lParam)
{
   int msg_code = (int) ((NMHDR FAR *) lParam)->code ;
   if (dbg_flags & DBG_WINMSGS) {
      switch (msg_code) {
      //  list messages to be ignored
      case LVN_GETDISPINFO:   //lint !e650  Constant '4294967146' out of range for operator 'case'
      case NM_CUSTOMDRAW:
      case NM_KILLFOCUS:
      case TTN_SHOW:          //lint !e650  Constant '4294967146' out of range for operator 'case'
      case TTN_POP:           //lint !e650  Constant '4294967146' out of range for operator 'case'
      case LVN_ODCACHEHINT:   //lint !e650  Constant '4294967146' out of range for operator 'case'
      case LVN_KEYDOWN:       //lint !e650  Constant '4294967146' out of range for operator 'case'
         break;
      default:
         syslog("TNOT [%s]\n", lookup_winmsg_name(msg_code)) ;
         break;
      }
   }

   switch (msg_code) {

   //**********************************************************
   //  terminal listview notifications
   //**********************************************************
   case LVN_GETDISPINFO:  //lint !e650
      // get_terminal_entry(term, lParam) ;
      myTerminal->get_terminal_entry(lParam) ;
      return true;

   case NM_CUSTOMDRAW:
      SetWindowLongA (hwnd, DWL_MSGRESULT, (LONG) myTerminal->TerminalCustomDraw(lParam));
      return true;

   default:
      // if (dbg_flags & DBG_WINMSGS)
      //    syslog("WM_NOTIFY: [%d] %s\n", msg_code, lookup_winmsg_name(msg_code)) ;
      return false;
   }
}  //lint !e715
Exemplo n.º 28
0
static void test_gettext(void)
{
    static const CHAR testtip2A[] = "testtip\ttest2";
    static const CHAR testtipA[] = "testtip";
    HWND hwnd, notify;
    TTTOOLINFOA toolinfoA;
    TTTOOLINFOW toolinfoW;
    LRESULT r;
    CHAR bufA[10] = "";
    WCHAR bufW[10] = { 0 };
    DWORD length, style;

    notify = create_parent_window();
    ok(notify != NULL, "Expected notification window to be created\n");

    /* For bug 14790 - lpszText is NULL */
    hwnd = CreateWindowExA(0, TOOLTIPS_CLASSA, NULL, 0,
                           10, 10, 300, 100,
                           NULL, NULL, NULL, 0);
    ok(hwnd != NULL, "failed to create tooltip wnd\n");

    /* use sizeof(TTTOOLINFOA) instead of TTTOOLINFOA_V1_SIZE so that adding it fails on Win9x */
    /* otherwise it crashes on the NULL lpszText */
    toolinfoA.cbSize = sizeof(TTTOOLINFOA);
    toolinfoA.hwnd = NULL;
    toolinfoA.hinst = GetModuleHandleA(NULL);
    toolinfoA.uFlags = 0;
    toolinfoA.uId = 0x1234ABCD;
    toolinfoA.lpszText = NULL;
    toolinfoA.lParam = 0xdeadbeef;
    GetClientRect(hwnd, &toolinfoA.rect);
    r = SendMessageA(hwnd, TTM_ADDTOOLA, 0, (LPARAM)&toolinfoA);
    ok(r, "got %ld\n", r);

    toolinfoA.hwnd = NULL;
    toolinfoA.uId = 0x1234abcd;
    toolinfoA.lpszText = bufA;
    r = SendMessageA(hwnd, TTM_GETTEXTA, 0, (LPARAM)&toolinfoA);
    ok(!r, "got %ld\n", r);
    ok(!*toolinfoA.lpszText, "lpszText should be empty, got %s\n", toolinfoA.lpszText);

    toolinfoA.lpszText = bufA;
    r = SendMessageA(hwnd, TTM_GETTOOLINFOA, 0, (LPARAM)&toolinfoA);
todo_wine
    ok(!r, "got %ld\n", r);
    ok(toolinfoA.lpszText == NULL, "expected NULL, got %p\n", toolinfoA.lpszText);

    /* NULL hinst, valid resource id for text */
    toolinfoA.cbSize = sizeof(TTTOOLINFOA);
    toolinfoA.hwnd = NULL;
    toolinfoA.hinst = NULL;
    toolinfoA.uFlags = 0;
    toolinfoA.uId = 0x1233abcd;
    toolinfoA.lpszText = MAKEINTRESOURCEA(IDS_TBADD1);
    toolinfoA.lParam = 0xdeadbeef;
    GetClientRect(hwnd, &toolinfoA.rect);
    r = SendMessageA(hwnd, TTM_ADDTOOLA, 0, (LPARAM)&toolinfoA);
    ok(r, "failed to add a tool\n");

    toolinfoA.hwnd = NULL;
    toolinfoA.uId = 0x1233abcd;
    toolinfoA.lpszText = bufA;
    r = SendMessageA(hwnd, TTM_GETTEXTA, 0, (LPARAM)&toolinfoA);
    ok(!r, "got %ld\n", r);
    ok(!strcmp(toolinfoA.lpszText, "abc"), "got wrong text, %s\n", toolinfoA.lpszText);

    toolinfoA.hinst = (HINSTANCE)0xdeadbee;
    r = SendMessageA(hwnd, TTM_GETTOOLINFOA, 0, (LPARAM)&toolinfoA);
todo_wine
    ok(!r, "got %ld\n", r);
    ok(toolinfoA.hinst == NULL, "expected NULL, got %p\n", toolinfoA.hinst);

    r = SendMessageA(hwnd, TTM_DELTOOLA, 0, (LPARAM)&toolinfoA);
    ok(!r, "got %ld\n", r);

    /* add another tool with text */
    toolinfoA.cbSize = sizeof(TTTOOLINFOA);
    toolinfoA.hwnd = NULL;
    toolinfoA.hinst = GetModuleHandleA(NULL);
    toolinfoA.uFlags = 0;
    toolinfoA.uId = 0x1235ABCD;
    strcpy(bufA, testtipA);
    toolinfoA.lpszText = bufA;
    toolinfoA.lParam = 0xdeadbeef;
    GetClientRect(hwnd, &toolinfoA.rect);
    r = SendMessageA(hwnd, TTM_ADDTOOLA, 0, (LPARAM)&toolinfoA);
    ok(r, "Adding the tool to the tooltip failed\n");

    length = SendMessageA(hwnd, WM_GETTEXTLENGTH, 0, 0);
    ok(length == 0, "Expected 0, got %d\n", length);

    toolinfoA.hwnd = NULL;
    toolinfoA.uId = 0x1235abcd;
    toolinfoA.lpszText = bufA;
    r = SendMessageA(hwnd, TTM_GETTEXTA, 0, (LPARAM)&toolinfoA);
    ok(!r, "got %ld\n", r);
    ok(!strcmp(toolinfoA.lpszText, testtipA), "expected %s, got %p\n", testtipA, toolinfoA.lpszText);

    memset(bufA, 0x1f, sizeof(bufA));
    toolinfoA.lpszText = bufA;
    r = SendMessageA(hwnd, TTM_GETTOOLINFOA, 0, (LPARAM)&toolinfoA);
todo_wine
    ok(!r, "got %ld\n", r);
    ok(!strcmp(toolinfoA.lpszText, testtipA), "expected %s, got %p\n", testtipA, toolinfoA.lpszText);

    length = SendMessageA(hwnd, WM_GETTEXTLENGTH, 0, 0);
    ok(length == 0, "Expected 0, got %d\n", length);

    /* add another with callback text */
    toolinfoA.cbSize = sizeof(TTTOOLINFOA);
    toolinfoA.hwnd = notify;
    toolinfoA.hinst = GetModuleHandleA(NULL);
    toolinfoA.uFlags = 0;
    toolinfoA.uId = 0x1236ABCD;
    toolinfoA.lpszText = LPSTR_TEXTCALLBACKA;
    toolinfoA.lParam = 0xdeadbeef;
    GetClientRect(hwnd, &toolinfoA.rect);
    r = SendMessageA(hwnd, TTM_ADDTOOLA, 0, (LPARAM)&toolinfoA);
    ok(r, "Adding the tool to the tooltip failed\n");

    toolinfoA.hwnd = notify;
    toolinfoA.uId = 0x1236abcd;
    toolinfoA.lpszText = bufA;
    r = SendMessageA(hwnd, TTM_GETTEXTA, 0, (LPARAM)&toolinfoA);
    ok(!r, "got %ld\n", r);
    ok(!strcmp(toolinfoA.lpszText, testcallbackA), "lpszText should be an (%s) string\n", testcallbackA);

    toolinfoA.lpszText = bufA;
    r = SendMessageA(hwnd, TTM_GETTOOLINFOA, 0, (LPARAM)&toolinfoA);
todo_wine
    ok(!r, "got %ld\n", r);
    ok(toolinfoA.lpszText == LPSTR_TEXTCALLBACKA, "expected LPSTR_TEXTCALLBACKA, got %p\n", toolinfoA.lpszText);

    DestroyWindow(hwnd);
    DestroyWindow(notify);

    hwnd = CreateWindowExW(0, TOOLTIPS_CLASSW, NULL, 0,
                           10, 10, 300, 100,
                           NULL, NULL, NULL, 0);
    ok(hwnd != NULL, "failed to create tooltip wnd\n");

    toolinfoW.cbSize = sizeof(TTTOOLINFOW);
    toolinfoW.hwnd = NULL;
    toolinfoW.hinst = GetModuleHandleA(NULL);
    toolinfoW.uFlags = 0;
    toolinfoW.uId = 0x1234ABCD;
    toolinfoW.lpszText = NULL;
    toolinfoW.lParam = 0xdeadbeef;
    GetClientRect(hwnd, &toolinfoW.rect);
    r = SendMessageW(hwnd, TTM_ADDTOOLW, 0, (LPARAM)&toolinfoW);
    ok(!r, "Adding the tool to the tooltip succeeded!\n");

    if (0)  /* crashes on NT4 */
    {
        toolinfoW.hwnd = NULL;
        toolinfoW.uId = 0x1234ABCD;
        toolinfoW.lpszText = bufW;
        SendMessageW(hwnd, TTM_GETTEXTW, 0, (LPARAM)&toolinfoW);
        ok(toolinfoW.lpszText[0] == 0, "lpszText should be an empty string\n");
    }

    /* text with embedded tabs */
    toolinfoA.cbSize = sizeof(TTTOOLINFOA);
    toolinfoA.hwnd = NULL;
    toolinfoA.hinst = GetModuleHandleA(NULL);
    toolinfoA.uFlags = 0;
    toolinfoA.uId = 0x1235abce;
    strcpy(bufA, testtip2A);
    toolinfoA.lpszText = bufA;
    toolinfoA.lParam = 0xdeadbeef;
    GetClientRect(hwnd, &toolinfoA.rect);
    r = SendMessageA(hwnd, TTM_ADDTOOLA, 0, (LPARAM)&toolinfoA);
    ok(r, "got %ld\n", r);

    toolinfoA.hwnd = NULL;
    toolinfoA.uId = 0x1235abce;
    toolinfoA.lpszText = bufA;
    r = SendMessageA(hwnd, TTM_GETTEXTA, 0, (LPARAM)&toolinfoA);
    ok(!r, "got %ld\n", r);
    ok(!strcmp(toolinfoA.lpszText, testtipA), "expected %s, got %s\n", testtipA, toolinfoA.lpszText);

    /* enable TTS_NOPREFIX, original text is retained */
    style = GetWindowLongA(hwnd, GWL_STYLE);
    SetWindowLongA(hwnd, GWL_STYLE, style | TTS_NOPREFIX);

    toolinfoA.hwnd = NULL;
    toolinfoA.uId = 0x1235abce;
    toolinfoA.lpszText = bufA;
    r = SendMessageA(hwnd, TTM_GETTEXTA, 0, (LPARAM)&toolinfoA);
    ok(!r, "got %ld\n", r);
    ok(!strcmp(toolinfoA.lpszText, testtip2A), "expected %s, got %s\n", testtip2A, toolinfoA.lpszText);

    DestroyWindow(hwnd);
}
Exemplo n.º 29
0
DockWnd::DockWnd(QWidget *main)
        : QWidget(NULL, "dock",  WType_TopLevel | WStyle_Customize | WStyle_NoBorder | WStyle_StaysOnTop)
{
    setMouseTracking(true);
    connect(this, SIGNAL(toggleWin()), main, SLOT(toggleShow()));
    connect(this, SIGNAL(showPopup(QPoint)), main, SLOT(showDockPopup(QPoint)));
    connect(this, SIGNAL(doubleClicked()), main, SLOT(dockDblClicked()));
    connect(pClient, SIGNAL(event(ICQEvent*)), this, SLOT(processEvent(ICQEvent*)));
    connect(pMain, SIGNAL(iconChanged()), this, SLOT(reset()));
    connect(pMain, SIGNAL(msgChanged()), this, SLOT(reset()));
    m_state = 0;
    showIcon = State;
    QTimer *t = new QTimer(this);
    connect(t, SIGNAL(timeout()), this, SLOT(timer()));
    t->start(800);
    bNoToggle = false;
#ifdef WIN32
    QWidget::hide();
    QWidget::setIcon(Pict(pClient->getStatusIcon()));
    gDock = this;
    oldDockProc = (WNDPROC)SetWindowLongW(winId(), GWL_WNDPROC, (LONG)DockWindowProc);
    if (oldDockProc == 0)
        oldDockProc = (WNDPROC)SetWindowLongA(winId(), GWL_WNDPROC, (LONG)DockWindowProc);
    NOTIFYICONDATAA notifyIconData;
    notifyIconData.cbSize = sizeof(notifyIconData);
    notifyIconData.hIcon = topData()->winIcon;
    notifyIconData.hWnd = winId();
    notifyIconData.szTip[0] = 0;
    notifyIconData.uCallbackMessage = WM_DOCK;
    notifyIconData.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
    notifyIconData.uID = 0;
    Shell_NotifyIconA(NIM_ADD, &notifyIconData);
#else
    setMinimumSize(22, 22);
    resize(22, 22);
    bInit = false;
    inTray = false;
    inNetTray = false;

    Display *dsp = x11Display();
    WId win = winId();

    if (bEnlightenment){
        wharfIcon = NULL;
        bInit = true;
        resize(48, 48);
        setFocusPolicy(NoFocus);
        move(pMain->getDockX(), pMain->getDockY());
        reset();
        MWMHints mwm;
        mwm.flags = MWM_HINTS_DECORATIONS;
        mwm.functions = 0;
        mwm.decorations = 0;
        mwm.inputMode = 0;
        mwm.status = 0;
        Atom a = XInternAtom(dsp, "_MOTIF_WM_HINTS", False);
        XChangeProperty(dsp, win, a, a, 32, PropModeReplace,
                        (unsigned char *)&mwm, sizeof(MWMHints) / 4);
        XStoreName(dsp, win, "SIM");
        XClassHint *xch = XAllocClassHint();
        xch->res_name  = (char*)"SIM";
        xch->res_class = (char*)"Epplet";
        XSetClassHint(dsp, win, xch);
        XFree(xch);
        XSetIconName(dsp, win, "SIM");
        unsigned long val = (1 << 0) /* | (1 << 9) */ ;
        a = XInternAtom(dsp, "_WIN_STATE", False);
        XChangeProperty(dsp, win, a, XA_CARDINAL, 32, PropModeReplace,
                        (unsigned char *)&val, 1);
        val = 2;
        a = XInternAtom(dsp, "_WIN_LAYER", False);
        XChangeProperty(dsp, win, a, XA_CARDINAL, 32, PropModeReplace,
                        (unsigned char *)&val, 1);
        val = (1 << 0) | (1 << 1) | (1 << 2) | (1 << 5);
        a = XInternAtom(dsp, "_WIN_HINTS", False);
        XChangeProperty(dsp, win, a, XA_CARDINAL, 32, PropModeReplace,
                        (unsigned char *)&val, 1);
        win_name = "SIM";
        win_version = VERSION;
        win_info = "";
        while (!comms_win)
        {
            ECommsSetup(dsp);
            sleep(1);
        }
        char s[256];
        snprintf(s, sizeof(s), "set clientname %s", win_name);
        ECommsSend(s);
        snprintf(s, sizeof(s), "set version %s", win_version);
        ECommsSend(s);
        snprintf(s, sizeof(s), "set info %s", win_info);
        ECommsSend(s);
        ESYNC;

        set_background_properties(this);

        show();
        return;
    }

    wharfIcon = new WharfIcon(this);

    setBackgroundMode(X11ParentRelative);
    const QPixmap &pict = Pict(pClient->getStatusIcon());
    setIcon(pict);

    XClassHint classhint;
    classhint.res_name  = (char*)"sim";
    classhint.res_class = (char*)"Wharf";
    XSetClassHint(dsp, win, &classhint);

    Screen *screen = XDefaultScreenOfDisplay(dsp);
    int screen_id = XScreenNumberOfScreen(screen);
    char buf[32];
    snprintf(buf, sizeof(buf), "_NET_SYSTEM_TRAY_S%d", screen_id);
    Atom selection_atom = XInternAtom(dsp, buf, false);
    XGrabServer(dsp);
    Window manager_window = XGetSelectionOwner(dsp, selection_atom);
    if (manager_window != None)
        XSelectInput(dsp, manager_window, StructureNotifyMask);
    XUngrabServer(dsp);
    XFlush(dsp);
    if (manager_window != None){
        inNetTray = true;
        if (!send_message(dsp, manager_window, SYSTEM_TRAY_REQUEST_DOCK, win, 0, 0)){
            inNetTray = false;
        }
    }

    Atom kde_net_system_tray_window_for_atom = XInternAtom(dsp, "_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR", false);

    long data[1];
    data[0] = 0;
    XChangeProperty(dsp, win, kde_net_system_tray_window_for_atom, XA_WINDOW,
                    32, PropModeReplace,
                    (unsigned char*)data, 1);

    XWMHints *hints;
    hints = XGetWMHints(dsp, win);
    hints->initial_state = WithdrawnState;
    hints->icon_x = 0;
    hints->icon_y = 0;
    hints->icon_window = wharfIcon->winId();
    hints->window_group = win;
    hints->flags = WindowGroupHint | IconWindowHint | IconPositionHint | StateHint;
    XSetWMHints(dsp, win, hints);
    XFree( hints );
    XSetCommand(dsp, win, _argv, _argc);

    if (!inNetTray){
        move(-21, -21);
        resize(22, 22);
    }
    show();
#endif
    reset();
}
Exemplo n.º 30
0
LRESULT CALLBACK dockWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
    LRESULT res;
    if (msg == WM_APPBAR){
        switch (wParam){
        case ABN_FULLSCREENAPP:
            if ((lParam != 0) == bFullScreen)
                break;
            bFullScreen = (lParam != 0);
            setBarState();
            break;
        case ABN_POSCHANGED:
            if (dock->getState() != ABE_FLOAT)
                setBarState();
            break;
        }
    }
    unsigned type;
    RECT  *prc;
    RECT  rcWnd;
    QRect rc;
    unsigned oldState;
    switch (msg){
    case WM_DESTROY:
        res = oldProc(hWnd, msg, wParam, lParam);
        appBarMessage(ABM_REMOVE);
        WNDPROC p;
        p = (WNDPROC)SetWindowLongW(hWnd, GWL_WNDPROC, (LONG)oldProc);
        if (p == 0)
            p = (WNDPROC)SetWindowLongA(hWnd, GWL_WNDPROC, (LONG)oldProc);
        oldProc = NULL;
        return res;
    case WM_SHOWWINDOW:
        res = oldProc(hWnd, msg, wParam, lParam);
        if (dock->getState() != ABE_FLOAT)
            QTimer::singleShot(0, dock, SLOT(slotSetState()));
        return res;
    case WM_ACTIVATE:
        if (dock->getState() != ABE_FLOAT){
            if ((wParam == WA_INACTIVE) && dock->getAutoHide() && bAutoHideVisible){
                bAutoHideVisible = false;
                setBarState();
                dock->enableAutoHide(false);
            }
            appBarMessage(ABM_ACTIVATE);
        }
        break;
    case WM_NCMOUSEMOVE:
        if ((dock->getState() != ABE_FLOAT) && dock->getAutoHide() && !bAutoHideVisible){
            bAutoHideVisible = true;
            setBarState(true);
            dock->enableAutoHide(true);
        }
        break;
    case WM_ENTERSIZEMOVE:
        bMoving = true;
        bSizing = true;
        if (dock->getState() == ABE_FLOAT){
            bSizing = false;
            GetWindowRect(hWnd, &rcWnd);
            dock->setHeight(rcWnd.bottom - rcWnd.top);
        }
        return DefWindowProc(hWnd, msg, wParam, lParam);
    case WM_EXITSIZEMOVE:
        bMoving = false;
        oldState = dock->getState();
        dock->setState(getEdge());
        GetWindowRect(hWnd, &rcWnd);
        if ((dock->getState() == ABE_FLOAT) && (oldState != ABE_FLOAT)){
            rcWnd.bottom = rcWnd.top + dock->getHeight();
            SetWindowPos(pMain->winId(), NULL,
                         rcWnd.left, rcWnd.top, rcWnd.right - rcWnd.left, rcWnd.bottom - rcWnd.top,
                         SWP_NOZORDER | SWP_NOACTIVATE | SWP_DRAWFRAME);
        }
        dock->setWidth(rcWnd.right - rcWnd.left);
        setBarState(true);
        return DefWindowProc(hWnd, msg, wParam, lParam);
    case WM_MOVING:
    case WM_SIZING:
        if (!bMoving) break;
        prc = (RECT*)lParam;
        type = getEdge(prc);
        if (type == ABE_FLOAT){
            if (bSizing){
                prc->bottom = prc->top + dock->getHeight();
                bSizing = false;
            }
        }else{
            getBarRect(type, rc, prc);
            prc->left = rc.left();
            prc->top = rc.top();
            prc->right = rc.right();
            prc->bottom = rc.bottom();
            bSizing = true;
        }
        return 1;
    case WM_WINDOWPOSCHANGED:
        res = oldProc(hWnd, msg, wParam, lParam);
        if (dock->getState() != ABE_FLOAT)
            appBarMessage(ABM_WINDOWPOSCHANGED);
        return res;
    }
    return oldProc(hWnd, msg, wParam, lParam);
}