異なる hWnd 値が API 関数に対して同じ結果を返す場合
[DllImport( "user32.dll" )]
public static extern int GetClassNameW( HandleRef hWnd, [MarshalAs( UnmanagedType.LPWStr )] StringBuilder className, int nMaxCount );
[DllImport( "user32.dll" )]
public static extern int GetWindowTextLength( HandleRef hWnd );
[DllImport( "user32.dll" )]
public static extern int GetWindowTextW( HandleRef hWnd, [MarshalAs( UnmanagedType.LPWStr )] StringBuilder text, int maximum );
オブジェクトがフォーム上に存在する位置に基づいて編集を行わなければならない場合があります。
public struct WindowPlacement {
public int length;
public int flags;
public int showCmd;
public Point minPosition;
public Point maxPosition;
public Rectangle normalPosition;
}
[DllImport( "user32.dll" )]
public static extern bool GetWindowPlacement( HandleRef hWnd, ref WindowPlacement position );