클리엘
CLIEL LAB
클리엘
전체 방문자
오늘
어제
  • 분류 전체보기 (514) N
    • Mobile (47)
      • Kotlin (47)
    • Web (84)
      • NestJS (9)
      • HTML5 & CSS3 (38)
      • Javascript (20)
      • TypeScript (6)
      • JQuery (11)
    • .NET (301) N
      • C# (84) N
      • ASP.NET (67)
      • Windows API for .NET (128)
    • Server (53)
      • SQL Server (10)
      • MariaDB (18)
      • Windows Server (6)
      • node.js (19)
    • System (12)
      • 작업LOG (12)
    • Review (11)
    • ETC (6)

블로그 메뉴

  • 홈
  • 태그
  • 방명록

공지사항

  • 블로그 정리

인기 글

태그

  • Kotlin
  • asp.net core
  • LINQ
  • exception
  • Windows API
  • JavaScript
  • ASP.NET
  • CSS3
  • android studio
  • HTML5
  • NestJS
  • MariaDB
  • node.js
  • c#
  • 변수
  • jQuery
  • Entity Framework
  • asp.net core web api
  • .NET
  • android

최근 댓글

최근 글

티스토리

hELLO · Designed By 정상우.
클리엘

CLIEL LAB

.NET/Windows API for .NET

WindowFromPoint - 위치에 따른 Window의 Handle값 취득

2019. 8. 6. 16:08
728x90

WindowFromPoint함수는 특정 위치에 있는 Window의 Handle을 반환하는 함 수 입니다.

Declare Function WindowFromPoint Lib "user32" Alias "WindowFromPoint" (ByVal lpPoint As Point) As Integer 

▶VB.NET 선언

[DllImport("user32.dll")] 
public static extern int WindowFromPoint(Point lpPoint); 

▶C# 선언

함수의 인수로는 Handle을 가져올 Window가 있는 위치를 Point로 지정합니다. 아래는 현재 Form의 X, Y위치를 가리키는 예제입니다.

Dim ptCursor As Point = New Point() 

ptCursor.X = Me.Location.X 
ptCursor.Y = Me.Location.Y

▶VB.NET

Point ptCursor = new Point(); 

ptCursor.X = this.Location.X; 
ptCursor.Y = this.Location.Y; 

▶C#

만일 Mouse Pointer가 위치한 지점을 선정하시려면 GetCursorPos사용합니다.

[Windows API for .NET] - GetCursorPos - Mouse Pointer의 현재위치 반환


위치에 대한 Point를 인수를 통하여 현재 Form의 Handle을 구하려면 함수를 다음과 같이 호출합니다.

Dim ptCursor As Point = New Point() 
ptCursor.X = Me.Location.X 
ptCursor.Y = Me.Location.Y 

SetWindowText(WindowFromPoint(ptCursor), "abc")

▶VB.NET 호출

Point ptCursor = new Point(); 
ptCursor.X = this.Location.X; 
ptCursor.Y = this.Location.Y; 

SetWindowText(WindowFromPoint(ptCursor), "abc"); 

▶C# 호출

728x90
저작자표시 비영리 변경금지 (새창열림)

'.NET > Windows API for .NET' 카테고리의 다른 글

GetSystemInfo - System 정보조회  (0) 2019.08.06
ExitWindowsEx - System종료및 Logoff 하기  (0) 2019.08.06
SetSystemTime - System날짜및 시간설정  (0) 2019.08.06
CopyFile - File복사  (0) 2019.08.06
SetFileAttributes - File의 속성설정  (0) 2019.08.06
    '.NET/Windows API for .NET' 카테고리의 다른 글
    • GetSystemInfo - System 정보조회
    • ExitWindowsEx - System종료및 Logoff 하기
    • SetSystemTime - System날짜및 시간설정
    • CopyFile - File복사
    클리엘
    클리엘
    누구냐 넌?

    티스토리툴바