Example #1
0
VOID WepWriteClientData(
    __in HWND hwnd
    )
{
    WCHAR className[256];
    LOGICAL isUnicode;

    memset(&WeServerSharedData->c, 0, sizeof(WeServerSharedData->c));
    isUnicode = IsWindowUnicode(hwnd);

    if (isUnicode)
    {
        WeServerSharedData->c.WndProc = GetWindowLongPtrW(hwnd, GWLP_WNDPROC);
        WeServerSharedData->c.DlgProc = GetWindowLongPtrW(hwnd, DWLP_DLGPROC);
    }
    else
    {
        WeServerSharedData->c.WndProc = GetWindowLongPtrA(hwnd, GWLP_WNDPROC);
        WeServerSharedData->c.DlgProc = GetWindowLongPtrA(hwnd, DWLP_DLGPROC);
    }

    if (!GetClassName(hwnd, className, sizeof(className) / sizeof(WCHAR)))
        className[0] = 0;

    WeServerSharedData->c.ClassInfo.cbSize = sizeof(WNDCLASSEX);
    GetClassInfoEx(NULL, className, &WeServerSharedData->c.ClassInfo);

    if (isUnicode)
        WeServerSharedData->c.ClassInfo.lpfnWndProc = (PVOID)GetClassLongPtrW(hwnd, GCLP_WNDPROC);
    else
        WeServerSharedData->c.ClassInfo.lpfnWndProc = (PVOID)GetClassLongPtrA(hwnd, GCLP_WNDPROC);
}
Example #2
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);
}
Example #3
0
static LRESULT WINAPI editbox_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    WNDPROC oldproc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
    static LONG defwndproc_counter = 0;
    LRESULT ret;
    struct message msg;

    msg.message = message;
    msg.flags = sent|wparam|lparam;
    if (defwndproc_counter) msg.flags |= defwinproc;
    msg.wParam = wParam;
    msg.lParam = lParam;
    msg.id     = EDITBOX_ID;

    if (message != WM_PAINT &&
        message != WM_ERASEBKGND &&
        message != WM_NCPAINT &&
        message != WM_NCHITTEST &&
        message != WM_GETTEXT &&
        message != WM_GETICON &&
        message != WM_DEVICECHANGE)
    {
        add_message(sequences, EDITBOX_SEQ_INDEX, &msg);
    }

    defwndproc_counter++;
    ret = CallWindowProcA(oldproc, hwnd, message, wParam, lParam);
    defwndproc_counter--;
    return ret;
}
Example #4
0
File: tab.c Project: devyn/wine
static LRESULT WINAPI tabSubclassProcess(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    struct subclass_info *info = (struct subclass_info *)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
    static long defwndproc_counter = 0;
    LRESULT ret;
    struct message msg;

    /* do not log painting messages */
    if (message != WM_PAINT &&
        message != WM_ERASEBKGND &&
        message != WM_NCPAINT &&
        message != WM_NCHITTEST &&
        message != WM_GETTEXT &&
        message != WM_GETICON &&
        message != WM_DEVICECHANGE)
    {
        trace("tab: %p, %04x, %08lx, %08lx\n", hwnd, message, wParam, lParam);

        msg.message = message;
        msg.flags = sent|wparam|lparam;
        if (defwndproc_counter) msg.flags |= defwinproc;
        msg.wParam = wParam;
        msg.lParam = lParam;
        add_message(sequences, TAB_SEQ_INDEX, &msg);
    }

    defwndproc_counter++;
    ret = CallWindowProcA(info->oldproc, hwnd, message, wParam, lParam);
    defwndproc_counter--;

    return ret;
}
Example #5
0
void wined3d_unregister_window(HWND window)
{
    unsigned int i;

    wined3d_mutex_lock();
    for (i = 0; i < wndproc_table.count; ++i)
    {
        if (wndproc_table.entries[i].window == window)
        {
            struct wined3d_wndproc *entry = &wndproc_table.entries[i];
            struct wined3d_wndproc *last = &wndproc_table.entries[--wndproc_table.count];

            if (entry->unicode)
            {
                if (GetWindowLongPtrW(window, GWLP_WNDPROC) == (LONG_PTR)wined3d_wndproc)
                    SetWindowLongPtrW(window, GWLP_WNDPROC, (LONG_PTR)entry->proc);
            }
            else
            {
                if (GetWindowLongPtrA(window, GWLP_WNDPROC) == (LONG_PTR)wined3d_wndproc)
                    SetWindowLongPtrA(window, GWLP_WNDPROC, (LONG_PTR)entry->proc);
            }
            if (entry != last) *entry = *last;
            wined3d_mutex_unlock();

            return;
        }
    }
    wined3d_mutex_unlock();

    ERR("Window %p is not registered with wined3d.\n", window);
}
bool zGlobalHk::PlaceWndHook(HWND hwnd)
{
	GET_HOOK(zGlobalHk).m_AppWndProc = GetWindowLongPtrA(hwnd, GWL_WNDPROC);
	SetWindowLongPtrA(hwnd, GWL_WNDPROC, (LONG)AppWndProc);

	return true;
}
Example #7
0
/***********************************************************************
 *           ICONTITLE_Paint
 */
