Beispiel #1
0
        internal static short GlobalDeleteAtom(short atom)
        {
            short result = NativeMethodsSetLastError.GlobalDeleteAtom(atom);

            ThrowWin32ExceptionsIfError(Marshal.GetLastWin32Error());
            return(result);
        }
Beispiel #2
0
        internal static int GetWindowLong(NativeMethods.HWND hWnd, int nIndex)
        {
            int    iResult = 0;
            IntPtr result  = IntPtr.Zero;
            int    error   = 0;

            if (IntPtr.Size == 4)
            {
                // use GetWindowLong
                iResult = NativeMethodsSetLastError.GetWindowLong(hWnd, nIndex);
                error   = Marshal.GetLastWin32Error();
                result  = new IntPtr(iResult);
            }
            else
            {
                // use GetWindowLongPtr
                result  = NativeMethodsSetLastError.GetWindowLongPtr(hWnd, nIndex);
                error   = Marshal.GetLastWin32Error();
                iResult = IntPtrToInt32(result);
            }

            if ((result == IntPtr.Zero) && (error != 0))
            {
                ThrowWin32ExceptionsIfError(error);
            }

            return(iResult);
        }
Beispiel #3
0
        internal static NativeMethods.HWND GetWindow(NativeMethods.HWND hwnd, int uCmd)
        {
            NativeMethods.HWND result = NativeMethodsSetLastError.GetWindow(hwnd, uCmd);
            int lastWin32Error        = Marshal.GetLastWin32Error();

            if (result == NativeMethods.HWND.NULL)
            {
                ThrowWin32ExceptionsIfError(lastWin32Error);
            }

            return(result);
        }
Beispiel #4
0
        internal static bool GetMenuBarInfo(NativeMethods.HWND hwnd, int idObject, uint item, ref UnsafeNativeMethods.MENUBARINFO mbi)
        {
            bool result         = NativeMethodsSetLastError.GetMenuBarInfo(hwnd, idObject, item, ref mbi);
            int  lastWin32Error = Marshal.GetLastWin32Error();

            if (!result)
            {
                ThrowWin32ExceptionsIfError(lastWin32Error);
            }

            return(result);
        }