WindowsAppFriend

Class Overview
Class that allows manipulating Windows applications.
Inherits from AppFriend.
Can fail to connect depending on the target application's permissions.


base class



public WindowsAppFriend(Process process)
Description
Constructor.  Connects to the indicated process.  Operations are carried
out in the thread of the window that is the main window at connection time.
The CLR version used for the target process is determined by examining the
version loaded in the target process.  When in multiple CLRs are loaded using
process side by side, one of the loaded versions is used. Native code does
not use the CLR, so the CLR version of the test application is used in this case.

Parameter
process
Target application process.



public WindowsAppFriend(IntPtr executeContextWindowHandle)
Description
Constructor.  Connects to the process of the indicated window handle.  Operations
are carried out in the thread of the indicated window handle.  The CLR version
used for the target process is determined by examining the version loaded
in the target process.  When in multiple CLRs are loaded using process side
by side, one of the loaded versions is used. Native code does not use the
CLR, so the CLR version of the test application is used in this case.

Parameters
executeContextWindowHandle
Windowshandle that belongs to the target process.
Operations are carried out in the thread of this window. 



public WindowsAppFriend(Process process, string clrVersion)
Description
Constructor.
Connects to the indicated process.
Operations are carried out in the thread of the window that is the main window at connection time.

Parameter
process
Target application process

clrVersion
CLR version of the target process.
Currently supports the following values.

"2.0"
Use this for .Net Framework 2.0, 3.0, 3.5, or when the
application does not use the .Net Framework.
"4.0"
Use this for .Net Framework 4.0 or 4.5.



public WindowsAppFriend(IntPtr executeContextWindowHandle, string clrVersion)
Description
Constructor.
Connects to the process of the indicated window handle.
Operations are carried out in the thread of the indicated window handle.

Parameters
executeContextWindowHandle
Windowshandle that belongs to the target process.
Operations are carried out in the thread of this window.

clrVersion
CLR version of the target process.
Currently supports the following values.


"2.0"
        Use this for .Net Framework 2.0, 3.0, 3.5, or when the
        application does not use the .Net Framework.

"4.0"
Use this for .Net Framework 4.0 or 4.5.



public int ProcessId { get; }
Description
Returns the ProcessId of the connected process.



public ExecuteContext ChangeContext(ExecuteContext context)
Description
It changes executing thread context within the target application.

Return Value
The executing context before the change.

Parameter
context
ExecuteContext object indicating the executing thread in the target application.



public void Dispose()
          Description
            Disposes this object.
When this method is called, communication with the target application
is terminated and managed variables are be released.
However, variables are only released from the managed domain and memory
release is left to garbage collection.

JR