static BOOL ICONTITLE_Paint( HWND hwnd, HWND owner, HDC hDC, BOOL bActive )
{
    RECT rect;
    HFONT hPrevFont;
    HBRUSH hBrush;
    COLORREF textColor = 0;

    if( bActive )
    {
	hBrush = GetSysColorBrush(COLOR_ACTIVECAPTION);
	textColor = GetSysColor(COLOR_CAPTIONTEXT);
    }
    else
    {
        if( GetWindowLongPtrA( hwnd, GWL_STYLE ) & WS_CHILD )
	{
	    hBrush = (HBRUSH) GetClassLongPtrW(hwnd, GCLP_HBRBACKGROUND);
	    if( hBrush )
	    {
		INT level;
		LOGBRUSH logBrush;
		GetObjectA( hBrush, sizeof(logBrush), &logBrush );
		level = GetRValue(logBrush.lbColor) +
			   GetGValue(logBrush.lbColor) +
			      GetBValue(logBrush.lbColor);
		if( level < (0x7F * 3) )
		    textColor = RGB( 0xFF, 0xFF, 0xFF );
	    }
	    else
		hBrush = GetStockObject( WHITE_BRUSH );
	}
	else
	{
	    hBrush = GetStockObject( BLACK_BRUSH );
	    textColor = RGB( 0xFF, 0xFF, 0xFF );
	}
    }

    GetClientRect( hwnd, &rect );
    DPtoLP( hDC, (LPPOINT)&rect, 2 );
    FillRect( hDC, &rect, hBrush );

    hPrevFont = SelectObject( hDC, hIconTitleFont );
    if( hPrevFont )
    {
	WCHAR buffer[80];

        INT length = GetWindowTextW( owner, buffer, sizeof(buffer)/sizeof(buffer[0]) );
        SetTextColor( hDC, textColor );
        SetBkMode( hDC, TRANSPARENT );

        DrawTextW( hDC, buffer, length, &rect, DT_CENTER | DT_NOPREFIX |
                   DT_WORDBREAK | ((bMultiLineTitle) ? 0 : DT_SINGLELINE) );

	SelectObject( hDC, hPrevFont );
    }
    return (hPrevFont != 0);
}
Example #8
0
		LRESULT Window::wndproc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
		{
			Window* window = reinterpret_cast<Window*>( GetWindowLongPtrA( hWnd, GWLP_USERDATA ) );
			if( window )
			{
				return window->msgproc( hWnd, msg, wParam, lParam );
			}

			return DefWindowProcA( hWnd, msg, wParam, lParam );
		}
Example #9
0
static IAutoComplete *test_init(void)
{
    HRESULT r;
    IAutoComplete *ac;
    IUnknown *acSource;
    LONG_PTR user_data;

    /* AutoComplete instance */
    r = CoCreateInstance(&CLSID_AutoComplete, NULL, CLSCTX_INPROC_SERVER,
                         &IID_IAutoComplete, (LPVOID*)&ac);
    if (r == REGDB_E_CLASSNOTREG)
    {
        win_skip("CLSID_AutoComplete is not registered\n");
        return NULL;
    }
    ok(r == S_OK, "no IID_IAutoComplete (0x%08x)\n", r);

    /* AutoComplete source */
    r = CoCreateInstance(&CLSID_ACLMulti, NULL, CLSCTX_INPROC_SERVER,
                        &IID_IACList, (LPVOID*)&acSource);
    if (r == REGDB_E_CLASSNOTREG)
    {
        win_skip("CLSID_ACLMulti is not registered\n");
        IAutoComplete_Release(ac);
        return NULL;
    }
    ok(r == S_OK, "no IID_IACList (0x%08x)\n", r);

    user_data = GetWindowLongPtrA(hEdit, GWLP_USERDATA);
    ok(user_data == 0, "Expected the edit control user data to be zero\n");

    /* bind to edit control */
    r = IAutoComplete_Init(ac, hEdit, acSource, NULL, NULL);
    ok(r == S_OK, "Init returned 0x%08x\n", r);

    user_data = GetWindowLongPtrA(hEdit, GWLP_USERDATA);
    ok(user_data == 0, "Expected the edit control user data to be zero\n");

    IUnknown_Release(acSource);

    return ac;
}
Example #10
0
/***********************************************************************
 *           ICONTITLE_Create
 */
