Ejemplo n.º 1
0
Archivo: updown.c Proyecto: devyn/wine
static HWND create_updown_control(void)
{
    struct subclass_info *info;
    HWND updown;
    RECT rect;

    info = HeapAlloc(GetProcessHeap(), 0, sizeof(struct subclass_info));
    if (!info)
        return NULL;

    GetClientRect(parent_wnd, &rect);
    updown = CreateUpDownControl(WS_CHILD | WS_BORDER | WS_VISIBLE | UDS_ALIGNRIGHT,
                                 0, 0, rect.right, rect.bottom, parent_wnd, 1, GetModuleHandleA(NULL), edit,
                                 100, 0, 50);
    if (!updown)
    {
        HeapFree(GetProcessHeap(), 0, info);
        return NULL;
    }

    info->oldproc = (WNDPROC)SetWindowLongPtrA(updown, GWLP_WNDPROC,
                                            (LONG_PTR)updown_subclass_proc);
    SetWindowLongPtrA(updown, GWLP_USERDATA, (LONG_PTR)info);

    return updown;
}
Ejemplo n.º 2
0
Archivo: updown.c Proyecto: devyn/wine
static HWND create_edit_control(void)
{
    struct subclass_info *info;
    RECT rect;

    info = HeapAlloc(GetProcessHeap(), 0, sizeof(struct subclass_info));
    if (!info)
        return NULL;

    GetClientRect(parent_wnd, &rect);
    edit = CreateWindowExA(0, "EDIT", NULL, WS_CHILD | WS_BORDER | WS_VISIBLE,
                           0, 0, rect.right, rect.bottom,
                           parent_wnd, NULL, GetModuleHandleA(NULL), NULL);
    if (!edit)
    {
        HeapFree(GetProcessHeap(), 0, info);
        return NULL;
    }

    info->oldproc = (WNDPROC)SetWindowLongPtrA(edit, GWLP_WNDPROC,
                                            (LONG_PTR)edit_subclass_proc);
    SetWindowLongPtrA(edit, GWLP_USERDATA, (LONG_PTR)info);

    return edit;
}
Ejemplo n.º 3
0
static HWND create_monthcal_control(DWORD style, HWND parent_window)
{
    struct subclass_info *info;
    HWND hwnd;

    info = HeapAlloc(GetProcessHeap(), 0, sizeof(struct subclass_info));
    if (!info)
        return NULL;

    hwnd = CreateWindowEx(0,
                    MONTHCAL_CLASS,
                    "",
                    style,
                    0, 0, 300, 400,
                    parent_window, NULL, GetModuleHandleA(NULL), NULL);

    if (!hwnd)
    {
        HeapFree(GetProcessHeap(), 0, info);
        return NULL;
    }

    info->oldproc = (WNDPROC)SetWindowLongPtrA(hwnd, GWLP_WNDPROC,
                                            (LONG_PTR)monthcal_subclass_proc);
    SetWindowLongPtrA(hwnd, GWLP_USERDATA, (LONG_PTR)info);

    return hwnd;
}
Ejemplo n.º 4
0
static void test_selection(DWORD style, const char * const text[],
                           const int *edit, const int *list)
{
    INT idx;
    HWND hCombo;

    hCombo = build_combo(style);

    SendMessageA(hCombo, CB_ADDSTRING, 0, (LPARAM)text[0]);
    SendMessageA(hCombo, CB_ADDSTRING, 0, (LPARAM)text[1]);
    SendMessageA(hCombo, CB_SETCURSEL, -1, 0);

    old_parent_proc = (void *)SetWindowLongPtrA(hMainWnd, GWLP_WNDPROC, (ULONG_PTR)parent_wnd_proc);

    idx = SendMessageA(hCombo, CB_GETCURSEL, 0, 0);
    ok(idx == -1, "expected selection -1, got %d\n", idx);

    /* keyboard navigation */

    expected_list_text = text[list[0]];
    expected_edit_text = text[edit[0]];
    selchange_fired = FALSE;
    SendMessageA(hCombo, WM_KEYDOWN, VK_DOWN, 0);
    ok(selchange_fired, "CBN_SELCHANGE not sent!\n");

    expected_list_text = text[list[1]];
    expected_edit_text = text[edit[1]];
    selchange_fired = FALSE;
    SendMessageA(hCombo, WM_KEYDOWN, VK_DOWN, 0);
    ok(selchange_fired, "CBN_SELCHANGE not sent!\n");

    expected_list_text = text[list[2]];
    expected_edit_text = text[edit[2]];
    selchange_fired = FALSE;
    SendMessageA(hCombo, WM_KEYDOWN, VK_UP, 0);
    ok(selchange_fired, "CBN_SELCHANGE not sent!\n");

    /* programmatic navigation */

    expected_list_text = text[list[3]];
    expected_edit_text = text[edit[3]];
    selchange_fired = FALSE;
    SendMessageA(hCombo, CB_SETCURSEL, list[3], 0);
    ok(!selchange_fired, "CBN_SELCHANGE sent!\n");

    expected_list_text = text[list[4]];
    expected_edit_text = text[edit[4]];
    selchange_fired = FALSE;
    SendMessageA(hCombo, CB_SETCURSEL, list[4], 0);
    ok(!selchange_fired, "CBN_SELCHANGE sent!\n");

    SetWindowLongPtrA(hMainWnd, GWLP_WNDPROC, (ULONG_PTR)old_parent_proc);
    DestroyWindow(hCombo);
}
Ejemplo n.º 5
0
static HWND subclass_editbox(HWND hwndComboEx)
{
    WNDPROC oldproc;
    HWND hwnd;

    hwnd = (HWND)SendMessageA(hwndComboEx, CBEM_GETEDITCONTROL, 0, 0);
    oldproc = (WNDPROC)SetWindowLongPtrA(hwnd, GWLP_WNDPROC,
                                         (LONG_PTR)editbox_subclass_proc);
    SetWindowLongPtrA(hwnd, GWLP_USERDATA, (LONG_PTR)oldproc);

    return hwnd;
}
Ejemplo n.º 6
0
Archivo: pager.c Proyecto: AndreRH/wine
static HWND create_pager_control( DWORD style )
{
    WNDPROC oldproc;
    HWND hwnd;
    RECT rect;

    GetClientRect( parent_wnd, &rect );
    hwnd = CreateWindowA( WC_PAGESCROLLERA, "pager", WS_CHILD | WS_BORDER | WS_VISIBLE | style,
                          0, 0, 100, 100, parent_wnd, 0, GetModuleHandleA(0), 0 );
    oldproc = (WNDPROC)SetWindowLongPtrA(hwnd, GWLP_WNDPROC, (LONG_PTR)pager_subclass_proc);
    SetWindowLongPtrA(hwnd, GWLP_USERDATA, (LONG_PTR)oldproc);
    return hwnd;
}
Ejemplo n.º 7
0
static HWND subclass_listview(HWND hwnd)
{
    WNDPROC oldproc;
    HWND listview;

    /* listview is a first child */
    listview = FindWindowExA(hwnd, NULL, WC_LISTVIEWA, NULL);

    oldproc = (WNDPROC)SetWindowLongPtrA(listview, GWLP_WNDPROC,
                                        (LONG_PTR)listview_subclass_proc);
    SetWindowLongPtrA(listview, GWLP_USERDATA, (LONG_PTR)oldproc);

    return listview;
}
bool zGlobalHk::PlaceWndHook(HWND hwnd)
{
	GET_HOOK(zGlobalHk).m_AppWndProc = GetWindowLongPtrA(hwnd, GWL_WNDPROC);
	SetWindowLongPtrA(hwnd, GWL_WNDPROC, (LONG)AppWndProc);

	return true;
}
Ejemplo n.º 9
0
/*!
    Destroys the QWinHost object. If the hosted Win32 window has not
    been set explicitly using setWindow() the window will be
    destroyed.
*/
QWinHost::~QWinHost()
{
	if (wndproc)
	{
#if defined(GWLP_WNDPROC)
		QT_WA({ SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)wndproc); },
		      { SetWindowLongPtrA(hwnd, GWLP_WNDPROC, (LONG_PTR)wndproc); })
