public static bool FlashWindow(HWND hWnd, bool flashUntilForeground)
		{
			FLASHINFO fwi;
			fwi.cbSize		= (UINT)Marshal.SizeOf(typeof(FLASHINFO));	// size
			fwi.hwnd		= hWnd;									// the window to flash
			fwi.dwFlags		= (flashUntilForeground ? FLASHW_ALL | FLASHW_TIMERNOFG : FLASHW_ALL);							// flash the caption and tray
			fwi.uCount		= 5;									// how many times to flash it
			fwi.dwTimeout	= 0;									// use the default cursor blink rate

			return (FlashWindowEx(ref fwi) == BOOL.TRUE);
		}
		/// <summary>
		/// Flashes the window specified the number of times specified.
		/// </summary>
		/// <param name="hWnd">The window to flash.</param>
		/// <param name="flashCount">The number of times to flash it.</param>
		/// <returns></returns>
		public static bool FlashWindow(HWND hWnd, int flashCount)
		{
			FLASHINFO fwi;
			fwi.cbSize		= (UINT)Marshal.SizeOf(typeof(FLASHINFO));	// size
			fwi.hwnd		= hWnd;									// the window to flash
			fwi.dwFlags		= FLASHW_ALL;							// flash the caption and tray
			fwi.uCount		= (UINT)flashCount;							// how many times to flash it
			fwi.dwTimeout	= 0;									// use the default cursor blink rate

			return (FlashWindowEx(ref fwi) == BOOL.TRUE);
		}
Example #3
0
        public GraphicsPlus(HWND hwnd,
                 bool icm)
        {
            GpGraphics Graphics = new GpGraphics();

            if (icm)
            {
                lastResult = NativeMethods.GdipCreateFromHWNDICM(hwnd, out Graphics);
            }
            else
            {
                lastResult = NativeMethods.GdipCreateFromHWND(hwnd, out Graphics);
            }

            SetNativeGraphics(Graphics);
        }
Example #4
0
 void DoThreading(EFile[] a_Files, List<LrentFile> a_FilesFin, API_Device D)
 {
     HWND v_MainBlock = ThreadManager.CreateSemaphore(0, 1);
     Queue<EFile> m_Files = new Queue<EFile>(a_Files.Length);
     foreach (EFile f in a_Files)
         m_Files.Enqueue(f);
     int c = Math.Max(Environment.ProcessorCount - 2, 1);
     c = Math.Min(c, m_Files.Count);
     c = 1;
     HWND[] m_Threads = new HWND[c];
     object[] O = new object[] { m_Files, a_FilesFin, v_MainBlock, D};
     for (int i = 0; i < m_Threads.Length; i++)
     {
         m_Threads[i] = ThreadManager.CreateThread(DoThreading2);
         ThreadManager.StartThread(m_Threads[i], O);
     }
     ThreadManager.WaitForSingleObject(v_MainBlock);
     ThreadManager.AbortObject(v_MainBlock);
 }
Example #5
0
            override public bool Equals(object oCompare)
            {
                HWND hr = Cast((HWND)oCompare);

                return(h == hr.h);
            }
Example #6
0
 public static extern ButtonStateFlags IsDlgButtonChecked(HWND hDlg, int nIDButton);
Example #7
0
        // Misc functions
#if LATER
BOOL CALLBACK EnumThreadWndProc(HWND hwnd, LPARAM lParam) 
{
	*(HWND*)lParam = hwnd;
	return !IsWindowVisible(hwnd);
}
Example #8
0
 public static extern BOOL BringWindowToTop(HWND hWnd);
Example #9
0
 internal extern static BOOL GetWindowRect(HWND windowHandle, out Win32Rectangle windowRectangle);
Example #10
0
 internal static extern int GetWindowText(HWND hWnd, [MarshalAs(UnmanagedType.LPTStr), In, Out] StringBuilder lpString, int nMaxCount);
Example #11
0
 internal static extern BOOL PostMessage(
     HWND hWnd,
     WindowMessage Msg,
     WPARAM wParam,
     LPARAM lParam
 );