HWND ICONTITLE_Create( HWND owner )
{
    HWND hWnd;
    HINSTANCE instance = (HINSTANCE)GetWindowLongPtrA( owner, GWLP_HINSTANCE );
    LONG style = WS_CLIPSIBLINGS;

    if (!IsWindowEnabled(owner)) style |= WS_DISABLED;
    if( GetWindowLongPtrA( owner, GWL_STYLE ) & WS_CHILD )
	hWnd = CreateWindowExA( 0, (LPCSTR)ICONTITLE_CLASS_ATOM, NULL,
                                style | WS_CHILD, 0, 0, 1, 1,
                                GetParent(owner), 0, instance, NULL );
    else
	hWnd = CreateWindowExA( 0, (LPCSTR)ICONTITLE_CLASS_ATOM, NULL,
                                style, 0, 0, 1, 1,
                                owner, 0, instance, NULL );
    WIN_SetOwner( hWnd, owner );  /* MDI depends on this */
    SetWindowLongPtrW( hWnd, GWL_STYLE,
                       GetWindowLongPtrW( hWnd, GWL_STYLE ) & ~(WS_CAPTION | WS_BORDER) );
    return hWnd;
}
Example #11
0
	static LRESULT CALLBACK hook_winproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
	{
		window *w = reinterpret_cast<window *>(GetWindowLongPtrA(hwnd, GWLP_USERDATA));
		if (w)
		{
			w->msgproc(msg, wparam, lparam);
			if (w->_org_wproc)
				return CallWindowProc(w->_org_wproc, hwnd, msg, wparam, lparam);
		}
		return DefWindowProc(hwnd, msg, wparam, lparam);
	}
Example #12
0
File: pager.c Project: AndreRH/wine
static LRESULT WINAPI pager_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    WNDPROC oldproc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
    struct message msg = { 0 };

    msg.message = message;
    msg.flags = sent|wparam|lparam;
    msg.wParam = wParam;
    msg.lParam = lParam;
    add_message(sequences, PAGER_SEQ_INDEX, &msg);
    return CallWindowProcA(oldproc, hwnd, message, wParam, lParam);
}
Example #13
0
/*************************************************************************
 *  DragAcceptFiles        [SHELL32.@]
 */
