Ejemplo n.º 1
0
void ThemeDetroyWndContext(HWND hWnd)
{
    PWND_CONTEXT pContext;
    DWORD ProcessId;

    /*Do not destroy WND_CONTEXT of a window that belong to another process */
    GetWindowThreadProcessId(hWnd, &ProcessId);
    if(ProcessId != GetCurrentProcessId())
    {
        return;
    }

    pContext = (PWND_CONTEXT)GetPropW(hWnd, (LPCWSTR)MAKEINTATOM(atWndContrext));
    if(pContext == NULL)
    {
        return;
    }

    if(pContext->HasThemeRgn)
    {
        user32ApiHook.SetWindowRgn(hWnd, 0, TRUE);
    }
    
    HeapFree(GetProcessHeap(), 0, pContext);

    SetPropW( hWnd, (LPCWSTR)MAKEINTATOM(atWndContrext), NULL);
}
Ejemplo n.º 2
0
MIRAPI int Unload(void)
{
	int i;

	for (i = SIZEOF(popupServices); i--; )
		DestroyServiceFunction(popupServices[i].handle);

	SrmmMenu_Unload();

	UnhookEvent(hOptionsInitialize);
	UnhookEvent(hModulesLoaded);
	UnhookEvent(hOkToExit);
	UnhookEvent(hEventStatusChanged);
	UnhookEvent(hIconsChanged);
	UnhookEvent(hFontsChanged);
	UnhookEvent(hTBLoaded);

	DestroyServiceFunction(hShowHistory);
	DestroyServiceFunction(hTogglePopup);
	DestroyServiceFunction(hGetStatus);
	DestroyServiceFunction(hSquareFad);

	DeleteObject(fonts.title);
	DeleteObject(fonts.clock);
	DeleteObject(fonts.text);
	DeleteObject(fonts.action);
	DeleteObject(fonts.actionHover);

	DeleteObject(hbmNoAvatar);

	FreeLibrary(hDwmapiDll);
	FreeLibrary(hUserDll);
	FreeLibrary(hMsimgDll);
//	FreeLibrary(hKernelDll);
	FreeLibrary(hGdiDll);

	if(PopUpOptions.SkinPack) mir_free(PopUpOptions.SkinPack);
	mir_free(PopUpOptions.Effect);

	OptAdv_UnregisterVfx();
	UnloadPopupThread();
	UnloadPopupWnd2();
	PopupHistoryUnload();

	UnregisterClass (MAKEINTATOM(g_wndClass.cPopupWnd2),hInst);
	UnregisterClassW(L"PopupEditBox",hInst);
	UnregisterClass (MAKEINTATOM(g_wndClass.cPopupMenuHostWnd),hInst);
	UnregisterClass (MAKEINTATOM(g_wndClass.cPopupThreadManagerWnd),hInst);
	UnregisterClass (MAKEINTATOM(g_wndClass.cPopupPreviewBoxWndclass),hInst);
	UnregisterClass (MAKEINTATOM(g_wndClass.cPopupPlusDlgBox),hInst);

	UnloadGDIPlus();

	UnloadActions();

	CloseHandle(hMainThread);

	return 0;
}
Ejemplo n.º 3
0
void
khm_create_main_window(void) {
    wchar_t buf[1024];
    khm_handle csp_cw = NULL;
    RECT r;

    LoadString(khm_hInstance, IDS_MAIN_WINDOW_TITLE,
               buf, ARRAYLENGTH(buf));

    khm_hwnd_null =
        CreateWindow(MAKEINTATOM(khm_null_window_class),
                     buf,
                     0,         /* Style */
                     0, 0,      /* x, y */
                     100, 100,  /* width, height */
                     NULL,      /* parent */
                     NULL,      /* menu */
                     NULL,      /* HINSTANCE */
                     0);        /* lparam */

    if (!khm_hwnd_null)
        return;

    if (KHM_SUCCEEDED(khc_open_space(NULL, L"CredWindow",
                                     KHM_PERM_READ,
                                     &csp_cw))) {
        khm_int32 t;

        if (KHM_SUCCEEDED(khc_read_int32(csp_cw, L"DefaultWindowMode", &t))) {
            khm_set_main_window_mode(t);
        }

        khc_close_space(csp_cw);
    }

    khm_get_main_window_rect(&r);

    khm_hwnd_main =
        CreateWindowEx(WS_EX_OVERLAPPEDWINDOW | WS_EX_APPWINDOW,
                       MAKEINTATOM(khm_main_window_class),
                       buf,
                       WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN |
                       WS_CLIPSIBLINGS,
                       r.left, r.top,
                       r.right - r.left,
                       r.bottom - r.top,
                       khm_hwnd_null,
                       NULL,
                       NULL,
                       NULL);

    khui_set_main_window(khm_hwnd_main);
}
Ejemplo n.º 4
0
void VLCFullScreenWnd::UnRegisterWndClassName()
{
    if(0 != _fullscreen_wndclass_atom){
        UnregisterClass(MAKEINTATOM(_fullscreen_wndclass_atom), _hinstance);
        _fullscreen_wndclass_atom = 0;
    }

    if(0 != _fullscreen_controls_wndclass_atom){
        UnregisterClass(MAKEINTATOM(_fullscreen_controls_wndclass_atom), _hinstance);
        _fullscreen_controls_wndclass_atom = 0;
    }
}
Ejemplo n.º 5
0
void StoreNewWindowRect(HWND hWnd, HDWP hDwp, LPCRECT pRect)
{
	ATLASSERT( ::IsWindow(hWnd) );
	ATLASSERT( pRect != NULL );

	SetProp( hWnd, MAKEINTATOM(g_atomPropHDWP), (HANDLE) hDwp );

	HANDLE hptTopLeft = (HANDLE) MAKELONG( (SHORT) pRect->left, (SHORT) pRect->top ),
		hptBottomRight = (HANDLE) MAKELONG( (SHORT) pRect->right, (SHORT) pRect->bottom );
	SetProp( hWnd, MAKEINTATOM(g_atomPropTopLeft), hptTopLeft );
	SetProp( hWnd, MAKEINTATOM(g_atomPropBottomRight), hptBottomRight );
}
Ejemplo n.º 6
0
BOOL _SetWindowContextHelpId(PWND pWnd, DWORD dwContextId)
{
    //If dwContextId is NULL, then this implies that the caller wants to
    // remove the dwContextId associated with this Window.
    if(dwContextId == 0) {
        InternalRemoveProp(pWnd, MAKEINTATOM(gpsi->atomContextHelpIdProp),
                PROPF_INTERNAL);
        return(TRUE);
      }

    return (InternalSetProp(pWnd, MAKEINTATOM(gpsi->atomContextHelpIdProp),
            (HANDLE)LongToHandle( dwContextId ), PROPF_INTERNAL | PROPF_NOPOOL));
}
Ejemplo n.º 7
0
bool CFidgetApp::UnregisterClasses(void)
{
    bool b = true;
    if (0 != m_atmMain)
    {
        if (FALSE == UnregisterClass(MAKEINTATOM(m_atmMain), m_hInstance))
        {
            b = false;
        }
        m_atmMain = 0;
    }

    if (0 != m_atmSession)
    {
        if (FALSE == UnregisterClass(MAKEINTATOM(m_atmSession), m_hInstance))
        {
            b = false;
        }
        m_atmSession = 0;
    }

    if (0 != m_atmOutput)
    {
        if (FALSE == UnregisterClass(MAKEINTATOM(m_atmOutput), m_hInstance))
        {
            b = false;
        }
        m_atmOutput = 0;
    }

    if (0 != m_atmInput)
    {
        if (FALSE == UnregisterClass(MAKEINTATOM(m_atmInput), m_hInstance))
        {
            b = false;
        }
        m_atmInput = 0;
    }

    if (NULL != m_brushBlack)
    {
        if (FALSE == DeleteObject(m_brushBlack))
        {
            b = false;
        }
        m_brushBlack = NULL;
    }

    return b;
}
Ejemplo n.º 8
0
StWinHandles::StWinHandles()
#ifdef _WIN32
: ThreadWnd(0),
  EventMsgThread(true),
  hWindow(NULL),
  hWindowGl(NULL),
  hWinTmp(NULL),
  myMKeyStop(GlobalAddAtom(MAKEINTATOM(VK_MEDIA_STOP))),
  myMKeyPlay(GlobalAddAtom(MAKEINTATOM(VK_MEDIA_PLAY_PAUSE))),
  myMKeyPrev(GlobalAddAtom(MAKEINTATOM(VK_MEDIA_PREV_TRACK))),
  myMKeyNext(GlobalAddAtom(MAKEINTATOM(VK_MEDIA_NEXT_TRACK))),
  ThreadGL(0),
  hDC(NULL)