Ejemplo n.º 10
0
HWND WINAPI CreateWindowExCenterA(ULONG dwExStyle, LPCSTR lpClassName, LPCSTR lpWindowName, ULONG dwStyle, int X, int Y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam)
{
    HWND    Window;
    RECT    rcWordArea;
    ULONG   Length;
    PWSTR   pszClassName, pszWindowName;

    Length = StrLengthA(lpClassName) + 1;
    pszClassName = (PWSTR)AllocStack(Length * sizeof(WCHAR));
    AnsiToUnicode(pszClassName, Length, lpClassName, Length);

    Length = StrLengthA(lpWindowName) + 1;
    pszWindowName = (PWSTR)AllocStack(Length * sizeof(WCHAR));
    AnsiToUnicode(pszWindowName, Length, lpWindowName, Length);

    if (SystemParametersInfoW(SPI_GETWORKAREA, 0, &rcWordArea, 0))
    {
        X = ((rcWordArea.right - rcWordArea.left) - nWidth) / 2;
        Y = ((rcWordArea.bottom - rcWordArea.top) - nHeight) / 2;
    }

    Window = CreateWindowExW(dwExStyle, pszClassName, pszWindowName, dwStyle, X, Y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam);

    if (Window != NULL)
        WindowProc = (WNDPROC)SetWindowLongPtrA(Window, GWL_WNDPROC, (LONG_PTR)MainWndProc);

    return Window;
}
Ejemplo n.º 11
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);
}
Ejemplo n.º 12
0
void clViewport::ReinitializeViewport()
{
    FATAL( !FWindowHandle, "Window Creation Error" );

    SetWindowLongPtrA( FWindowHandle, GWLP_USERDATA, reinterpret_cast<LONG_PTR>( Env ) );

    FDeviceHandle = GetDC( FWindowHandle );

    if ( FTakeoverContext )
    {
        FOriginalWndProc = ( WNDPROC )SetWindowLongPtr( FWindowHandle, GWLP_WNDPROC, ( LONG_PTR )MainWndProc );
    }
    else
    {
        // bring to front
        if ( FDisplayWindow )
        {
            ShowWindow( FWindowHandle, SW_SHOW );
            UpdateWindow( FWindowHandle );
            SetFocus( FWindowHandle );
            SetForegroundWindow( FWindowHandle );
        }

        FScaleFactorX = 1.0f / FWidth;
        FScaleFactorY = 1.0f / FHeight;
    }
}
Ejemplo n.º 13
0
/***********************************************************************
 * COMCTL32_SubclassProc (internal)
 *
 * Window procedure for all subclassed windows. 
 * Saves the current subclassing stack position to support nested messages
 */