void WINAPI DragAcceptFiles(HWND hWnd, BOOL b)
{
    LONG exstyle;

    if( !IsWindow(hWnd) ) return;
    exstyle = GetWindowLongPtrA(hWnd,GWL_EXSTYLE);
    if (b)
      exstyle |= WS_EX_ACCEPTFILES;
    else
      exstyle &= ~WS_EX_ACCEPTFILES;
    SetWindowLongPtrA(hWnd,GWL_EXSTYLE,exstyle);
}
// Helper method for subclassing Window procedure. If we're not using the correct A/W
// versions, Unicode tracks won't display properly in the taskbar.
WNDPROC SetWndSubClass( HWND hwnd, WNDPROC newproc, WNDPROC* oldproc )
{
    if ( IsWindowUnicode(hwnd) )
    {
        *oldproc = (WNDPROC)GetWindowLongPtrW( hwnd, GWL_WNDPROC );
        return (WNDPROC)SetWindowLongPtrW( hwnd, GWL_WNDPROC, (LONG_PTR)newproc );
    }
    else
    {
        *oldproc = (WNDPROC)GetWindowLongPtrA( hwnd, GWL_WNDPROC );
        return (WNDPROC)SetWindowLongPtrA( hwnd, GWL_WNDPROC, (LONG_PTR)newproc );
    }
}
Example #15
0
void CLyricsDlg::OnSet(HWND hDlg)
{
	m_bIsSet = true;
	CLyricsDlg* pThis = (CLyricsDlg*)GetWindowLongPtrA(hDlg, GWL_USERDATA);
	int line = pThis->m_List.m_Table.GetSelectedLine();
	if (line==-1) line = 0;

	char sProgress[7];
	GetDlgItemTextA(hDlg, IDC_PROGRESS, sProgress, 7);
	SetWindowTextA(pThis->m_List.m_Table.m_Lines[line].edSecond.m_hWnd, sProgress);

	if (line < pThis->m_List.m_Table.m_Lines.size() - 1) pThis->m_List.m_Table.SelectLine(line + 1);
}
Example #16
0
static void testwindow_setpos(HWND hwnd)
{
    struct testwindow_info* info = (struct testwindow_info*)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
    APPBARDATA abd;
    BOOL ret;

    ok(info != NULL, "got unexpected ABN_POSCHANGED notification\n");

    if (!info || !info->registered)
    {
        return;
    }

    if (info->to_be_deleted)
    {
        win_skip("Some Win95 and NT4 systems send messages to removed taskbars\n");
        return;
    }

    abd.cbSize = sizeof(abd);
    abd.hWnd = hwnd;
    abd.uEdge = info->edge;
    abd.rc = info->desired_rect;
    ret = SHAppBarMessage(ABM_QUERYPOS, &abd);
    ok(ret == TRUE, "SHAppBarMessage returned %i\n", ret);
    switch (info->edge)
    {
        case ABE_BOTTOM:
            ok(info->desired_rect.top == abd.rc.top, "ABM_QUERYPOS changed top of rect from %i to %i\n", info->desired_rect.top, abd.rc.top);
            abd.rc.top = abd.rc.bottom - (info->desired_rect.bottom - info->desired_rect.top);
            break;
        case ABE_LEFT:
            ok(info->desired_rect.right == abd.rc.right, "ABM_QUERYPOS changed right of rect from %i to %i\n", info->desired_rect.right, abd.rc.right);
            abd.rc.right = abd.rc.left + (info->desired_rect.right - info->desired_rect.left);
            break;
        case ABE_RIGHT:
            ok(info->desired_rect.left == abd.rc.left, "ABM_QUERYPOS changed left of rect from %i to %i\n", info->desired_rect.left, abd.rc.left);
            abd.rc.left = abd.rc.right - (info->desired_rect.right - info->desired_rect.left);
            break;
        case ABE_TOP:
            ok(info->desired_rect.bottom == abd.rc.bottom, "ABM_QUERYPOS changed bottom of rect from %i to %i\n", info->desired_rect.bottom, abd.rc.bottom);
            abd.rc.bottom = abd.rc.top + (info->desired_rect.bottom - info->desired_rect.top);
            break;
    }

    ret = SHAppBarMessage(ABM_SETPOS, &abd);
    ok(ret == TRUE, "SHAppBarMessage returned %i\n", ret);

    info->allocated_rect = abd.rc;
    MoveWindow(hwnd, abd.rc.left, abd.rc.top, abd.rc.right-abd.rc.left, abd.rc.bottom-abd.rc.top, TRUE);
}
Example #17
0
static int CALLBACK sheet_callback_messages(HWND hwnd, UINT msg, LPARAM lParam)
{
    save_message(hwnd, msg, 0, lParam, RECEIVER_SHEET_CALLBACK);

    switch (msg)
    {
    case PSCB_INITIALIZED:
        oldWndProc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_WNDPROC);
        SetWindowLongPtrA(hwnd, GWLP_WNDPROC, (LONG_PTR)&sheet_callback_messages_proc);
        return TRUE;
    }

    return TRUE;
}
Example #18
0
static void
SetBorderlessWindowStyle(window_data Data)
{
	HWND Window = Data.Window;
	DWORD Style = Data.Style;
	LONG_PTR ExStyle = GetWindowLongPtrA(Window, GWL_EXSTYLE);
	if(ExStyle) {
		SetWindowLong(Window, GWL_STYLE, Style & ~(WS_CAPTION | WS_THICKFRAME | WS_BORDER | WS_DLGFRAME | WS_SYSMENU));
		SetWindowLong(Window, GWL_EXSTYLE, ExStyle & ~(WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE | WS_EX_STATICEDGE));
	}
	else {
		PRINT_ERR("Could not get extended style info.\n");
	}
}
Example #19
0
void CButtonBar::OnPaint(HWND hWnd)
{
	CButtonBar* pThis = (CButtonBar*)GetWindowLongPtrA(hWnd, GWL_USERDATA);

	PAINTSTRUCT ps;
	BeginPaint(hWnd, &ps);
	
	HDC hMemDC = CreateCompatibleDC(ps.hdc);
	HBITMAP hOldBmp = (HBITMAP)SelectObject(hMemDC, MAKEINTRESOURCE(NULL_BRUSH));

	//fback:
	if (pThis->m_dClicked == but::fback)
		SelectObject(hMemDC, pThis->m_hbFBack2);
	else
		SelectObject(hMemDC, pThis->m_hbFBack);
	int nresult = BitBlt(ps.hdc, 0, 0, 22, 19, hMemDC, 0, 0, SRCCOPY);

	//play:
	if (pThis->m_dClicked == but::play)
		SelectObject(hMemDC, pThis->m_hbPlay2);
	else
		SelectObject(hMemDC, pThis->m_hbPlay);
	BitBlt(ps.hdc, 22, 0, 22, 19, hMemDC, 0, 0, SRCCOPY);

	//pause:
	if (pThis->m_dClicked == but::pause)
		SelectObject(hMemDC, pThis->m_hbPause2);
	else SelectObject(hMemDC, pThis->m_hbPause);
	BitBlt(ps.hdc, 44, 0, 22, 19, hMemDC, 0, 0, SRCCOPY);

	//stop:
	if (pThis->m_dClicked == but::stop)
		SelectObject(hMemDC, pThis->m_hbStop2);
	else
		SelectObject(hMemDC, pThis->m_hbStop);
	BitBlt(ps.hdc, 66, 0, 22, 19, hMemDC, 0, 0, SRCCOPY);

	//ffar:
	if (pThis->m_dClicked == but::ffar)
		SelectObject(hMemDC, pThis->m_hbFFar2);
	else
		SelectObject(hMemDC, pThis->m_hbFFar);
	BitBlt(ps.hdc, 88, 0, 22, 19, hMemDC, 0, 0, SRCCOPY);

	SelectObject(hMemDC, hOldBmp);
	DeleteDC(hMemDC);

	EndPaint(hWnd, &ps);
}
Example #20
0
void wined3d_unregister_window(HWND window)
{
    struct wined3d_wndproc *entry, *last;
    LONG_PTR proc;

    wined3d_wndproc_mutex_lock();

    if (!(entry = wined3d_find_wndproc(window)))
    {
        wined3d_wndproc_mutex_unlock();
        ERR("Window %p is not registered with wined3d.\n", window);
        return;
    }

    if (entry->unicode)
    {
        proc = GetWindowLongPtrW(window, GWLP_WNDPROC);
        if (proc != (LONG_PTR)wined3d_wndproc)
        {
            entry->device = NULL;
            wined3d_wndproc_mutex_unlock();
            WARN("Not unregistering window %p, window proc %#lx doesn't match wined3d window proc %p.\n",
                    window, proc, wined3d_wndproc);
            return;
        }

        SetWindowLongPtrW(window, GWLP_WNDPROC, (LONG_PTR)entry->proc);
    }
    else
    {
        proc = GetWindowLongPtrA(window, GWLP_WNDPROC);
        if (proc != (LONG_PTR)wined3d_wndproc)
        {
            entry->device = NULL;
            wined3d_wndproc_mutex_unlock();
            WARN("Not unregistering window %p, window proc %#lx doesn't match wined3d window proc %p.\n",
                    window, proc, wined3d_wndproc);
            return;
        }

        SetWindowLongPtrA(window, GWLP_WNDPROC, (LONG_PTR)entry->proc);
    }

    last = &wndproc_table.entries[--wndproc_table.count];
    if (entry != last) *entry = *last;

    wined3d_wndproc_mutex_unlock();
}
Example #21
0
void CLyricsDlg::SetList(HWND hDlg, string& sText)
{
	deque<string> strList;
	string sLine;
	int nrFound = 0;

	for (int i = 0; i< sText.length(); i++)
	{
		if (sText[i]!='\n') sLine += sText[i];
		else
		{
			if (nrFound>=254)
			{
				MessageBoxA(hDlg, "Sunt mai mult de 255 de linii! Doar primele 255 vor fi luate în considerare.", "Atenție!", MB_ICONEXCLAMATION);
				break;
			}
			strList.push_back(sLine);
			nrFound++;
			sLine = "";
		}
	}
	strList.push_back(sLine);
	CLyricsDlg* pThis = (CLyricsDlg*)GetWindowLongPtrA(hDlg, GWL_USERDATA);

	//add/substract lines in list ctrl as needed
	int add = pThis->m_List.m_Table.m_Lines.size() - (int) strList.size();
	
	//there are more lines than needed
	while (add>0)
	{
		pThis->m_List.m_Table.RemoveLine();
		add--;
	}
	//there are less lines than needed
	while (add<0)
	{
		pThis->m_List.m_Table.AddLine();
		add++;
	}

	//now we write onto the list ctrl:
	int size = strList.size();
	for (int i = 0 ; i < size; i++)
	{
		HWND hEdit = pThis->m_List.m_Table.m_Lines[i].edText.m_hWnd;
		SetWindowTextA(hEdit, strList[i].data());
	}
}
LRESULT CXTPSkinObjectFrame::CallDefDlgProc(UINT nMessage, WPARAM wParam, LPARAM lParam)
{
    if (m_dwDialogTexture == ETDT_ENABLE) // Dialog ?
    {
        int nNotifyFormat = (int)SendMessage(WM_NOTIFYFORMAT, 0, NF_QUERY);

        WNDPROC pDlgWndProc = (WNDPROC) (nNotifyFormat == NFR_UNICODE ?
                                         GetWindowLongPtrW(m_hWnd, DWLP_DLGPROC) : GetWindowLongPtrA(m_hWnd, DWLP_DLGPROC));

        if (pDlgWndProc && (HIWORD((ULONG)(ULONG_PTR)pDlgWndProc) != 0xFFFF))
        {
            return (pDlgWndProc)(m_hWnd, nMessage, wParam, lParam);
        }
    }
    return 0;
}
Example #23
0
	static LRESULT CALLBACK winproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
	{
		if (msg == WM_NCCREATE)
		{
			CREATESTRUCTA *cs = reinterpret_cast<CREATESTRUCTA *>(lparam);
			SetWindowLongPtrA(hwnd, GWLP_USERDATA, (LONG_PTR)(cs->lpCreateParams));
		}

		window *w = reinterpret_cast<window *>(GetWindowLongPtrA(hwnd, GWLP_USERDATA));
		if (w)
		{
			w->_hwnd = hwnd;
			return w->msgproc(msg, wparam, lparam);
		}

		return DefWindowProcA(hwnd, msg, wparam, lparam);
	}