#elif defined(__ANDROID__)
: hWindowGl(NULL)
Ejemplo n.º 9
0
/* DllMain is invoked by every process in the entire system that is hooked
 * by our window hooks, notably the tty processes' context, and by the user
 * who wants tty messages (the app).  Keep it light and simple.
 */
BOOL __declspec(dllexport) APIENTRY DllMain(HINSTANCE hModule, ULONG ulReason, 
                                            LPVOID pctx)
{
    if (ulReason == DLL_PROCESS_ATTACH) 
    {
        //hmodThis = hModule;
        if (!hookwndmsg) {
            origwndprop = MAKEINTATOM(GlobalAddAtom("Win9xConHookOrigProc"));
            hookwndprop = MAKEINTATOM(GlobalAddAtom("Win9xConHookThunkWnd"));
            hookwndmsg = RegisterWindowMessage("Win9xConHookMsg");
        }
#ifdef DBG
//        DbgPrintf("H ProcessAttach:%8.8x\r\n", 
//                  GetCurrentProcessId());
#endif
    }
    else if ( ulReason == DLL_PROCESS_DETACH ) 
    {
#ifdef DBG
//        DbgPrintf("H ProcessDetach:%8.8x\r\n", GetCurrentProcessId());                
#endif
        if (monitor_hwnd)
            SendMessage(monitor_hwnd, WM_DESTROY, 0, 0);
        if (is_subclassed) 
            SendMessage(hwtty, hookwndmsg, 0, (LPARAM)hwtty);
        if (hmodHook)
        {
            if (hhkGetMessage) {
                UnhookWindowsHookEx(hhkGetMessage);
                hhkGetMessage = NULL;
            }
            //if (hhkCallWndProc) {
            //    UnhookWindowsHookEx(hhkCallWndProc);
            //    hhkCallWndProc = NULL;
            //}
            FreeLibrary(hmodHook);
            hmodHook = NULL;
        }
        if (is_service)
            RegisterWindows9xService(FALSE);
        if (hookwndmsg) {
            GlobalDeleteAtom((ATOM)origwndprop);
            GlobalDeleteAtom((ATOM)hookwndprop);
            hookwndmsg = 0;
        }
    }
    return TRUE;
}
Ejemplo n.º 10
0
LRESULT _etk_create_window(EWin32GraphicsEngine *win32Engine, etk_win32_gdi_callback_t *callback)
{
	if(win32Engine == NULL || callback == NULL ||
	   callback->command != WM_ETK_MESSAGE_CREATE_WINDOW || callback->win == NULL) return FALSE;

	EAutolock <EWin32GraphicsEngine> autolock(win32Engine);
	if(autolock.IsLocked() == false || win32Engine->InitCheck() != E_OK) return FALSE;

	LONG style = _etk_get_window_style(E_TITLED_WINDOW_LOOK);
	LONG styleEx = _etk_get_window_style_ex(E_TITLED_WINDOW_LOOK);

	RECT r;
	r.left = callback->x;
	r.top = callback->y;
	r.right = callback->x + (int)callback->w;
	r.bottom = callback->y + (int)callback->h;

	AdjustWindowRectEx(&r, style, FALSE, styleEx);

	if((callback->win->win32Window = CreateWindowEx(styleEx, MAKEINTATOM(win32Engine->win32RegisterClass), "", style,
							r.left, r.top, r.right - r.left + 1, r.bottom - r.top + 1,
							NULL, NULL, win32Engine->win32Hinstance, NULL)) == NULL) return FALSE;

	callback->win->fLook = E_TITLED_WINDOW_LOOK;

	// FIXME: maybe 64-bit pointer
	SetWindowLong(callback->win->win32Window, 0, reinterpret_cast<long>(win32Engine));
	SetWindowLong(callback->win->win32Window, GWL_USERDATA, reinterpret_cast<long>(callback->win));

	return TRUE;
}
Ejemplo n.º 11
0
 bool CreateOpenGLContext()
 {
     PIXELFORMATDESCRIPTOR pfd;
     RECT rect = { 0, 0, 10, 10 };
     WNDCLASSEX wcex;
     wcex.cbSize = sizeof ( WNDCLASSEX );
     wcex.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
     wcex.lpfnWndProc = ( WNDPROC ) DefWindowProc;
     wcex.cbClsExtra = 0;
     wcex.cbWndExtra = 0;
     wcex.hInstance = GetModuleHandle ( NULL );
     wcex.hIcon = LoadIcon ( NULL, IDI_WINLOGO );
     wcex.hCursor = LoadCursor ( NULL, IDC_ARROW );
     wcex.hbrBackground = NULL;
     wcex.lpszMenuName = NULL;
     wcex.lpszClassName = "glUnitTest";
     wcex.hIconSm = NULL;
     atom = RegisterClassEx ( &wcex );
     hWnd = CreateWindowEx ( WS_EX_APPWINDOW | WS_EX_WINDOWEDGE,
                             MAKEINTATOM ( atom ), "OpenGL Unit Testing Window",
                             WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
                             0, 0, // Location
                             rect.right - rect.left, rect.bottom - rect.top, // dimensions
                             NULL,
                             NULL,
                             GetModuleHandle ( NULL ),
                             NULL );
     hDC = GetDC ( hWnd );
     pfd.nSize = sizeof ( PIXELFORMATDESCRIPTOR );
     pfd.nVersion = 1;
     pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
     pfd.iPixelType = PFD_TYPE_RGBA;
     pfd.cColorBits = 32;
     pfd.cRedBits = 0;
     pfd.cRedShift = 0;
     pfd.cGreenBits = 0;
     pfd.cGreenShift = 0;
     pfd.cBlueBits = 0;
     pfd.cBlueShift = 0;
     pfd.cAlphaBits = 0;
     pfd.cAlphaShift = 0;
     pfd.cAccumBits = 0;
     pfd.cAccumRedBits = 0;
     pfd.cAccumGreenBits = 0;
     pfd.cAccumBlueBits = 0;
     pfd.cAccumAlphaBits = 0;
     pfd.cDepthBits = 32;
     pfd.cStencilBits = 0;
     pfd.cAuxBuffers = 0;
     pfd.iLayerType = PFD_MAIN_PLANE;
     pfd.bReserved = 0;
     pfd.dwLayerMask = 0;
     pfd.dwVisibleMask = 0;
     pfd.dwDamageMask = 0;
     int pf = ChoosePixelFormat ( hDC, &pfd );
     SetPixelFormat ( hDC, pf, &pfd );
     hRC = wglCreateContext ( hDC );
     wglMakeCurrent ( hDC, hRC );
     return true;
 }
