@msdn=http://search.microsoft.com/search/results.aspx?qu=$$$ @pinvoke=http://pinvoke.net/$$$.htm Summary: The function retrieves the handle to the top-level window whose class name and window name match the specified strings. This function does not search child windows. !!!!C# Signature: [DllImport("coredll.dll", EntryPoint="FindWindowW", SetLastError=true)] private static extern IntPtr FindWindowCE(string lpClassName, string lpWindowName); !!!!VB Signature: Public Declare Function FindWindow Lib "Coredll" Alias "FindWindowW" (ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr !!!!User-Defined Types: !!!!C# Signature: public const int SWP_ASYNCWINDOWPOS = 0x4000; public const int SWP_DEFERERASE = 0x2000; public const int SWP_DRAWFRAME = 0x0020; public const int SWP_FRAMECHANGED = 0x0020; public const int SWP_HIDEWINDOW = 0x0080; public const int SWP_NOACTIVATE = 0x0010; public const int SWP_NOCOPYBITS = 0x0100; public const int SWP_NOMOVE = 0x0002; public const int SWP_NOOWNERZORDER = 0x0200; public const int SWP_NOREDRAW = 0x0008; public const int SWP_NOREPOSITION = 0x0200; public const int SWP_NOSENDCHANGING = 0x0400; public const int SWP_NOSIZE = 0x0001; public const int SWP_NOZORDER = 0x0004; public const int SWP_SHOWWINDOW = 0x0040; public const int HWND_TOP = 0; public const int HWND_BOTTOM = 1; public const int HWND_TOPMOST = -1; public const int HWND_NOTOPMOST = -2; !!!!VB.Net Signature: Public Const SWP_NOSIZE As Integer = &H1 Public Const SWP_NOMOVE As Integer = &H2 Public Const SWP_NOZORDER As Integer = &H4 Public Const SWP_NOREDRAW As Integer = &H8 Public Const SWP_NOACTIVATE As Integer = &H10 Public Const SWP_DRAWFRAME As Integer = &H20 Public Const SWP_FRAMECHANGED As Integer = &H20 Public Const SWP_SHOWWINDOW As Integer = &H40 Public Const SWP_HIDEWINDOW As Integer = &H80 Public Const SWP_NOCOPYBITS As Integer = &H100 Public Const SWP_NOOWNERZORDER As Integer = &H200 Public Const SWP_NOREPOSITION As Integer = &H200 Public Const SWP_NOSENDCHANGING As Integer = &H400 Public Const SWP_DEFERERASE As Integer = &H2000 Public Const SWP_ASYNCWINDOWPOS As Integer = &H4000 !!!!Alternative Managed API: Do you know one? Please contribute it! !!!!Notes: Taken from openNetCF in OpenNETCF.Win32.Core SetWindowPos declaration is also required. !!!!C# Signature: [DllImport("user32.dll", SetLastError=true)] [return: MarshalAs(UnmanagedType.Bool)] private static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, uint uFlags); Check the SWP definition on Enums. !!!!VB.Net Signature: <DllImport("user32.dll", SetLastError:=True)> _ Private Shared Function SetWindowPos(ByVal hWnd As IntPtr, _ ByVal hWndInsertAfter As IntPtr, _ ByVal X As Integer, _ ByVal Y As Integer, _ ByVal cx As Integer, _ ByVal cy As Integer, _ ByVal uFlags As UInteger) As Boolean End Function !!!!Tips & Tricks: Can be used to hide the start bar and start menu. !!!!Sample Code: !!!!Sample Code: public void HideStartBar() { IntPtr handle; try { // Find the handle to the Start Bar handle = FindWindowCE("HHTaskBar", null); // If the handle is found then hide the start bar if (handle != IntPtr.Zero) { // Hide the start bar SetWindowPos(handle, 0, 0, 0, 0, 0, SWP_HIDEWINDOW); } } catch { MessageBox.Show("Could not hide Start Bar."); } } public void ShowStartBar() { IntPtr handle; try { // Find the handle to the Start Bar handle = FindWindowCE("HHTaskBar", null); // If the handle is found then show the start bar if (handle != IntPtr.Zero) { // Show the start bar SetWindowPos(handle, 0, 0, 0, 240, 26, SWP_SHOWWINDOW); } } catch { MessageBox.Show("Could not show Start Bar."); } } Documentation: FindWindowW@msdn on MSDN
Edit coredll.FindWindowW
You do not have permission to change this page. If you feel this is in error, please send feedback with the contact link on the main page.