Example #12
0
 public HRESULT SetReferent([NativeTypeName("PCSTR")] sbyte *pcszReferent, HWND hwnd)
 {
     return(((delegate * unmanaged <INewShortcutHookA *, sbyte *, HWND, int>)(lpVtbl[3]))((INewShortcutHookA *)Unsafe.AsPointer(ref this), pcszReferent, hwnd));
 }
 public HRESULT RequestAccessForAppWithAuditingInfoForWindowAsync(HWND appWindow, HSTRING sourceIdentity, HSTRING appPackageFamilyName, IUnknown *auditInfoUnk, [NativeTypeName("const IID &")] Guid *riid, void **asyncOperation)
 {
     return(((delegate * unmanaged <IProtectionPolicyManagerInterop2 *, HWND, HSTRING, HSTRING, IUnknown *, Guid *, void **, int>)(lpVtbl[9]))((IProtectionPolicyManagerInterop2 *)Unsafe.AsPointer(ref this), appWindow, sourceIdentity, appPackageFamilyName, auditInfoUnk, riid, asyncOperation));
 }
 public HRESULT RequestAccessWithMessageForWindowAsync(HWND appWindow, HSTRING sourceIdentity, HSTRING targetIdentity, IUnknown *auditInfoUnk, HSTRING messageFromApp, [NativeTypeName("const IID &")] Guid *riid, void **asyncOperation)
 {
     return(((delegate * unmanaged <IProtectionPolicyManagerInterop2 *, HWND, HSTRING, HSTRING, IUnknown *, HSTRING, Guid *, void **, int>)(lpVtbl[8]))((IProtectionPolicyManagerInterop2 *)Unsafe.AsPointer(ref this), appWindow, sourceIdentity, targetIdentity, auditInfoUnk, messageFromApp, riid, asyncOperation));
 }
 public HRESULT MakeWindowAssociation(HWND WindowHandle, uint Flags)
 {
     return(((delegate * unmanaged <IDXGIFactory7 *, HWND, uint, int>)(lpVtbl[8]))((IDXGIFactory7 *)Unsafe.AsPointer(ref this), WindowHandle, Flags));
 }
 public HRESULT RegisterOcclusionStatusWindow(HWND WindowHandle, uint wMsg, [NativeTypeName("DWORD *")] uint *pdwCookie)
 {
     return(((delegate * unmanaged <IDXGIFactory7 *, HWND, uint, uint *, int>)(lpVtbl[21]))((IDXGIFactory7 *)Unsafe.AsPointer(ref this), WindowHandle, wMsg, pdwCookie));
 }
 public HRESULT CreateSwapChainForHwnd(IUnknown *pDevice, HWND hWnd, [NativeTypeName("const DXGI_SWAP_CHAIN_DESC1 *")] DXGI_SWAP_CHAIN_DESC1 *pDesc, [NativeTypeName("const DXGI_SWAP_CHAIN_FULLSCREEN_DESC *")] DXGI_SWAP_CHAIN_FULLSCREEN_DESC *pFullscreenDesc, IDXGIOutput *pRestrictToOutput, IDXGISwapChain1 **ppSwapChain)
 {
     return(((delegate * unmanaged <IDXGIFactory7 *, IUnknown *, HWND, DXGI_SWAP_CHAIN_DESC1 *, DXGI_SWAP_CHAIN_FULLSCREEN_DESC *, IDXGIOutput *, IDXGISwapChain1 **, int>)(lpVtbl[15]))((IDXGIFactory7 *)Unsafe.AsPointer(ref this), pDevice, hWnd, pDesc, pFullscreenDesc, pRestrictToOutput, ppSwapChain));
 }
Example #18
0
            override public bool Equals(object oCompare)
            {
                HWND temp = Cast((HWND)oCompare);

                return(_value == temp._value);
            }
Example #19
0
 static extern UIntPtr GetWindowLongPtrInternal(HWND hWnd, GetWindowLongOffsets nIndex);
 public static extern int SerialDisplayAdvancedSettings(HWND ParentHwnd, HDEVINFO DeviceInfoSet, [NativeTypeName("PSP_DEVINFO_DATA")] void *DeviceInfoData);
Example #21
0
 internal static extern BOOL ShowWindow(HWND hWnd, ShowWindowCommand nCmdShow);