Ejemplo n.º 12
0
void VLCHolderWnd::UnRegisterWndClassName()
{
    if(0 != _holder_wndclass_atom){
        UnregisterClass(MAKEINTATOM(_holder_wndclass_atom), _hinstance);
        _holder_wndclass_atom = 0;
    }
}
Ejemplo n.º 13
0
/***********************************************************************
 *      UXTHEME_SetWindowProperty
 *
 * I'm using atoms as there may be large numbers of duplicated strings
 * and they do the work of keeping memory down as a cause of that quite nicely
 */
static HRESULT UXTHEME_SetWindowProperty(HWND hwnd, ATOM aProp, LPCWSTR pszValue)
{
    ATOM oldValue = (ATOM)(size_t)RemovePropW(hwnd, (LPCWSTR)MAKEINTATOM(aProp));
    if(oldValue)
        DeleteAtom(oldValue);
    if(pszValue) {
        ATOM atValue = AddAtomW(pszValue);
        if(!atValue
           || !SetPropW(hwnd, (LPCWSTR)MAKEINTATOM(aProp), (LPWSTR)MAKEINTATOM(atValue))) {
            HRESULT hr = HRESULT_FROM_WIN32(GetLastError());
            if(atValue) DeleteAtom(atValue);
            return hr;
        }
    }
    return S_OK;
}
Ejemplo n.º 14
0
Window::Window(const wchar_t* title)
    : mHwnd()
{
    const auto hInstance = static_cast<HINSTANCE>(GetModuleHandle(nullptr));
        
    if (0 == sWndClass)
    {
        const auto wndClassName = L"Ten18::Window";
        WNDCLASSEX wcex = {};
        wcex.cbSize = sizeof(WNDCLASSEX);
        wcex.lpfnWndProc = &Window::WndProc;
        wcex.hInstance = hInstance;
        wcex.lpszClassName = wndClassName;
        
        Ten18_EXPECT.NotZero = sWndClass = RegisterClassEx(&wcex);
    }
    
    const auto style = WS_OVERLAPPEDWINDOW;
    const auto styleEx = WS_EX_OVERLAPPEDWINDOW;
    
    Ten18_EXPECT.NotNull = mHwnd = CreateWindowEx(styleEx, MAKEINTATOM(sWndClass), title, style,
                                            CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
                                            nullptr, nullptr, hInstance, this);
    Input::RawInput::Register(mHwnd);

    Ten18_EXPECT.Zero = ShowWindow(mHwnd, SW_SHOWDEFAULT);
    Ten18_EXPECT.NotZero = UpdateWindow(mHwnd);

    InterlockedIncrement(&sWndCount);
}
Ejemplo n.º 15
0
 WindowImpl* Win32GUIFactory::createWindowImpl(Window* in_window) 
 { 
   WindowImpl* impl = new Win32WindowImpl(in_window);
   
   RECT size;
 
   size.left = 0;
   size.right = in_window->width-1;
   size.top  = 0;
   size.bottom = in_window->height-1;
 
   // no menu
 
   AdjustWindowRect(&size, WS_CAPTION|WS_SYSMENU|WS_THICKFRAME|WS_MINIMIZEBOX|WS_MAXIMIZEBOX, false);
 
   HWND success = CreateWindow(
     MAKEINTATOM(Win32WindowImpl::classAtom), in_window->title,
     WS_OVERLAPPEDWINDOW,
     CW_USEDEFAULT, 0,
     size.right- size.left+1, size.bottom - size.top+1,
     NULL, NULL, 
     (HINSTANCE) Win32WindowImpl::moduleHandle, (LPVOID) impl
   );
   
   if (!success) {
     printMessage("gui/win32: unable to create window failed");
     return NULL;
   }
   
   return impl;
 }
