Bagikan melalui


IpcProtectWindow function

Protects a window by using mechanisms available on the current operating system.

Syntax

HRESULT WINAPI IpcProtectWindow(
  _In_ HWND     hwnd
);

Parameters

hwnd [in]

The window to protect.

Return value

If the function succeeds, the return value is S_OK. If the function fails, it returns an HRESULT value that indicates the error.

For more information, see Error codes for a description of all RMS SDK 2.1 return values.

Remarks

Typically, you will call IpcProtectWindow when your application is loading an RMS-protected document. If the user does not have rights to copy/paste the protected content hosted within a window, you need to call IpcProtectWindow on this window. If this call fails, you cannot display the protected content securely, and you should treat this as a failure to load the document, presenting an appropriate error message to the user.

To ensure that your application works with current and future versions of the AD RMS SDK, you should use the following code to protect a window.

hr = IpcProtectWindow(hwnd);
if (FAILED(hr) && (IPCERROR_PROPERTY_ALREADY_SET != hr))
{
  // Fail to load document
}
else
{
  // Success!  Continue...
hr = S_OK;
}

Requirements

Minimum supported client
Windows Vista with SP2
Minimum supported server
Windows Server 2008
Header
Ipcprot.h (include Msipc.h)
Library
Msipc.lib
DLL
Msipc.dll

See also

IpcUnprotectWindow

Error codes