Example #24
0
void CLyricsDlg::OnLButtonUp(HWND hDlg, WPARAM wParam, LPARAM lParam)
{
	UNREFERENCED_PARAMETER(wParam);
	CLyricsDlg* pThis = (CLyricsDlg*)GetWindowLongPtrA(hDlg, GWL_USERDATA);

	int xPos = (int)LOWORD(lParam);
	int yPos = (int)HIWORD(lParam); 

	RECT rect;
	//load from file
	GetWindowRect(pThis->m_LoadFromFile.m_hWnd, &rect);
	POINT first = {rect.left, rect.top}, second = {rect.right, rect.bottom};

	ScreenToClient(hDlg, &first);
	ScreenToClient(hDlg, &second);
	rect = MAKERECT(first.x, first.y, second.x, second.y);

	if ( xPos > rect.left && xPos < rect.right && yPos < rect.bottom && yPos > rect.top)
		SetCursor(pThis->m_hHandCursor);
	else goto try_theother;

	pThis->m_bClicked = TRUE;
	InvalidateRect(hDlg, &rect, 1);
	LoadFromFile(hDlg);

try_theother:
	//load from web
	GetWindowRect(pThis->m_LoadFromWeb.m_hWnd, &rect);
	first.x = rect.left; first.y = rect.top;
	second.x = rect.right; second.y = rect.bottom;

	ScreenToClient(hDlg, &first);
	ScreenToClient(hDlg, &second);
	rect = MAKERECT(first.x, first.y, second.x, second.y);

	if ( xPos > rect.left && xPos < rect.right && yPos < rect.bottom && yPos > rect.top)
		SetCursor(pThis->m_hHandCursor);
	else return;

	pThis->m_bClicked = TRUE;
	InvalidateRect(hDlg, &rect, 1);
	LoadFromWeb(hDlg);
}
Example #25
0
static LRESULT WINAPI trackbar_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){
    WNDPROC oldproc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
    static LONG defwndproc_counter = 0;
    LRESULT ret;
    struct message msg;

    msg.message = message;
    msg.flags = sent|wparam|lparam;
    if (defwndproc_counter) msg.flags |= defwinproc;
    msg.wParam = wParam;
    msg.lParam = lParam;
    msg.id = 0;
    add_message(sequences, TRACKBAR_SEQ_INDEX, &msg);

    defwndproc_counter++;
    ret = CallWindowProcA(oldproc, hwnd, message, wParam, lParam);
    defwndproc_counter--;

    return ret;
}
Example #26
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);
	}
