HwndSource.FromHwnd(IntPtr) 메서드

정의

지정된 창의 HwndSource 개체를 반환합니다.

public:
 static System::Windows::Interop::HwndSource ^ FromHwnd(IntPtr hwnd);
[System.Security.SecurityCritical]
public static System.Windows.Interop.HwndSource FromHwnd (IntPtr hwnd);
public static System.Windows.Interop.HwndSource FromHwnd (IntPtr hwnd);
[<System.Security.SecurityCritical>]
static member FromHwnd : nativeint -> System.Windows.Interop.HwndSource
static member FromHwnd : nativeint -> System.Windows.Interop.HwndSource
Public Shared Function FromHwnd (hwnd As IntPtr) As HwndSource

매개 변수

hwnd
IntPtr

nativeint

제공된 창 핸들입니다.

반환

hwnd 창 핸들에 지정된 창에 대한 HwndSource 개체입니다.

특성

설명

중요

이 메서드는 인터넷 보안 영역에서 사용할 수 없거나 일반적으로 부분 신뢰에 사용할 수 없습니다.

이 메서드를 사용하여 명시적으로 상호 운용 창이 아닌 창에 대한 를 반환 HwndSource 할 수 있습니다. 이에 대한 절차는 다음과 같습니다.

  1. 인스턴스를 만듭니다 WindowInteropHelper (기본 Window 을 생성자 매개 변수로 제공).

  2. 해당 WindowInteropHelper 인스턴스에서 속성 값을 Handle 가져옵니다.

  3. 해당 HWND 값을 매개 변수로 에 전달합니다 FromHwnd.

이 기술은 창에 일반 AddHook 메시지 처리를 추가하려는 경우에 유용할 수 있습니다. 그러나 를 만들 HwndSource때마다 삭제할 책임이 있습니다. 이 참인 경우에를 Application 애플리케이션에 대 한 개체 HwndSource 삭제 됩니다. 자세한 내용은 에 대한 HwndSource설명을 참조하세요.

적용 대상

추가 정보