static LRESULT WINAPI COMCTL32_SubclassProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
   LPSUBCLASS_INFO stack;
   LPSUBCLASSPROCS proc;
   LRESULT ret;
    
   TRACE ("(%p, 0x%08x, 0x%08lx, 0x%08lx)\n", hWnd, uMsg, wParam, lParam);

   stack = GetPropW (hWnd, COMCTL32_wSubclass);
   if (!stack) {
      ERR ("Our sub classing stack got erased for %p!! Nothing we can do\n", hWnd);
      return 0;
   }
    
   /* Save our old stackpos to properly handle nested messages */
   proc = stack->stackpos;
   stack->stackpos = stack->SubclassProcs;
   stack->running++;
   ret = DefSubclassProc(hWnd, uMsg, wParam, lParam);
   stack->running--;
   stack->stackpos = proc;
    
   if (!stack->SubclassProcs && !stack->running) {
      TRACE("Last Subclass removed, cleaning up\n");
      /* clean up our heap and reset the original window procedure */
      if (IsWindowUnicode (hWnd))
         SetWindowLongPtrW (hWnd, GWLP_WNDPROC, (DWORD_PTR)stack->origproc);
      else
         SetWindowLongPtrA (hWnd, GWLP_WNDPROC, (DWORD_PTR)stack->origproc);
      Free (stack);
      RemovePropW( hWnd, COMCTL32_wSubclass );
   }
   return ret;
}
Ejemplo n.º 14
0
Archivo: tab.c Proyecto: devyn/wine
static HWND createFilledTabControl(HWND parent_wnd, DWORD style, DWORD mask, INT nTabs)
{
    HWND tabHandle;
    TCITEM tcNewTab;
    struct subclass_info *info;
    RECT rect;
    INT i;

    info = HeapAlloc(GetProcessHeap(), 0, sizeof(struct subclass_info));
    if (!info)
        return NULL;

    GetClientRect(parent_wnd, &rect);

    tabHandle = CreateWindow (
        WC_TABCONTROLA,
        "TestTab",
        WS_CLIPSIBLINGS | WS_CLIPCHILDREN | TCS_FOCUSNEVER | style,
        0, 0, rect.right, rect.bottom,
        parent_wnd, NULL, NULL, 0);

    assert(tabHandle);

    info->oldproc = (WNDPROC)SetWindowLongPtrA(tabHandle, GWLP_WNDPROC, (LONG_PTR)tabSubclassProcess);
    SetWindowLongPtrA(tabHandle, GWLP_USERDATA, (LONG_PTR)info);

    tcNewTab.mask = mask;

    for (i = 0; i < nTabs; i++)
    {
        char tabName[MAX_TABLEN];

        sprintf(tabName, "Tab %d", i+1);
        tcNewTab.pszText = tabName;
        tcNewTab.iImage = i;
        SendMessage (tabHandle, TCM_INSERTITEM, i, (LPARAM) &tcNewTab);
    }

    if (winetest_interactive)
    {
        ShowWindow (tabHandle, SW_SHOW);
        RedrawWindow (tabHandle, NULL, 0, RDW_UPDATENOW);
        Sleep (1000);
    }

    return tabHandle;
}
Ejemplo n.º 15
0
/***********************************************************************
 *                      MCIWndCreate(MSVIDEO.250)
 */
