.NET/Windows API for .NET
EnableWindow - Program(Window)및 특정 Control사용가능여부설정
클리엘
2019. 7. 31. 14:02
728x90
Declare Function EnableWindow Lib "user32" Alias "EnableWindow" (ByVal hwnd As Integer, ByVal fEnable As Boolean) As Integer
- VB.NET 선언
EnableWindow(Me.Handle, False) 'Windows Form 제어 예제
EnableWindow(Button1.Handle, False) '특정 Control 제어 예제
- VB.NET 호출
[System.Runtime.InteropServices.DllImport("user32.dll")]
private static extern int EnableWindow(int hwnd, bool fEnable);
- C# 선언
EnableWindow((int)this.Handle, false); //Windows Form 제어 예제
EnableWindow((int)this.button1.Handle, false); //특정 Control 제어 예제
- C# 호출
EnableWindow의 첫번째 인수는 제어하고자 하는 윈도우나 컨트롤의 Handle이 전달되고 두번째 인수에서 Handle로 건네진 Object를 사용가능하게(ture)할것인가 또는 불가능(false)하게 할것인가를 지정합니다.
만일 EnableWindow함수가 실행하는데 실패하면 0을, 성공하면 0이외의 값을 반환합니다.
728x90