Example #27
0
static LRESULT WINAPI monthcal_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    struct subclass_info *info = (struct subclass_info *)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
    static long defwndproc_counter = 0;
    LRESULT ret;
    struct message msg;

    msg.message = message;
    msg.flags = sent|wparam|lparam;
    if (defwndproc_counter) msg.flags |= defwinproc;
    msg.wParam = wParam;
    msg.lParam = lParam;
    add_message(sequences, MONTHCAL_SEQ_INDEX, &msg);

    defwndproc_counter++;
    ret = CallWindowProcA(info->oldproc, hwnd, message, wParam, lParam);
    defwndproc_counter--;

    return ret;
}
Example #28
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);
	}
Example #29
0
////////////////////////////////////////////////////////////////////
// BOOL WINAPI CProgress::DlgProc
//
////////////////////////////////////////////////////////////////////
BOOL WINAPI CProgress::DlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
    switch(msg)
    {
    case WM_INITDIALOG:
    {
        //Save the this pointer, since this is a static method
        Busy();
        CProgress* pThis = (CProgress*)lParam;
        SetWindowLongPtrA(hWnd, GWLP_USERDATA, (LONG_PTR)pThis);

        //On INIT we know we have a valid hWnd to store
        pThis->m_hWnd = hWnd;

        CenterDialog(hWnd);
        return TRUE;
    }
    break;

    case WM_COMMAND:
    {
        // All buttons are handled the same way
        //Restore instance pointer, since this is a static function
        CProgress* pThis = (CProgress*)GetWindowLongPtrA(hWnd, GWLP_USERDATA);

        switch(GET_WM_COMMAND_ID(wParam, lParam))
        {
        case IDCANCEL:
            Busy();
            pThis->m_fCancel = TRUE;
            return TRUE;
        }
        return FALSE;
    }
    break;

    default:
        return FALSE;
    }
}
Example #30
0
static BOOL CALLBACK 
EnumWindowsProc(HWND Window, LPARAM lParam)
{
	BOOL Result = TRUE;
	enum_data *EnumData = (enum_data*)lParam;
	window_data_pool *Pool = EnumData->Pool;
	HWND ComboBox = EnumData->ComboBox;
	if(!GetParent(Window)) {
		LONG_PTR Style = GetWindowLongPtrA(Window, GWL_STYLE);
		if(Style & WS_VISIBLE) {
			int TextLength = GetWindowTextLengthA(Window);
			if(TextLength > 0) {
				char Buffer[256];
				if(GetWindowTextA(Window, Buffer, sizeof(Buffer))) {
					window_data *WndData = PushWindowData(Pool);
					if(WndData) {
						WndData->Style = Style;
						WndData->Window = Window;
						DWORD Pos = (DWORD)SendMessageA(ComboBox, CB_ADDSTRING, 0, (LPARAM)Buffer);
						SendMessageA(ComboBox, CB_SETITEMDATA, Pos, (LPARAM)WndData);
					}
					else {
						PRINT_ERR("Maximum window count reached.\n");
						SetLastError(ENUM_ERR_ABORTED);
						return FALSE;
					}
				}
				else {
					PRINT_ERR("Could not get window title.\n");
				}
			}
			else {
				PRINT_ERR("Could not get window text length.\n");
			}
		}
	}

	return Result;
}