Constants
.
public class GetWindowConstants {
.
public class GetWindowConstantsObsolete {
setupapi
.
if (0 == GetWindowsDirectory(winDir, winDir.Capacity)) return (false);
Structures
.
/// The length of the structure, in bytes. Before calling the GetWindowPlacement or SetWindowPlacement functions, set this member to sizeof(WINDOWPLACEMENT).
.
/// GetWindowPlacement and SetWindowPlacement fail if this member is not set correctly.
.
Use with GetWindowPlacement and SetWindowPlacement
The GetWindowPlacement API
2/11/2021 7:16:17 PM - -73.47.171.17
The SetWindowPlacement API
2/11/2021 7:24:33 PM - -73.47.171.17
Interfaces
.
int GetWindow(out IntPtr phwnd);
.
Public Overridable Sub GetWindow(ByRef phwnd As System.IntPtr) Implements IDeskBand.GetWindow, IDockingWindow.GetWindow, IOleWindow.GetWindow
.
Sub GetWindow(ByRef phwnd As System.IntPtr)
.
Sub GetWindow(ByRef phwnd As System.IntPtr)
.
Sub GetWindow(ByRef phwnd As System.IntPtr)
.
int GetWindow(out IntPtr phwnd);
.
Public Overridable Sub GetWindow(ByRef phwnd As System.IntPtr) Implements IDeskBand.GetWindow, IDockingWindow.GetWindow, IOleWindow.GetWindow
.
Sub GetWindow(ByRef phwnd As System.IntPtr)
.
Sub GetWindow(ByRef phwnd As System.IntPtr)
.
Sub GetWindow(ByRef phwnd As System.IntPtr)
.
void GetWindow (out IntPtr phwnd) ;
.
Sub GetWindow(<System.Runtime.InteropServices.Out()> ByRef phwnd As IntPtr)
.
IMPORTANT
The phwnd parameter for the VB Definition of
GetWindow MUST be
ByRef or else a 'protected memory' error will occur. - Andrew Powell 04.27.08
The GetWindow API
7/4/2018 8:52:22 AM - -73.246.221.57
ByRef is a VB keyword that specifies a variable to be passed as a parameter BY REFERENCE. In other words, the pointer to the variable is passed and any change to its value made within the function or sub will change its value outside the function/sub.
4/25/2007 3:19:29 AM - anonymous
.
void GetWindow(out IntPtr phwnd);
.
void GetWindow( out IntPtr windowHandle);
.
Sub GetWindow(<Out> ByRef windowHandle As IntPtr)
psapi
.
GetWindowThreadProcessId(hWnd, out pid);
user32
.
var idAttach = GetWindowThreadProcessId(hFore, out id);
.
static extern bool GetWindowRect(System.IntPtr hWnd, out RECT lpRect);
.
GetWindowRect(hWnd, out to);
.
bool GetWindowRect(int hWnd, RECT^ lpRect);
.
GetWindowRect(hWnd, to);
.
EnumedWindow callBackPtr = GetWindowHandle;
.
private static bool GetWindowHandle(IntPtr windowHandle, ArrayList windowHandles)
.
[DllImport("user32.dll", EntryPoint = "GetWindowText",
.
public static extern int GetWindowText(IntPtr hWnd, StringBuilder lpWindowText, int nMaxCount);
.
int nLength = user32.GetWindowText(hWnd, strbTitle, strbTitle.Capacity + 1);
.
public static ArrayList GetWindows()
.
EnumedWindow callBackPtr = GetWindowHandle;
.
private static bool GetWindowHandle(IntPtr windowHandle, ArrayList windowHandles)
.
GetWindowText(hWnd, sb, sb.Capacity);
.
public static extern int GetWindowText(IntPtr hWnd, StringBuilder lpString, int nMaxCount);
.
Can be used to find the active window Hwnd for GetWindowText
Copies the text of the specified window's title bar (if it has one) into a buffer. If the specified window is a control, the text of the control is copied. However, GetWindowText cannot retrieve the text of a control in another application, If the target window is owned by the current process, GetWindowText causes a WM_GETTEXT message to be sent to the specified window or control.
12/10/2020 12:10:14 PM - -71.239.92.169
.
Private Declare Auto Function GetWindowDC Lib "user32.dll" (ByVal windowHandle As IntPtr) As IntPtr
.
Dim srcDeviceContext As IntPtr = GetWindowDC(windowHandle)
.
//Optional Win32.GetWindowThreadProcessId(GetForegroundWindow(),out ProcessID)
.
Summary
There is no GetNextWindow function. It is actually a macro for the GetWindow function. Call GetWindow instead.
11/30/2009 9:55:16 AM - -98.199.231.72
The GetWindow API
7/4/2018 8:52:22 AM - -73.246.221.57
The GetWindow API
7/4/2018 8:52:22 AM - -73.246.221.57
.
Summary
The GetWindow API
7/4/2018 8:52:22 AM - -73.246.221.57
.
/// <remarks>The EnumChildWindows function is more reliable than calling GetWindow in a loop. An application that
.
/// calls GetWindow to perform this task risks being caught in an infinite loop or referencing a handle to a window
.
private static extern IntPtr GetWindow(IntPtr hWnd, GetWindowType uCmd);
.
private enum GetWindowType : uint
.
Declare Auto Function GetWindow Lib "user32.dll" ( _
.
Private Shared Function GetWindow(ByVal hWnd As IntPtr, ByVal uCmd As UInt32) As IntPtr
.
Private Enum GetWindowType As UInteger
.
Dim Owner As IntPtr = GetWindow(hWnd, GW_OWNER)
.
IntPtr dlgHandle = GetWindow(myProcess.MainWindowHandle, GW_ENABLEDPOPUP);
.
Documentation
[GetWindow] on MSDN
.
Summary
The
GetWindowDC function retrieves the device context (DC) for the entire window, including title bar, menus, and scroll bars. A window device context permits painting anywhere in a window, because the origin of the device context is the upper-left corner of the window instead of the client area.
GetWindowDC assigns default attributes to the window device context each time it retrieves the device context. Previous attributes are lost.
.
static extern IntPtr GetWindowDC(IntPtr hWnd);
.
Public Shared Function GetWindowDC(ByVal hWnd As IntPtr) As IntPtr
.
Declare Function GetWindowDC Lib "user32" (ByVal hWnd As Long) As Long
.
GetWindowDC is intended for special painting effects within a window's nonclient area. Painting in nonclient areas of any window is not recommended. The GetSystemMetrics function can be used to retrieve the dimensions of various parts of the nonclient area, such as the title bar, menu, and scroll bars. The GetDC function can be used to retrieve a device context for the entire screen.
Retrieves various system metrics of display elements and system configuration settings.
4/21/2009 7:37:08 AM - -24.226.54.84
.
Declare Function GetWindowDC Lib "user32" (ByVal hwnd As IntPtr) As IntPtr
.
Dim MyGrphHdc As IntPtr = GetWindowDC(Me.Handle)
.
Documentation
[GetWindowDC] on MSDN
.
Summary
The GetWindowInfo API
5/2/2014 7:11:46 AM - -108.219.86.91
.
private static extern bool GetWindowInfo(IntPtr hwnd, ref WINDOWINFO pwi);
.
Public Declare Auto Function GetWindowInfo Lib "user32" _
.
Public Shared Function GetWindowInfo(ByVal hwnd As IntPtr, ByRef pwi As WINDOWINFO) As Boolean
.
You must assign the cbSize parameter prior to calling GetWindowInfo(). For example:
.
GetWindowInfo(Handle, ref info);
.
GetWindowInfo(Handle, info)
.
Documentation
[GetWindowInfo] on MSDN
.
Summary
The GetWindowLongPtr API
2/16/2012 2:32:18 AM - -202.74.138.1
.
On this platform this function is in fact a macro that calls GetWindowLong , so the EntryPoint property has to be set to the real function:
.
[DllImport("user32.dll", EntryPoint="GetWindowLong")]
.
static extern IntPtr GetWindowLongPtr(IntPtr hWnd, int nIndex);
.
<DllImport("user32.dll", EntryPoint:="GetWindowLong")> _
.
Private Shared Function GetWindowLongPtr(ByVal hWnd As HandleRef, <MarshalAs(UnmanagedType.I4)>nIndex As WindowLongFlags) As IntPtr
.
Public Declare Function GetWindowLong Lib "user32.dll" Alias "GetWindowLongA" _
.
[DllImport("user32.dll", EntryPoint="GetWindowLongPtr")]
.
private static extern IntPtr GetWindowLongPtr(IntPtr hWnd, int nIndex);
.
<DllImport("user32.dll", EntryPoint:="GetWindowLongPtr")> _
.
Private Shared Function GetWindowLongPtr(ByVal hWnd As HandleRef, <MarshalAs(UnmanagedType.I4)>nIndex As WindowLongFlags) As IntPtr
.
Public Declare Function GetWindowLong Lib "user32.dll" Alias "GetWindowLongA" _
.
[DllImport("user32.dll", EntryPoint="GetWindowLong")]
.
private static extern IntPtr GetWindowLongPtr32(IntPtr hWnd, int nIndex);
.
[DllImport("user32.dll", EntryPoint="GetWindowLongPtr")]
.
private static extern IntPtr GetWindowLongPtr64(IntPtr hWnd, int nIndex);
.
// GetWindowLongPtr directly
.
public static IntPtr GetWindowLongPtr(IntPtr hWnd, int nIndex)
.
return GetWindowLongPtr64(hWnd, nIndex);
.
return GetWindowLongPtr32(hWnd, nIndex);
.
<DllImport("user32.dll", EntryPoint:="GetWindowLong")> _
.
Private Shared Function GetWindowLongPtr32(ByVal hWnd As HandleRef, ByVal nIndex As Integer) As IntPtr
.
<DllImport("user32.dll", EntryPoint:="GetWindowLongPtr")> _
.
Private Shared Function GetWindowLongPtr64(ByVal hWnd As HandleRef, ByVal nIndex As Integer) As IntPtr
.
' This static method is required because Win32 does not support GetWindowLongPtr dirctly
.
Public Shared Function GetWindowLongPtr(ByVal hWnd As HandleRef, ByVal nIndex As Integer) As IntPtr
.
Return GetWindowLongPtr64(hWnd, nIndex)
.
Return GetWindowLongPtr32(hWnd, nIndex)
.
result = GetWindowLongPtr(winhandle, GWL.GWL_ID);
.
Documentation
[GetWindowLongPtr] on MSDN
.
Summary
The GetWindowLongPtr API
2/16/2012 2:32:18 AM - -202.74.138.1
.
On this platform this function is in fact a macro that calls GetWindowLong , so the EntryPoint property has to be set to the real function:
.
[DllImport("user32.dll", EntryPoint="GetWindowLong")]
.
static extern IntPtr GetWindowLongPtr(IntPtr hWnd, int nIndex);
.
<DllImport("user32.dll", EntryPoint:="GetWindowLong")> _
.
Private Shared Function GetWindowLongPtr(ByVal hWnd As HandleRef, <MarshalAs(UnmanagedType.I4)>nIndex As GWL) As IntPtr
.
Public Declare Function GetWindowLong Lib "user32.dll" Alias "GetWindowLongA" _
.
[DllImport("user32.dll", EntryPoint="GetWindowLongPtr")]
.
private static extern IntPtr GetWindowLongPtr(IntPtr hWnd, int nIndex);
.
<DllImport("user32.dll", EntryPoint:="GetWindowLongPtr")> _
.
Private Shared Function GetWindowLongPtr(ByVal hWnd As HandleRef, <MarshalAs(UnmanagedType.I4)>nIndex As GWL) As IntPtr
.
Public Declare Function GetWindowLong Lib "user32.dll" Alias "GetWindowLongA" _
.
[DllImport("user32.dll", EntryPoint="GetWindowLong")]
.
private static extern IntPtr GetWindowLongPtr32(IntPtr hWnd, int nIndex);
.
[DllImport("user32.dll", EntryPoint="GetWindowLongPtr")]
.
private static extern IntPtr GetWindowLongPtr64(IntPtr hWnd, int nIndex);
.
// GetWindowLongPtr directly
.
public static IntPtr GetWindowLongPtr(IntPtr hWnd, int nIndex)
.
return GetWindowLongPtr64(hWnd, nIndex);
.
return GetWindowLongPtr32(hWnd, nIndex);
.
<DllImport("user32.dll", EntryPoint:="GetWindowLong")> _
.
Private Shared Function GetWindowLongPtr32(ByVal hWnd As HandleRef, ByVal nIndex As Integer) As IntPtr
.
<DllImport("user32.dll", EntryPoint:="GetWindowLongPtr")> _
.
Private Shared Function GetWindowLongPtr64(ByVal hWnd As HandleRef, ByVal nIndex As Integer) As IntPtr
.
' This static method is required because Win32 does not support GetWindowLongPtr dirctly
.
Public Shared Function GetWindowLongPtr(ByVal hWnd As HandleRef, ByVal nIndex As Integer) As IntPtr
.
Return GetWindowLongPtr64(hWnd, nIndex)
.
Return GetWindowLongPtr32(hWnd, nIndex)
.
result = GetWindowLongPtr(winhandle, GWL.GWL_ID);
.
Documentation
[GetWindowLongPtr] on MSDN
.
Summary
The GetWindowModuleFileName API
5/23/2014 6:30:50 AM - davidsonblake86@gmail.com-72.202.204.193
.
static extern uint GetWindowModuleFileName(IntPtr hwnd,
.
Private Shared Function GetWindowModuleFileName(hwnd As IntPtr, _
.
Workaround
Use
GetWindowThreadProcessId to get the process ID, then Process.GetProcessById to retrieve the process information. The resultant System.Diagnostics.Process Object's
MainModule Property has the Filename Property, which is the Information you are probably searching.
The GetWindowThreadProcessId API
8/29/2011 5:20:18 AM - -71.187.199.49
.
GetWindowModuleFileName(hwnd, fileName, 2000);
.
Documentation
[GetWindowModuleFileName] on MSDN
.
Summary
The GetWindowPlacement API
2/11/2021 7:16:17 PM - -73.47.171.17
.
public static extern bool GetWindowPlacement(IntPtr hWnd, ref WINDOWPLACEMENT lpwndpl);
.
Private Shared Function GetWindowPlacement(ByVal hWnd As IntPtr, ByRef lpwndpl As WINDOWPLACEMENT) As Boolean
.
Public Declare Function GetWindowPlacement Lib "user32" _
.
GetWindowPlacement(this.Handle, ref placement);
.
Private Declare Function GetWindowPlacement Lib "user32" (ByVal hwnd As IntPtr, ByRef lpwndpl As WINDOWPLACEMENT) As Integer
.
intRet = GetWindowPlacement(Me.Handle.ToInt32, wpTemp)
.
Documentation
[GetWindowPlacement] on MSDN
.
Summary
GetWindowPos is an old Win32 method, you should use GetWindowRect or GetWindowPlacement
2/11/2011 1:33:39 PM - -212.152.161.92
The GetWindowRect API
6/15/2020 2:32:39 PM - -24.158.188.135
The GetWindowPlacement API
2/11/2021 7:16:17 PM - -73.47.171.17
.
static extern TODO GetWindowPos(TODO);
.
Declare Function GetWindowPos Lib "user32.dll" (TODO) As TODO
.
Use GetWindowRect Win32 method for position information.
The GetWindowRect API
6/15/2020 2:32:39 PM - -24.158.188.135
.
Use GetWindowPlacement Win32 method for a more detailed set of info such as Z-Order.
The GetWindowPlacement API
2/11/2021 7:16:17 PM - -73.47.171.17
.
Documentation
[GetWindowPos] on MSDN
.
Summary
The GetWindowRect API
6/15/2020 2:32:39 PM - -24.158.188.135
.
static extern bool GetWindowRect(IntPtr hwnd, out RECT lpRect);
.
Private Shared Function GetWindowRect(ByVal hWnd As HandleRef, ByRef lpRect As RECT) As Boolean
.
Please note that this does NOT work properly with Windows Vista Aero (this includes Windows 10), and reports faulty values. This is largely due to Aero incorporating additional invisible borders which are used to "resize" the window using the cursor. In this instance, the developer should look into using DwmGetWindowAttribute (dwmapi.dll) with DWMWA_EXTENDED_FRAME_BOUNDS.
TODO - a short description
4/11/2021 7:41:24 AM - -46.89.110.227
.
static extern bool GetWindowRect(HandleRef hWnd, out RECT lpRect);
.
if(!GetWindowRect(new HandleRef(this, this.Handle), out rct ))
.
Documentation
[GetWindowRect] on MSDN
.
Summary
The GetWindowRgn API
11/16/2013 8:41:54 PM - -88.159.15.38
.
static extern int GetWindowRgn(IntPtr hWnd, IntPtr hRgn);
.
Private Shared Function GetWindowRgn(ByVal hWnd As IntPtr, ByVal hRgn As IntPtr) As Integer
.
Documentation
[GetWindowRgn] on MSDN
.
Summary
The GetWindowTextLength API
9/20/2022 7:33:29 PM - -116.2.128.56
.
/// GetWindowTextLength cannot retrieve the length of the text of an edit control in another application.
.
/// If the target window is owned by the current process, <see cref="GetWindowTextLength" /> causes a
.
/// <see cref="GetWindowTextLength" /> function may return a value that is larger than the actual length of the
.
/// occur when an application uses the ANSI version of <see cref="GetWindowTextLength" /> with a window whose window
.
/// procedure is Unicode, or the Unicode version of <see cref="GetWindowTextLength" /> with a window whose window
.
/// GetWindowText function.
.
static extern int GetWindowTextLength(IntPtr hWnd);
.
Private Shared Function GetWindowTextLength(ByVal hwnd As IntPtr) As Integer
.
class method GetWindowTextLength(hWnd: IntPtr): Int32; external;
.
Public Declare Function GetWindowTextLength Lib "user32.dll" Alias "GetWindowTextLengthA" _
.
Often used with GetWindowText
Copies the text of the specified window's title bar (if it has one) into a buffer. If the specified window is a control, the text of the control is copied. However, GetWindowText cannot retrieve the text of a control in another application, If the target window is owned by the current process, GetWindowText causes a WM_GETTEXT message to be sent to the specified window or control.
12/10/2020 12:10:14 PM - -71.239.92.169
.
(See GetWindowText .)
Copies the text of the specified window's title bar (if it has one) into a buffer. If the specified window is a control, the text of the control is copied. However, GetWindowText cannot retrieve the text of a control in another application, If the target window is owned by the current process, GetWindowText causes a WM_GETTEXT message to be sent to the specified window or control.
12/10/2020 12:10:14 PM - -71.239.92.169
.
Documentation
[GetWindowTextLength] on MSDN
.
Summary
Copies the text of the specified window's title bar (if it has one) into a buffer. If the specified window is a control, the text of the control is copied. However,
GetWindowText cannot retrieve the text of a control in another application, If the target window is owned by the current process,
GetWindowText causes a WM_GETTEXT message to be sent to the specified window or control.
Copies the text of the specified window's title bar (if it has one) into a buffer. If the specified window is a control, the text of the control is copied. However, GetWindowText cannot retrieve the text of a control in another application, If the target window is owned by the current process, GetWindowText causes a WM_GETTEXT message to be sent to the specified window or control.
12/10/2020 12:10:14 PM - -71.239.92.169
Copies the text of the specified window's title bar (if it has one) into a buffer. If the specified window is a control, the text of the control is copied. However, GetWindowText cannot retrieve the text of a control in another application, If the target window is owned by the current process, GetWindowText causes a WM_GETTEXT message to be sent to the specified window or control.
12/10/2020 12:10:14 PM - -71.239.92.169
.
Remarks
If the target window is owned by another process and has a caption,
GetWindowText retrieves the window caption text. If the window does not have a caption, the return value is a null string. This behavior is by design. It allows applications to call
GetWindowText without becoming unresponsive if the process that owns the target window is not responding. However, if the target window is not responding and it belongs to the calling application,
GetWindowText will cause the calling application to become unresponsive.
Copies the text of the specified window's title bar (if it has one) into a buffer. If the specified window is a control, the text of the control is copied. However, GetWindowText cannot retrieve the text of a control in another application, If the target window is owned by the current process, GetWindowText causes a WM_GETTEXT message to be sent to the specified window or control.
12/10/2020 12:10:14 PM - -71.239.92.169
Copies the text of the specified window's title bar (if it has one) into a buffer. If the specified window is a control, the text of the control is copied. However, GetWindowText cannot retrieve the text of a control in another application, If the target window is owned by the current process, GetWindowText causes a WM_GETTEXT message to be sent to the specified window or control.
12/10/2020 12:10:14 PM - -71.239.92.169
Copies the text of the specified window's title bar (if it has one) into a buffer. If the specified window is a control, the text of the control is copied. However, GetWindowText cannot retrieve the text of a control in another application, If the target window is owned by the current process, GetWindowText causes a WM_GETTEXT message to be sent to the specified window or control.
12/10/2020 12:10:14 PM - -71.239.92.169
.
To retrieve the text of a control in another process, send a WM_GETTEXT message directly instead of calling GetWindowText .
Copies the text of the specified window's title bar (if it has one) into a buffer. If the specified window is a control, the text of the control is copied. However, GetWindowText cannot retrieve the text of a control in another application, If the target window is owned by the current process, GetWindowText causes a WM_GETTEXT message to be sent to the specified window or control.
12/10/2020 12:10:14 PM - -71.239.92.169
.
/// control, the text of the control is copied. However, GetWindowText cannot retrieve the text of a control in another
.
/// If the target window is owned by the current process, GetWindowText causes a WM_GETTEXT message to be sent to the
.
/// specified window or control. If the target window is owned by another process and has a caption, GetWindowText
.
/// behavior is by design. It allows applications to call GetWindowText without becoming unresponsive if the process
.
/// the calling application, GetWindowText will cause the calling application to become unresponsive. To retrieve the
.
/// text of a control in another process, send a WM_GETTEXT message directly instead of calling GetWindowText.<br />For
.
static extern int GetWindowText(IntPtr hWnd, StringBuilder lpString, int nMaxCount);
.
<DllImport("user32.dll", EntryPoint:="GetWindowText")>
.
Public Function GetWindowText(ByVal hwnd As Integer, ByVal lpString As System.Text.StringBuilder, ByVal cch As Integer) As Integer
.
extern IntPtr GetWindowText(IntPtr hwnd, StringBuilder lpString, int maxCount)
.
class method GetWindowText(hWnd: IntPtr; lpString: StringBuilder; nMaxCount: Int32): Int32; external;
.
Public Declare Function GetWindowText Lib "user32.dll" Alias "GetWindowTextA" _
.
See also GetWindowTextLength
The GetWindowTextLength API
9/20/2022 7:33:29 PM - -116.2.128.56
.
int length = GetWindowTextLength(hWnd);
.
GetWindowText(hWnd, sb, sb.Capacity);
.
But, if you need to get text from a control in another process, GetWindowText() won't work. Use WM_GETTEXT instead.
.
public static string GetWindowTextRaw(IntPtr hwnd)
.
length = GetWindowTextLength(hWnd)
.
GetWindowText(hWnd, sb, sb.Capacity + 1)
.
Documentation
[GetWindowText] on MSDN
.
Summary
The GetWindowTextLength API
9/20/2022 7:33:29 PM - -116.2.128.56
.
static extern int GetWindowTextLength(IntPtr hWnd);
.
Private Shared Function GetWindowTextLength(ByVal hwnd As IntPtr) As Integer
.
Public Declare Function GetWindowTextLength Lib "user32.dll" Alias "GetWindowTextLengthA" _
.
Often used with GetWindowText
Copies the text of the specified window's title bar (if it has one) into a buffer. If the specified window is a control, the text of the control is copied. However, GetWindowText cannot retrieve the text of a control in another application, If the target window is owned by the current process, GetWindowText causes a WM_GETTEXT message to be sent to the specified window or control.
12/10/2020 12:10:14 PM - -71.239.92.169
.
(See GetWindowText .)
Copies the text of the specified window's title bar (if it has one) into a buffer. If the specified window is a control, the text of the control is copied. However, GetWindowText cannot retrieve the text of a control in another application, If the target window is owned by the current process, GetWindowText causes a WM_GETTEXT message to be sent to the specified window or control.
12/10/2020 12:10:14 PM - -71.239.92.169
.
Documentation
[GetWindowTextLength] on MSDN
.
Summary
The GetWindowThreadProcessId API
8/29/2011 5:20:18 AM - -71.187.199.49
.
static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId);
.
static extern uint GetWindowThreadProcessId(IntPtr hWnd, IntPtr ProcessId);
.
Private Shared Function GetWindowThreadProcessId(ByVal hwnd As IntPtr, _
.
''' <param name="lpdwProcessId">A pointer to a variable that receives the process identifier. If this parameter is not NULL, GetWindowThreadProcessId copies the identifier of the process to the variable; otherwise, it does not. </param>
.
Private Declare Auto Function GetWindowThreadProcessId Lib "user32.dll" (ByVal hwnd As IntPtr, _
.
GetWindowThreadProcessId(lngAccessHwnd, lngPid)
.
Public Declare Auto Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As IntPtr, ByRef lpdwProcessId As IntPtr) As IntPtr
.
GetWindowThreadProcessId(hOwner, iProcessID)
.
IntPtr pID = GetWindowThreadProcessId(GetForegroundWindow(), IntPtr.Zero);
.
GetWindowThreadProcessId returns the id of the thread that created the target window. To get the process id of a window, use the first c# signature above, and:
The GetWindowThreadProcessId API
8/29/2011 5:20:18 AM - -71.187.199.49
.
int threadID = GetWindowThreadProcessId(hWnd, out processID);
.
Documentation
[GetWindowThreadProcessId] on MSD
.
GetWindowRect(hWnd, out rct);
.
internal static extern bool GetWindowRect(IntPtr hWnd, ref RECT rect);
.
GetWindowRect(id, ref Rect);
.
Summary
The RealGetWindowClass API
8/3/2010 12:48:09 PM - Patrick Porter-205.145.107.100
.
static extern uint RealGetWindowClass(IntPtr hwnd, [Out] StringBuilder pszType,
.
Private Shared Function RealGetWindowClass(ByVal hWnd As IntPtr, _
.
public static string RealGetWindowClassM(IntPtr hWnd)
.
RealGetWindowClass(hWnd, pszType, (UInt32)pszType.Capacity);
.
Documentation
[RealGetWindowClass] on MSDN
.
The application must call the ReleaseDC function for each call to the GetWindowDC function and for each call to the GetDC function that retrieves a common DC.
.
private static extern int GetWindowThreadProcessId(
.
StatusBar.GetWindowThreadProcessId(this._handle, out pid);
.
GetWindowRect(hWnd, out rct);
.
GetWindowRect
The GetWindowRect API
6/15/2020 2:32:39 PM - -24.158.188.135
.
GetWindowRect
The GetWindowRect API
6/15/2020 2:32:39 PM - -24.158.188.135
.
Function GetWindowTitle(hWnd As IntPtr ) As String
An IntPtr is a pointer to a memory location (unmanaged) that adapts to the platform it is running on (64-bit, etc.) UNLIKE a standard int/Integer. You should always use this type for unmanaged calls that require it, even though an int will appear to work on your development machine.
1/13/2008 4:00:13 AM - Damon Carr-72.43.165.29
.
    uint foreThread = GetWindowThreadProcessId(GetForegroundWindow(), IntPtr .Zero);
An IntPtr is a pointer to a memory location (unmanaged) that adapts to the platform it is running on (64-bit, etc.) UNLIKE a standard int/Integer. You should always use this type for unmanaged calls that require it, even though an int will appear to work on your development machine.
1/13/2008 4:00:13 AM - Damon Carr-72.43.165.29
.
SetWindowLong(Handle, GWL_EXSTYLE, GetWindowLong(Handle, GWL_EXSTYLE) ^ WS_EX_LAYERED);
.
// to the correct function (GetWindowLong in 32-bit mode and GetWindowLongPtr in 64-bit mode)
.
GetWindowPlacement(this.Handle, ref placement);
.
var windowRec = GetWindowRect(windowHandler);
.
GetWindowThreadProcessId((IntPtr)handle, out ProcessID);
.
static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId);
.
Private Shared Function GetWindowText(hWnd As IntPtr, lpString As StringBuilder, nMaxCount As Integer) As Integer
.
Private Shared Function GetWindowsTitle(hwnd As IntPtr ) As String
An IntPtr is a pointer to a memory location (unmanaged) that adapts to the platform it is running on (64-bit, etc.) UNLIKE a standard int/Integer. You should always use this type for unmanaged calls that require it, even though an int will appear to work on your development machine.
1/13/2008 4:00:13 AM - Damon Carr-72.43.165.29
.
GetWindowText(hwnd, sb, sb.Capacity)
.
Dim cln As String = GetWindowsTitle(hwnd)
gdi32
.
dc2=GetWindowDC(c.Handle);
.
Use GetWindowDC(IntPtr hWnd); for taking the dc for the whole window since this function only gets the client area of the window.
An IntPtr is a pointer to a memory location (unmanaged) that adapts to the platform it is running on (64-bit, etc.) UNLIKE a standard int/Integer. You should always use this type for unmanaged calls that require it, even though an int will appear to work on your development machine.
1/13/2008 4:00:13 AM - Damon Carr-72.43.165.29
.
Summary
The GetWindowExtEx API
10/12/2012 8:54:03 PM - anonymous
.
static extern bool GetWindowExtEx(IntPtr hdc, out SIZE lpSize);
.
Documentation
[GetWindowExtEx] on MSDN
.
Summary
The GetWindowOrgEx API
3/16/2007 7:45:36 AM - anonymous
.
static extern bool GetWindowOrgEx(IntPtr hdc, out POINT lpPoint);
.
Documentation
[GetWindowOrgEx] on MSDN
coredll
.
[DllImport("coredll.dll", EntryPoint="GetWindowDC", SetLastError=true)]
.
private static extern IntPtr GetWindowDCCE(IntPtr hWnd);
.
<DllImport("coredll.dll", EntryPoint:="GetWindowDC", CharSet:=CharSet.Auto, ExactSpelling:=True)> _
.
Private Shared Function GetWindowDC(ByVal hWnd As HandleRef) As IntPtr
.
Declare Function GetWindowDC Lib "coredll.dll" (ByVal hWnd As HandleRef) As IntPtr
.
Documentation
[GetWindowDC] on MSDN
.
Summary
This function retrieves information about the specified window.
GetWindowLong also retrieves the 32-bit value at the specified offset into the extra window memory of a window.
.
static extern System.UInt32 GetWindowLong(IntPtr hWnd, int nIndex);
.
static extern IntPtr GetWindowLong(IntPtr window, int index);
.
Private Shared Function GetWindowLong(ByVal hWnd As IntPtr, ByVal nIndex As Integer) As System.UInt32
.
Documentation
[GetWindowLong] on MSDN
.
Summary
The joy of coding for .Net Compact Framework is that you often need to do some tweaks to obtain what is normally available in the Full Framework. One instance is wrapping the text of a button control so that it can appear on multiple lines. There's no property readily available at design time to allow this on the .Net Compact Framework and an alternative is to use
SetWindowLong and
GetWindowLong .
.
private static extern int GetWindowLong(IntPtr hWnd, int nIndex);
.
Private Shared Function GetWindowLong(ByVal hWnd As IntPtr, ByVal nIndex As Integer) As Integer
.
style = GetWindowLong(hWnd, GWL_STYLE);
.
Private Function GetWindowLong(ByVal hWnd As IntPtr, ByVal nIndex As Integer) As Integer
.
style = GetWindowLong(hWnd, GWL_STYLE)
shell32
.
CSIDL_WINDOWS = 0x0024, // GetWindowsDirectory()
.
CSIDL_WINDOWS = 0x0024, // GetWindowsDirectory()
Cut off search results after 60. Please refine your search.