HWND16 CDECL MCIWndCreate16(HWND16 parent, HINSTANCE16 hinst16,
                            DWORD style, LPSTR file)
{
    HWND hwnd = MCIWndCreateA(HWND_32(parent), 0, style, file);
    if (hwnd)
        pMCIWndProc = (void *)SetWindowLongPtrA(hwnd, GWLP_WNDPROC, (ULONG_PTR)MCIWndProc16);
    return HWND_16(hwnd);
}
Ejemplo n.º 16
0
static HWND create_trackbar(DWORD style, HWND parent){
    HWND hWndTrack;
    WNDPROC oldproc;
    RECT rect;

    GetClientRect(parent, &rect);
    hWndTrack = CreateWindowA(TRACKBAR_CLASSA, "Trackbar Control", style,
                              rect.right, rect.bottom, 100, 50,
                              parent, NULL, GetModuleHandleA(NULL), NULL);

    if (!hWndTrack) return NULL;

    oldproc = (WNDPROC)SetWindowLongPtrA(hWndTrack, GWLP_WNDPROC, (LONG_PTR)trackbar_subclass_proc);
    SetWindowLongPtrA(hWndTrack, GWLP_USERDATA, (LONG_PTR)oldproc);

    return hWndTrack;
}
Ejemplo n.º 17
0
Archivo: updown.c Proyecto: Jactry/wine
static HWND create_edit_control(void)
{
    WNDPROC oldproc;
    HWND hwnd;
    RECT rect;

    GetClientRect(parent_wnd, &rect);
    hwnd = CreateWindowExA(0, WC_EDITA, NULL, WS_CHILD | WS_BORDER | WS_VISIBLE,
                           0, 0, rect.right, rect.bottom,
                           parent_wnd, NULL, GetModuleHandleA(NULL), NULL);
    if (!hwnd) return NULL;

    oldproc = (WNDPROC)SetWindowLongPtrA(hwnd, GWLP_WNDPROC,
                                         (LONG_PTR)edit_subclass_proc);
    SetWindowLongPtrA(hwnd, GWLP_USERDATA, (LONG_PTR)oldproc);

    return hwnd;
}
Ejemplo n.º 18
0
static HWND create_updown_control(DWORD style, HWND buddy)
{
    WNDPROC oldproc;
    HWND updown;
    RECT rect;

    GetClientRect(parent_wnd, &rect);
    updown = CreateUpDownControl(WS_CHILD | WS_BORDER | WS_VISIBLE | style,
                                 0, 0, rect.right, rect.bottom, parent_wnd, 1, GetModuleHandleA(NULL), buddy,
                                 100, 0, 50);
    if (!updown) return NULL;

    oldproc = (WNDPROC)SetWindowLongPtrA(updown, GWLP_WNDPROC,
                                         (LONG_PTR)updown_subclass_proc);
    SetWindowLongPtrA(updown, GWLP_USERDATA, (LONG_PTR)oldproc);

    return updown;
}
Ejemplo n.º 19
0
void CButtonBar::Create(HWND hParent, const RECT &rect)
{
	WNDCLASSA wndclass;
	if (FALSE == GetClassInfoA(genDll.m_hInstance, CLASSNAME, &wndclass))
	{
		memset(&wndclass, 0, sizeof(wndclass));
		wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
		wndclass.hInstance = genDll.m_hInstance;
		wndclass.lpfnWndProc = WindowProc;
		wndclass.lpszClassName = CLASSNAME;
		wndclass.lpszMenuName = 0;
		wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_SAVEBITS;

		if (false == RegisterClassA(&wndclass))
		{
			DWORD dwError = GetLastError();
			char str[30];
			sprintf_s(str, 30, "Error 0x%x", dwError);
			MessageBoxA(hParent, str, "Fatal Error!", MB_ICONERROR);
#ifdef _DEBUG
			DebugBreak();
#endif
			PostQuitMessage(-1);
		}
	}

		m_hWnd = CreateWindowA(CLASSNAME, "", WS_CHILD | WS_VISIBLE, rect.left, rect.top, 
			rect.right - rect.left + 1, rect.bottom - rect.top + 1, hParent, 0, genDll.m_hInstance, 0);
		if (m_hWnd == 0)
		{
			DWORD dwError = GetLastError();
			char str[30];
			sprintf_s(str, 30, "Error 0x%x", dwError);
			MessageBoxA(hParent, str, "Fatal Error!", MB_ICONERROR);
#ifdef _DEBUG
			DebugBreak();
#endif
			PostQuitMessage(-1);
		}

		GetClientRect(m_hWnd, &m_rClient);

		m_hbFBack = LoadBitmap(genDll.m_hInstance, MAKEINTRESOURCE(IDB_FBACK));
		m_hbFFar = LoadBitmap(genDll.m_hInstance, MAKEINTRESOURCE(IDB_FFAR));
		m_hbPlay = LoadBitmap(genDll.m_hInstance, MAKEINTRESOURCE(IDB_PLAY));
		m_hbPause = LoadBitmap(genDll.m_hInstance, MAKEINTRESOURCE(IDB_PAUSE));
		m_hbStop = LoadBitmap(genDll.m_hInstance, MAKEINTRESOURCE(IDB_STOP));

		m_hbFBack2 = LoadBitmap(genDll.m_hInstance, MAKEINTRESOURCE(IDB_FBACK2));
		m_hbFFar2 = LoadBitmap(genDll.m_hInstance, MAKEINTRESOURCE(IDB_FFAR2));
		m_hbPlay2 = LoadBitmap(genDll.m_hInstance, MAKEINTRESOURCE(IDB_PLAY2));
		m_hbPause2 = LoadBitmap(genDll.m_hInstance, MAKEINTRESOURCE(IDB_PAUSE2));
		m_hbStop2 = LoadBitmap(genDll.m_hInstance, MAKEINTRESOURCE(IDB_STOP2));

		SetWindowLongPtrA(m_hWnd, GWL_USERDATA, (LONG_PTR)this);
}
Ejemplo n.º 20
0
		boolean Window::init( int width, int height, const char* title, boolean fullscreen )
		{
			HINSTANCE instance = GetModuleHandle( 0 );

			WNDCLASSA wc;
			wc.style = 0;
			wc.lpfnWndProc = (WNDPROC)wndproc;
			wc.cbClsExtra = 0;
			wc.cbWndExtra = 0;
			wc.hInstance = instance;
			wc.hIcon = LoadIcon( 0, IDI_APPLICATION );
			wc.hCursor = LoadCursor( 0, IDC_ARROW );
			wc.hbrBackground = (HBRUSH)GetStockObject( WHITE_BRUSH );
			wc.lpszMenuName = 0;
			wc.lpszClassName = title;
			
			RegisterClassA( &wc );

			DWORD style = fullscreen ? WS_POPUP : WS_OVERLAPPEDWINDOW;
			//style &= WS_MAXIMIZEBOX;

			RECT rct;
			rct.left = 0;
			rct.right = width;
			rct.top = 0;
			rct.bottom = height;
			AdjustWindowRect( &rct, style, FALSE );

			HWND hwnd = CreateWindowA( title, title, style, 0, 0, rct.right - rct.left, rct.bottom - rct.top, 0, 0, instance, 0 );

			if( hwnd )
			{
				this->hInstance = instance;
				this->hWnd = hwnd;
				this->title = title;
				GetClientRect( hwnd, &rct );
				this->width = rct.right - rct.left;
				this->height = rct.bottom - rct.top;
				this->hInstance = instance;
				this->fullscreen = fullscreen;

				this->done = false;
				this->updateFlag = true;

				SetWindowLongPtrA( hWnd, GWLP_USERDATA, reinterpret_cast<LONG_PTR>( this ) );

				UpdateWindow( hwnd );
				ShowWindow( hwnd, SW_SHOW );

				return true;
			}

			UnregisterClassA( title, instance );
			return false;
		}
