dcsimg
Login | Register   
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language:
Expertise: Intermediate
Oct 26, 1999

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


Determine Visible Part of a Window

Programmers often need to know whether only a part of a window is visible. This can require a difficult calculation with coordinates. Use this routine to easily determine the visible part of your window or any control that has an hWnd property:
 
Option Explicit

Public Type RECT		' Declare API type
	Left As Long
	Top As Long
	Right As Long
	Bottom As Long
End Type

' Declare API functions:
Private Declare Function InvalidateRect Lib _
	"user32" (ByVal hWnd As Long, lpRect As _
	RECT, ByVal bErase As Long) As Long
Private Declare Function GetUpdateRect Lib _
	"user32" (ByVal hWnd As Long, lpRect As _
	RECT, ByVal bErase As Long) As Long
Private Declare Function GetClientRect Lib _
	"user32" (ByVal hWnd As Long, lpRect As _
	RECT) As Long

Public Function GetVisibleRect(ByVal hWnd As _
	Long, lpRect As RECT) As Boolean
	Dim lpClientRect As RECT

	Call GetClientRect(hWnd, lpClientRect)
	Call InvalidateRect(hWnd, lpClientRect, False)
	GetVisibleRect = GetUpdateRect(hWnd, lpRect, _
		False)
End Function
Meszaros Akos
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date