Example #22
0
        private bool OpenEditorInternal(bool hidden, bool topmost)
        {
            Rectangle wndRect = new Rectangle();

            if (hidden)
            {
                _editorWindow = new PluginWindow //make sure the window is invisible
                {
                    Width               = 100,
                    Height              = 100,
                    WindowStyle         = WindowStyle.None,
                    ShowInTaskbar       = false,
                    ShowActivated       = false,
                    Left                = 0,
                    Top                 = 0,
                    ResizeMode          = ResizeMode.NoResize,
                    Margin              = new Thickness(0),
                    SnapsToDevicePixels = true,
                    UseLayoutRounding   = false,
                    AllowsTransparency  = true,
                    Opacity             = 0,
                    Background          = Brushes.Transparent,
                    SizeToContent       = SizeToContent.WidthAndHeight
                };
            }
            else
            {
                _editorWindow = new PluginWindow() //make sure the window is invisible
                {
                    Width               = 100,
                    Height              = 100,
                    ShowInTaskbar       = true,
                    ShowActivated       = true,
                    Title               = "Plugin Editor: " + PluginContext.PluginCommandStub.GetEffectName(),
                    ResizeMode          = ResizeMode.NoResize,
                    Margin              = new Thickness(0),
                    SnapsToDevicePixels = true,
                    UseLayoutRounding   = false,
                    Topmost             = topmost,
                    SizeToContent       = SizeToContent.WidthAndHeight,
                };
            }

            FrameworkElement pnlClient = _editorWindow.Content as FrameworkElement;

            _editorWindowHelper = new WindowInteropHelper(_editorWindow);
            _editorWindowHelper.EnsureHandle();


            if (PluginContext.PluginCommandStub.EditorGetRect(out wndRect))
            {
                pnlClient.Width  = wndRect.Width;
                pnlClient.Height = wndRect.Height;
                PluginContext.PluginCommandStub.EditorOpen(_editorWindowHelper.Handle);
            }
            else
            {
                PluginContext.PluginCommandStub.EditorOpen(_editorWindowHelper.Handle);

                if (PluginContext.PluginCommandStub.EditorGetRect(out wndRect))
                {
                    pnlClient.Width  = wndRect.Width;
                    pnlClient.Height = wndRect.Height;
                }
                else
                {
                    Logger.Warning(
                        $"Unable to open the editor for the plugin {PluginContext.PluginCommandStub.GetEffectName()} because it didn't give us a rectangle to work with.");
                    return(false);
                }
            }

            if (wndRect.Width == 0 || wndRect.Height == 0)
            {
                Logger.Warning(
                    $"Unable to open the editor for the plugin {PluginContext.PluginCommandStub.GetEffectName()} because it give us an empty rectangle to work with.");
                return(false);
            }

            _editorWindow.Show();


            if (hidden)
            {
                int value = 1; // TRUE to disable
                DwmSetWindowAttribute(_editorWindowHelper.Handle,
                                      DWMWA_TRANSITIONS_FORCEDISABLED,
                                      ref value,
                                      Marshal.SizeOf(value));
            }

            var success = PluginContext.PluginCommandStub.EditorOpen(_editorWindowHelper.Handle);

            if (hidden)
            {
                var handle = new HWND(_editorWindowHelper.Handle);
                NativeMethods.SetWindowPos(
                    handle,
                    HWND.BOTTOM,
                    0,
                    0,
                    0,
                    0,
                    SWP.NOMOVE | SWP.NOSIZE);
            }


            if (!success)
            {
                _editorWindow.Close();
                return(false);
            }

            if (PluginContext.PluginCommandStub.EditorGetRect(out Rectangle wndRect2))
            {
                if (wndRect2.Width != 0 && wndRect2.Height != 0)
                {
                    pnlClient.Width  = wndRect2.Width;
                    pnlClient.Height = wndRect2.Height;
                }
            }

            IsEditorOpen = true;
            return(true);
        }
Example #23
0
 internal static extern BOOL ClientToScreen(HWND hWnd, ref Point point);
 public HRESULT DisplayUI(HWND hwndParent, [NativeTypeName("LPCWSTR")] ushort *pszTitle, [NativeTypeName("LPCWSTR")] ushort *pszTypeOfUI, void *pvExtraData, [NativeTypeName("ULONG")] uint cbExtraData, IUnknown *punkObject)
 {
     return(((delegate * unmanaged <ISpObjectTokenInit *, HWND, ushort *, ushort *, void *, uint, IUnknown *, int>)(lpVtbl[23]))((ISpObjectTokenInit *)Unsafe.AsPointer(ref this), hwndParent, pszTitle, pszTypeOfUI, pvExtraData, cbExtraData, punkObject));
 }