LRESULT VirtualDimension::OnEnterMenuLoop(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	hWndPopupMenu = ::FindWindow("#32768", 0);
	RECT rc;
	GetWindowRect(hWndPopupMenu, &rc);
	hwndThumbnail = ::CreateWindowEx(WS_EX_LAYERED/*|WS_EX_TRANSPARENT*/, "static", "", WS_VISIBLE|WS_POPUP, rc.left, rc.top - 300, 300, 300, hWnd, NULL, m_hInstance, NULL);

	hWndVD = hWnd;
	WndProcOld = (WNDPROC)SetWindowLongPtrA(hWndPopupMenu, GWLP_WNDPROC, (LONG_PTR)WndProcDeskPopupMenu);

	return 0;
}
Ejemplo n.º 22
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);
}
Ejemplo n.º 23
0
// 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 );
    }
}
Ejemplo n.º 24
0
void * win32_window_create_window( xwl_native_window_t * handle, const char * utf8_title, unsigned int * attributes, int pixel_format )
{
	HWND native_handle;
	int window_width;
	int window_height;
	int use_fullscreen;
	int window_x, window_y;

	window_width = attributes[ XWL_WINDOW_WIDTH ];
	window_height = attributes[ XWL_WINDOW_HEIGHT ];
	use_fullscreen = attributes[ XWL_USE_FULLSCREEN ];
	window_x = attributes[ XWL_WINDOW_X ];
	window_y = attributes[ XWL_WINDOW_Y ];

	if ( !_win32ChoosePixelFormatARB && !_win32CreateContextAttribsARB )
	{
		HWND dummy_window = win32_create_dummy_window();
		if ( dummy_window )
		{
			win32_load_symbols( dummy_window );
			DestroyWindow( dummy_window );
		}
	}

	native_handle = win32_create_window( utf8_title, 
		(HICON)attributes[ XWL_WIN32_ICON ], 
		(HICON)attributes[ XWL_WIN32_ICONSM ], 
		window_x, window_y, window_width, window_height, 
		use_fullscreen, attributes[XWL_DISABLE_RESIZE] );

	if ( native_handle )
	{
		// store native window handle data
		SetWindowLongPtrA( native_handle, GWLP_USERDATA, (LONG)&handle->handle);

		// if visible
		ShowWindow( native_handle, SW_SHOW );
		SetForegroundWindow( native_handle );
		UpdateWindow( native_handle );

		//
		//GetClientRect( native_handle, &clientrect );

		// TODO: This is a hack because Windows requires the pixel format to come after window creation
		// and the current order of processes in xwl has pixel format being queried before.
		// Perhaps a solution is to offer both a pre- and post- window callback.
		handle->handle.pixel_format = win32_opengl_setup_pixelformat( handle, native_handle, attributes );
	}

	return (void*)native_handle;
} // win32_window_create_window
Ejemplo n.º 25
0
static void init(void)
{
    HMODULE hComctl32;
    BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
    WNDCLASSA wc;
    RECT rect;
    BOOL ret;

    hComctl32 = GetModuleHandleA("comctl32.dll");
    pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
    if (pInitCommonControlsEx)
    {
        INITCOMMONCONTROLSEX iccex;
        iccex.dwSize = sizeof(iccex);
        iccex.dwICC  = ICC_PROGRESS_CLASS;
        pInitCommonControlsEx(&iccex);
    }
    else
        InitCommonControls();
  
    wc.style = CS_HREDRAW | CS_VREDRAW;
    wc.cbClsExtra = 0;
    wc.cbWndExtra = 0;
    wc.hInstance = GetModuleHandleA(NULL);
    wc.hIcon = NULL;
    wc.hCursor = LoadCursorA(NULL, (LPCSTR)IDC_ARROW);
    wc.hbrBackground = GetSysColorBrush(COLOR_WINDOW);
    wc.lpszMenuName = NULL;
    wc.lpszClassName = progressTestClass;
    wc.lpfnWndProc = progress_test_wnd_proc;
    RegisterClassA(&wc);

    SetRect(&rect, 0, 0, 400, 20);
    ret = AdjustWindowRect(&rect, WS_OVERLAPPEDWINDOW, FALSE);
    ok(ret, "got %d\n", ret);
    
    hProgressParentWnd = CreateWindowExA(0, progressTestClass, "Progress Bar Test", WS_OVERLAPPEDWINDOW,
      CW_USEDEFAULT, CW_USEDEFAULT, rect.right - rect.left, rect.bottom - rect.top, NULL, NULL, GetModuleHandleA(NULL), 0);
    ok(hProgressParentWnd != NULL, "failed to create parent wnd\n");

    GetClientRect(hProgressParentWnd, &rect);
    hProgressWnd = CreateWindowExA(0, PROGRESS_CLASSA, "", WS_CHILD | WS_VISIBLE,
      0, 0, rect.right, rect.bottom, hProgressParentWnd, NULL, GetModuleHandleA(NULL), 0);
    ok(hProgressWnd != NULL, "failed to create parent wnd\n");
    progress_wndproc = (WNDPROC)SetWindowLongPtrA(hProgressWnd, GWLP_WNDPROC, (LPARAM)progress_subclass_proc);
    
    ShowWindow(hProgressParentWnd, SW_SHOWNORMAL);
    ok(GetUpdateRect(hProgressParentWnd, NULL, FALSE), "GetUpdateRect: There should be a region that needs to be updated\n");
    flush_events();
    update_window(hProgressParentWnd);    
}
Ejemplo n.º 26
0
static HWND create_datetime_control(DWORD style)
{
    WNDPROC oldproc;
    HWND hWndDateTime = NULL;

    hWndDateTime = CreateWindowExA(0,
        DATETIMEPICK_CLASSA,
        NULL,
        style,
        0,50,300,120,
        NULL,
        NULL,
        NULL,
        NULL);

    if (!hWndDateTime) return NULL;

    oldproc = (WNDPROC)SetWindowLongPtrA(hWndDateTime, GWLP_WNDPROC,
                                         (LONG_PTR)datetime_subclass_proc);
    SetWindowLongPtrA(hWndDateTime, GWLP_USERDATA, (LONG_PTR)oldproc);

    return hWndDateTime;
}
Ejemplo n.º 27
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;
}
Ejemplo n.º 28
0
Archivo: updown.c Proyecto: Jactry/wine
static HWND create_updown_control(DWORD style, HWND buddy)
{
    WNDPROC oldproc;
    HWND updown;
    RECT rect;

    GetClientRect(parent_wnd, &rect);
    updown = CreateWindowExA(0, UPDOWN_CLASSA, NULL, WS_CHILD | WS_BORDER | WS_VISIBLE | style,
                           0, 0, rect.right, rect.bottom,
                           parent_wnd, (HMENU)1, GetModuleHandleA(NULL), NULL);
    ok(updown != NULL, "Failed to create UpDown control.\n");
    if (!updown) return NULL;

    SendMessageA(updown, UDM_SETBUDDY, (WPARAM)buddy, 0);
    SendMessageA(updown, UDM_SETRANGE, 0, MAKELONG(100, 0));
    SendMessageA(updown, UDM_SETPOS, 0, MAKELONG(50, 0));

    oldproc = (WNDPROC)SetWindowLongPtrA(updown, GWLP_WNDPROC,
                                         (LONG_PTR)updown_subclass_proc);
    SetWindowLongPtrA(updown, GWLP_USERDATA, (LONG_PTR)oldproc);

    return updown;
}
Ejemplo n.º 29
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 );
}
Ejemplo n.º 30
0
Archivo: shlview.c Proyecto: r6144/wine
static HWND subclass_listview(HWND hwnd)
{
    WNDPROC oldproc;
    HWND listview;

    /* listview is a first child */
    listview = FindWindowExA(hwnd, NULL, WC_LISTVIEWA, NULL);
    if(!listview)
    {
        /* .. except for some versions of Windows XP, where things
           are slightly more complicated. */
        HWND hwnd_tmp;
        hwnd_tmp = FindWindowExA(hwnd, NULL, "DUIViewWndClassName", NULL);
        hwnd_tmp = FindWindowExA(hwnd_tmp, NULL, "DirectUIHWND", NULL);
        hwnd_tmp = FindWindowExA(hwnd_tmp, NULL, "CtrlNotifySink", NULL);
        listview = FindWindowExA(hwnd_tmp, NULL, WC_LISTVIEWA, NULL);
    }

    oldproc = (WNDPROC)SetWindowLongPtrA(listview, GWLP_WNDPROC,
                                        (LONG_PTR)listview_subclass_proc);
    SetWindowLongPtrA(listview, GWLP_USERDATA, (LONG_PTR)oldproc);

    return listview;
}