private static void SetControlValue(System.IntPtr accObj, int vmId, string controlValue)
{
if (!accObj.Equals((System.IntPtr)System.IntPtr.Zero))
{
System.IntPtr pControlValue = System.Runtime.InteropServices.Marshal.StringToCoTaskMemUni(controlValue);
try
{
if (!pControlValue.Equals((System.IntPtr)System.IntPtr.Zero))
{
JavaAccNativeMethods.setTextContents(vmId, accObj, pControlValue);
}
}
catch (System.Exception exception)
{
if (!IsJavaAccException(exception) || !IsJavaAccExceptionMaskable(exception))
{
throw;
}
}
finally
{
if (!pControlValue.Equals((System.IntPtr)System.IntPtr.Zero))
{
System.Runtime.InteropServices.Marshal.FreeCoTaskMem(pControlValue);
}
}
}
}