Example #25
0
 unsafe public static extern HRESULT DwmGetWindowAttribute(HWND hwnd, DwmWindowAttribute dwAttribute, void* pvAttribute, DWORD cbAttribute);
Example #26
0
 // window procedure
 LONG WINAPI MainWndProc(
     HWND hWnd,
     UINT uMsg,
     WPARAM wParam,
     LPARAM lParam);
Example #27
0
 public static extern LONG ChangeDisplaySettingsEx([MarshalAs(UnmanagedType.LPTStr)] LPCTSTR lpszDeviceName,
     LPDEVMODE lpDevMode, HWND hwnd, ChangeDisplaySettingsEnum dwflags, LPVOID lParam);
Example #28
0
 private static extern int GetWindowText(HWND hWnd, StringBuilder lpString, int nMaxCount);
 public static HWND Cast(IntPtr h)
 {
     HWND hTemp = new HWND();
     hTemp.h = h;
     return hTemp;
 }
Example #30
0
 private static extern int GetWindowTextLength(HWND hWnd);
Example #31
0
 static extern LONG SetWindowLongInternal(HWND hWnd, GetWindowLongOffsets nIndex, LONG dwNewLong);
Example #32
0
 static extern LONG_PTR SetWindowLongPtrInternal(HWND hWnd, GetWindowLongOffsets nIndex,
     [MarshalAs(UnmanagedType.FunctionPtr)]WindowProcedure dwNewLong);
Example #33
0
 private static extern bool IsWindowVisible(HWND hWnd);
 private static extern HWND CreateDemoHelloWorldApp(HWND parent);
Example #35
0
 static extern LONG_PTR SetWindowLongPtrInternal(HWND hWnd, GetWindowLongOffsets nIndex, LONG_PTR dwNewLong);
Example #36
0
 private LRESULT WndProcWrapper(HWND hwnd, uint msg, WPARAM wParam, LPARAM lParam)
 {
     return(new LRESULT(this.WndProc(hwnd, msg, wParam, lParam)));
 }
Example #37
0
 static extern ULONG GetWindowLongInternal(HWND hWnd, GetWindowLongOffsets nIndex);
 public HRESULT CreateSessionForWindow(HWND window, [NativeTypeName("const IID &")] Guid *iid, void **value)
 {
     return(((delegate * unmanaged <IUserActivityInterop *, HWND, Guid *, void **, int>)(lpVtbl[6]))((IUserActivityInterop *)Unsafe.AsPointer(ref this), window, iid, value));
 }
Example #39
0
 internal static extern LRESULT SendMessage(HWND hWnd, WindowMessage Msg, WPARAM wParam, LPARAM lParam);
Example #40
0
 public static extern uint WNetDisconnectDialog(HWND hwnd, [NativeTypeName("DWORD")] uint dwType);
Example #41
0
 public extern static IntPtr DefWindowProc(HWND hWnd, WindowMessage msg, IntPtr wParam, IntPtr lParam);
Example #42
0
 public static extern uint WNetAddConnection3A(HWND hwndOwner, [NativeTypeName("LPNETRESOURCEA")] NETRESOURCEA *lpNetResource, [NativeTypeName("LPCSTR")] sbyte *lpPassword, [NativeTypeName("LPCSTR")] sbyte *lpUserName, [NativeTypeName("DWORD")] uint dwFlags);
Example #43
0
 internal static extern BOOL SetWindowText(HWND hWnd, [MarshalAs(UnmanagedType.LPTStr)] string lpString);
Example #44
0
 public static extern uint WNetAddConnection3W(HWND hwndOwner, [NativeTypeName("LPNETRESOURCEW")] NETRESOURCEW *lpNetResource, [NativeTypeName("LPCWSTR")] ushort *lpPassword, [NativeTypeName("LPCWSTR")] ushort *lpUserName, [NativeTypeName("DWORD")] uint dwFlags);
Example #45
0
 //internal static extern BOOL ScreenToClient(HWND hWnd, ref POINT point);
 internal static extern BOOL ScreenToClient(HWND hWnd, ref Point point);
Example #46
0
 public static extern uint WNetAddConnection4W(HWND hwndOwner, [NativeTypeName("LPNETRESOURCEW")] NETRESOURCEW *lpNetResource, [NativeTypeName("PVOID")] void *pAuthBuffer, [NativeTypeName("DWORD")] uint cbAuthBuffer, [NativeTypeName("DWORD")] uint dwFlags, [NativeTypeName("PBYTE")] byte *lpUseOptions, [NativeTypeName("DWORD")] uint cbUseOptions);