Ejemplo n.º 16
0
HWND uie_albumart::create_or_transfer_window(HWND wnd_parent, const uie::window_host_ptr & p_host, const ui_helpers::window_position_t & p_position)
{
    if (m_hWnd == NULL) {
        static const TCHAR g_class_name[] = _T("foo_uie_albumart.dll window class");
        static ATOM g_class_atom = 0;
        if (g_class_atom == 0)
        {
            WNDCLASS wc;
            memset(&wc,0,sizeof(wc));
            wc.style = CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS;
            wc.lpfnWndProc = host_proc;
            wc.hInstance = core_api::get_my_instance();
            wc.hCursor = ::LoadCursor(0,IDC_ARROW);
            wc.hbrBackground = NULL;
            wc.lpszClassName = g_class_name;
            g_class_atom = RegisterClass(&wc);
        }

        m_hWnd = ::CreateWindowEx(exstyle_from_config(m_config.edge_style),
            MAKEINTATOM(g_class_atom),_T("Album Art"),
            WS_CHILD,
            CW_USEDEFAULT,CW_USEDEFAULT,
            0,0,
            wnd_parent,0,core_api::get_my_instance(),this);
    } else {
        ::ShowWindow(m_hWnd, SW_HIDE);
        ::SetParent(m_hWnd, wnd_parent);
        ::SetWindowPos(m_hWnd, NULL, p_position.x, p_position.y, p_position.cx, p_position.cy, SWP_NOZORDER);
        m_host->relinquish_ownership(m_hWnd);
        m_host.release();
    }
    m_host = p_host;
    return m_hWnd;
}
Ejemplo n.º 17
0
// ---------------------------------------------------------------------------
WindowImpl* Win32GUIFactory::createWindowImpl(Window* in_window)
{
  WindowImpl* impl = new Win32WindowImpl(in_window);

  RECT size;

  size.left = 0;
  size.right = in_window->width-1;
  size.top  = 0;
  size.bottom = in_window->height-1;

  // no menu

  AdjustWindowRect(&size, WS_CAPTION|WS_SYSMENU|WS_THICKFRAME|WS_MINIMIZEBOX|WS_MAXIMIZEBOX, false);

  HWND success = CreateWindow(
    MAKEINTATOM(Win32WindowImpl::classAtom), in_window->title,
    WS_OVERLAPPEDWINDOW,
    CW_USEDEFAULT, 0,
    size.right- size.left+1, size.bottom - size.top+1,
    NULL, NULL,
    NULL, (LPVOID) impl
  );
  assert(success);
  return impl;
}
Ejemplo n.º 18
0
LONG CLayoutRuleRelativeControl::Apply(CWindow wndLayout, UINT nDirection,
										const CRect& rcLayout) const
{
	CWindow wndCtrl = wndLayout.GetDlgItem( m_nCtrlID );
	ATLASSERT( ::IsWindow(wndCtrl) );

	CRect rcPadding( 0, 0, m_nPadding, m_nPadding );
	::MapDialogRect( wndLayout, rcPadding );

	HDWP hDwp = (HDWP) GetProp( wndLayout, MAKEINTATOM(g_atomPropHDWP) );
	CRect rcCtrl;
	GetNewWindowRect( wndCtrl, hDwp, rcCtrl );

	switch ( this->m_nDirection )
	{
		case LAYOUT_DIRECTION_LEFT:
			ATLASSERT( nDirection == LAYOUT_DIRECTION_LEFT || nDirection == LAYOUT_DIRECTION_RIGHT );
			return rcCtrl.left - rcPadding.Width();
		case LAYOUT_DIRECTION_TOP:
			ATLASSERT( nDirection == LAYOUT_DIRECTION_TOP || nDirection == LAYOUT_DIRECTION_BOTTOM );
			return rcCtrl.top - rcPadding.Height();
		case LAYOUT_DIRECTION_RIGHT:
			ATLASSERT( nDirection == LAYOUT_DIRECTION_LEFT || nDirection == LAYOUT_DIRECTION_RIGHT );
			return rcCtrl.right + rcPadding.Width();
		case LAYOUT_DIRECTION_BOTTOM:
			ATLASSERT( nDirection == LAYOUT_DIRECTION_TOP || nDirection == LAYOUT_DIRECTION_BOTTOM );
			return rcCtrl.bottom + rcPadding.Height();
		default:
			ATLASSERT(FALSE);
			return 0;
	}
}
Ejemplo n.º 19
0
/***********************************************************************
 *      OpenThemeDataEx                                     (UXTHEME.61)
 */