Example #47
0
 internal extern static BOOL GetClientRect(HWND windowHandle, out Win32Rectangle clientRectangle);
Example #48
0
 public static extern uint WNetRestoreSingleConnectionW(HWND hwndParent, [NativeTypeName("LPCWSTR")] ushort *lpDevice, BOOL fUseUI);
Example #49
0
 internal static extern BOOL GetWindowInfo(HWND hwnd, ref WindowInfo wi);
Example #50
0
 public static extern uint WNetUseConnectionW(HWND hwndOwner, [NativeTypeName("LPNETRESOURCEW")] NETRESOURCEW *lpNetResource, [NativeTypeName("LPCWSTR")] ushort *lpPassword, [NativeTypeName("LPCWSTR")] ushort *lpUserId, [NativeTypeName("DWORD")] uint dwFlags, [NativeTypeName("LPWSTR")] ushort *lpAccessName, [NativeTypeName("LPDWORD")] uint *lpBufferSize, [NativeTypeName("LPDWORD")] uint *lpResult);
Example #51
0
 public static extern BOOL SetForegroundWindow(HWND hWnd);
Example #52
0
 public static extern uint WNetUseConnection4A(HWND hwndOwner, [NativeTypeName("LPNETRESOURCEA")] NETRESOURCEA *lpNetResource, [NativeTypeName("PVOID")] void *pAuthBuffer, [NativeTypeName("DWORD")] uint cbAuthBuffer, [NativeTypeName("DWORD")] uint dwFlags, [NativeTypeName("PBYTE")] byte *lpUseOptions, [NativeTypeName("DWORD")] uint cbUseOptions, [NativeTypeName("LPSTR")] sbyte *lpAccessName, [NativeTypeName("LPDWORD")] uint *lpBufferSize, [NativeTypeName("LPDWORD")] uint *lpResult);
Example #53
0
 public static extern BOOL SetParent(HWND child, HWND newParent);
Example #54
0
 public HRESULT Synchronize([NativeTypeName("LPCWSTR *")] ushort **ppszItemIDs, [NativeTypeName("ULONG")] uint cItems, HWND hwndOwner, ISyncMgrSessionCreator *pSessionCreator, IUnknown *punk)
 {
     return(((delegate * unmanaged <ISyncMgrHandler *, ushort **, uint, HWND, ISyncMgrSessionCreator *, IUnknown *, int>)(lpVtbl[10]))((ISyncMgrHandler *)Unsafe.AsPointer(ref this), ppszItemIDs, cItems, hwndOwner, pSessionCreator, punk));
 }
Example #55
0
 public static extern HMONITOR MonitorFromWindow(HWND hwnd, MonitorFrom dwFlags);
Example #56
0
 public HRESULT RequestTokenWithWebAccountForWindowAsync(HWND appWindow, IInspectable *request, IInspectable *webAccount, [NativeTypeName("const IID &")] Guid *riid, void **asyncInfo)
 {
     return(((delegate * unmanaged <IWebAuthenticationCoreManagerInterop *, HWND, IInspectable *, IInspectable *, Guid *, void **, int>)(lpVtbl[7]))((IWebAuthenticationCoreManagerInterop *)Unsafe.AsPointer(ref this), appWindow, request, webAccount, riid, asyncInfo));
 }
Example #57
0
 public static GraphicsPlus FromHWND(HWND hwnd,
                           bool icm)
 {
     return new GraphicsPlus(hwnd, icm);
 }
Example #58
0
 public static extern Int32 PostMessage(HWND hWnd, DWORD Msg, DWORD wParam, DWORD lParam);
Example #59
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="hwnd"></param>
 /// <param name="pos"></param>
 /// <param name="x"></param>
 /// <param name="y"></param>
 /// <param name="cx"></param>
 /// <param name="cy"></param>
 /// <param name="uFlags"></param>
 /// <returns></returns>
 public static bool SetWindowPos(IntPtr hwnd, HWND pos, int x, int y, int cx, int cy, SWP uFlags)
 {
     return NativeMethods.SetWindowPos(hwnd, pos, x, y, cx, cy, uFlags);
 }
Example #60
0
 public static extern bool SetForegroundWindow(HWND hWnd);