HTHEME WINAPI OpenThemeDataEx(HWND hwnd, LPCWSTR pszClassList, DWORD flags)
{
    WCHAR szAppBuff[256];
    WCHAR szClassBuff[256];
    LPCWSTR pszAppName;
    LPCWSTR pszUseClassList;
    HTHEME hTheme = NULL;
    TRACE("(%p,%s, %x)\n", hwnd, debugstr_w(pszClassList), flags);

    if(flags)
        FIXME("unhandled flags: %x\n", flags);

    if(bThemeActive)
    {
        pszAppName = UXTHEME_GetWindowProperty(hwnd, atSubAppName, szAppBuff, sizeof(szAppBuff)/sizeof(szAppBuff[0]));
        /* If SetWindowTheme was used on the window, that overrides the class list passed to this function */
        pszUseClassList = UXTHEME_GetWindowProperty(hwnd, atSubIdList, szClassBuff, sizeof(szClassBuff)/sizeof(szClassBuff[0]));
        if(!pszUseClassList)
            pszUseClassList = pszClassList;

        if (pszUseClassList)
            hTheme = MSSTYLES_OpenThemeClass(pszAppName, pszUseClassList);
    }
    if(IsWindow(hwnd))
        SetPropW(hwnd, (LPCWSTR)MAKEINTATOM(atWindowTheme), hTheme);
    TRACE(" = %p\n", hTheme);
    return hTheme;
}
Ejemplo n.º 20
0
HWND MakeWindow(
    const wchar_t* title, ULONG style, HMENU menu, const SIZE& size, MessageHandler* handlers) {
  WNDCLASSEXW wcex = {sizeof(wcex)};
  wcex.hCursor = ::LoadCursorW(NULL, IDC_ARROW);
  wcex.hInstance = ThisModule();
  wcex.hIcon = ::LoadIcon(ThisModule(), MAKEINTRESOURCE(IDI_FILECLEANER));
  wcex.lpszMenuName	= MAKEINTRESOURCE(IDC_FILECLEANER);
  wcex.lpszClassName = __FILEW__;
  wcex.lpfnWndProc = [] (HWND window, UINT message, WPARAM wparam, LPARAM lparam) -> LRESULT {
    static MessageHandler* s_handlers = reinterpret_cast<MessageHandler*>(lparam);
    size_t ix = 0;
    while (s_handlers[ix].message != -1) {
      if (s_handlers[ix].message == message)
        return s_handlers[ix].callback(window, wparam, lparam);
      ++ix;
    }

    return ::DefWindowProcW(window, message, wparam, lparam);
  };

  wcex.lpfnWndProc(NULL, 0, 0, reinterpret_cast<UINT_PTR>(handlers));
  ATOM atom = VerifyNot(::RegisterClassExW(&wcex), 0);
  int pos_def = CW_USEDEFAULT;
  return ::CreateWindowExW(0, MAKEINTATOM(atom), title, style,
                           pos_def, pos_def, size.cx, size.cy,
                           NULL, menu, ThisModule(), NULL); 
}
Ejemplo n.º 21
0
//======================================================
//-------------------------------+++--> Open "Calendar":
HWND CreateCalender(HWND hwnd)   //---------------+++-->
{
	INITCOMMONCONTROLSEX icex = {sizeof(icex), ICC_DATE_CLASSES};
	WNDCLASSEX wcx = {sizeof(wcx)};
	ATOM calclass;
	m_bAutoClose = api.GetInt(L"Calendar", L"CloseCalendar", 1);
	m_bTopMost = api.GetInt(L"Calendar", L"CalendarTopMost", 0);
	InitCommonControlsEx(&icex);
	
	wcx.style = 0;
	wcx.lpfnWndProc = Window_Calendar;
	wcx.cbClsExtra = 0;
	wcx.cbWndExtra = 0;
	wcx.hInstance = g_instance;
	wcx.hIcon = NULL;
	wcx.hIcon = LoadIcon(g_instance,MAKEINTRESOURCE(IDI_MAIN));
	wcx.hCursor = LoadCursor(NULL,IDC_ARROW);
	wcx.hbrBackground = (HBRUSH)COLOR_WINDOWFRAME;
	wcx.lpszMenuName = NULL;
	wcx.lpszClassName = L"ClockFlyoutWindow";
	wcx.hIconSm = NULL;
	calclass = RegisterClassEx(&wcx);
	hwnd = CreateWindowEx(0, MAKEINTATOM(calclass), L"T-Clock: Calendar", (WS_CAPTION|WS_POPUP|WS_SYSMENU|WS_VISIBLE), 0,0,0,0, hwnd, 0, g_instance, NULL);
	return hwnd;
}
Ejemplo n.º 22
0
LPCWSTR CDialogItemTemplate::GetClassName() const
{
	const WORD* pw = GetDataPtr();
	if ( *pw == 0xFFFF )
		return (LPCWSTR) MAKEINTATOM(pw[1]);
	else
		return (LPCWSTR) pw;
}
Ejemplo n.º 23
0
static void
initialize_if_necessary(void)
{
    if (message_window_class == 0) {
        WNDCLASSEX c = {
            sizeof(WNDCLASSEX), /* cbSize */
            0,                  /* style */
            notifier_wnd_proc,  /* lpfnWndProc */
            0,                  /* cbClsExtra */
            0,                  /* cbWndExtra */
            NULL,               /* hinstance */
            NULL,               /* hIcon */
            NULL,               /* hCursor */
            NULL,               /* hbrBackground */
            NULL,               /* lpszMenuName */
            L"OpenAFSTokenStateIconNotifier", /* lpszClassName */
            NULL,                             /* hIconSm */
        };

        c.hInstance = hInstance;
        message_window_class = RegisterClassEx(&c);
    }

    if (notifier_window == NULL && message_window_class != 0) {
        notifier_window = CreateWindow(MAKEINTATOM(message_window_class),
                                       L"OpenAFSTokenStateIconNotifierWindow",
                                       0, 0, 0, 0, 0,
                                       HWND_MESSAGE,
                                       NULL,
                                       hInstance,
                                       NULL);
    }

    assert(notifier_window != NULL);

    if (!notification_icon_added && notifier_window != NULL) {
        NOTIFYICONDATA idata;

        ZeroMemory(&idata, sizeof(idata));

        idata.cbSize = sizeof(idata);
        idata.hWnd = notifier_window;
        idata.uID = TOKEN_ICON_ID;
        idata.uFlags = NIF_ICON | NIF_MESSAGE;
        idata.uCallbackMessage = TOKEN_MESSAGE_ID;
        idata.hIcon = (HICON) LoadImage(hResModule, MAKEINTRESOURCE(IDI_CRED_NONE),
                                        IMAGE_ICON, 0, 0,
                                        LR_DEFAULTSIZE | LR_DEFAULTCOLOR | LR_SHARED);
        notification_icon_added = Shell_NotifyIcon(NIM_ADD, &idata);

        idata.cbSize = sizeof(idata);
        idata.uVersion = NOTIFYICON_VERSION;

        Shell_NotifyIcon(NIM_SETVERSION, &idata);

        assert(notification_icon_added);
    }
}
Ejemplo n.º 24
0
BOOL _HasCaptionIcon(PWND pwnd)
{
    HICON hIcon;
    PCLS pcls;

    if (TestWF(pwnd, WEFTOOLWINDOW))
        // it's a tool window -- it doesn't get an icon
        return(FALSE);

    if ((TestWF(pwnd, WFBORDERMASK) != (BYTE)LOBYTE(WFDLGFRAME)) &&
            !TestWF(pwnd, WEFDLGMODALFRAME))
        // they are not trying to look like a dialog, they get an icon
        return TRUE;

    if (!TestWF(pwnd, WFWIN40COMPAT) &&
        (((PCLS)REBASEALWAYS(pwnd, pcls))->atomClassName == (ATOM)DIALOGCLASS))
        // it's an older REAL dialog -- it doesn't get an icon
        return(FALSE);

    hIcon = (HICON) _GetProp(pwnd, MAKEINTATOM(gpsi->atomIconSmProp), TRUE);

    if (hIcon) {
        // it's a 4.0 dialog with a small icon -- if that small icon is
        // something other than the generic small windows icon, it gets an icon
        return(hIcon != gpsi->hIconSmWindows);
    }
    hIcon = (HICON) _GetProp(pwnd, MAKEINTATOM(gpsi->atomIconProp), TRUE);

    if (hIcon && (hIcon != gpsi->hIcoWindows))
        // it's a 4.0 dialog with no small icon, but instead a large icon
        // that's not the generic windows icon -- it gets an icon
        return(TRUE);

    pcls = REBASEALWAYS(pwnd, pcls);
    if (pcls->spicnSm) {
        if (pcls->spicnSm != HMObjectFromHandle(gpsi->hIconSmWindows)) {
            // it's a 4.0 dialog with a class icon that's not the generic windows
            // icon -- it gets an icon
            return(TRUE);
        }
    }

    // it's a 4.0 dialog with no small or large icon -- it doesn't get an icon
    return(FALSE);
}
Ejemplo n.º 25
0
static LPWSTR UXTHEME_GetWindowProperty(HWND hwnd, ATOM aProp, LPWSTR pszBuffer, int dwLen)
{
    ATOM atValue = (ATOM)(size_t)GetPropW(hwnd, (LPCWSTR)MAKEINTATOM(aProp));
    if(atValue) {
        if(GetAtomNameW(atValue, pszBuffer, dwLen))
            return pszBuffer;
        TRACE("property defined, but unable to get value\n");
    }
    return NULL;
}
Ejemplo n.º 26
0
MIRAPI int Unload(void)
{
	DeleteObject(fonts.title);
	DeleteObject(fonts.clock);
	DeleteObject(fonts.text);
	DeleteObject(fonts.action);
	DeleteObject(fonts.actionHover);

	DeleteObject(hbmNoAvatar);

	FreeLibrary(hDwmapiDll);
	FreeLibrary(hUserDll);
	FreeLibrary(hMsimgDll);
	FreeLibrary(hGdiDll);

	DestroyHookableEvent(hEventNotify);

	mir_free(PopupOptions.SkinPack);
	mir_free(PopupOptions.Effect);

	OptAdv_UnregisterVfx();
	UnloadPopupThread();
	UnloadPopupWnd2();
	PopupHistoryUnload();
	SrmmMenu_Unload();

	UnregisterClass (MAKEINTATOM(g_wndClass.cPopupWnd2),hInst);
	UnregisterClassW(L"PopupEditBox",hInst);
	UnregisterClass (MAKEINTATOM(g_wndClass.cPopupMenuHostWnd),hInst);
	UnregisterClass (MAKEINTATOM(g_wndClass.cPopupThreadManagerWnd),hInst);
	UnregisterClass (MAKEINTATOM(g_wndClass.cPopupPreviewBoxWndclass),hInst);
	UnregisterClass (MAKEINTATOM(g_wndClass.cPopupPlusDlgBox),hInst);

	UnloadGDIPlus();

	UnloadActions();
	UnloadTreeData();

	CloseHandle(hMainThread);

	return 0;
}
Ejemplo n.º 27
0
//	普通のウィンドウを作成
HWND CreateSimpleWnd(ATOM clsName, LPCTSTR pszWindowTitle, HINSTANCE hInst, void* lParam)
{
	return ::CreateWindow( MAKEINTATOM(clsName),
						   pszWindowTitle,
						   WS_OVERLAPPEDWINDOW| WS_CLIPCHILDREN,
						   CW_USEDEFAULT, 0,
						   CW_USEDEFAULT, 0,
						   NULL, NULL,
						   hInst,
						   lParam);
}
Ejemplo n.º 28
0
static void test_ole_menu(void)
{
	HWND hwndFrame;
	HRESULT hr;

	hwndFrame = CreateWindow(MAKEINTATOM(register_dummy_class()), "Test", 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, NULL, NULL);
	hr = OleSetMenuDescriptor(NULL, hwndFrame, NULL, NULL, NULL);
	todo_wine ok_ole_success(hr, "OleSetMenuDescriptor");

	DestroyWindow(hwndFrame);
}
Ejemplo n.º 29
0
HWND CreateMessageWnd(ATOM clsName, void* lParam)
{
	return ::CreateWindow(MAKEINTATOM(clsName),
						  nullptr,
						  0,
						  CW_USEDEFAULT, CW_USEDEFAULT,
						  CW_USEDEFAULT, CW_USEDEFAULT,
						  HWND_MESSAGE,
						  nullptr, nullptr,
						  lParam);
}
Ejemplo n.º 30
0
PWND_CONTEXT ThemeGetWndContext(HWND hWnd)
{
    PWND_CONTEXT pcontext;

    pcontext = (PWND_CONTEXT)GetPropW(hWnd, (LPCWSTR)MAKEINTATOM(atWndContrext));
    if(pcontext == NULL)
    {
        pcontext = HeapAlloc(GetProcessHeap(), 
                            HEAP_ZERO_MEMORY, 
                            sizeof(WND_CONTEXT));
        if(pcontext == NULL)
        {
            return NULL;
        }
        
        SetPropW( hWnd, (LPCWSTR)MAKEINTATOM(atWndContrext), pcontext);
    }

    return pcontext;
}