C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




How to Capture window under mouse using vb.net


Posted Date: 23 Dec 2007    Resource Type: Code Snippets    Category: Winforms Controls

Posted By: KVGaneshBabu       Member Level: Diamond
Rating:     Points: 10



Capture window under mouse



Private Const SRCCOPY = &HCC0020
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long

Private Sub Form_Load()
Timer1.Enabled = True
Timer1.Interval = 400
SetWindowPos Me.hwnd, -1, 0, 0, 0, 0, 1
Form1.AutoRedraw = True
End Sub

Private Sub Timer1_Timer()
Dim xy As POINTAPI
Dim wnd As Long, wndc As Long
GetCursorPos xy
wnd = WindowFromPoint(xy.X, xy.Y)
wndc = GetDC(wnd)
Form1.Refresh
BitBlt Me.hdc, 0, 0, Screen.Width, Screen.Height, wndc, 0, 0, SRCCOPY
End Sub





Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Vb.net  .  Using  .  Under mouse  .  Capture window  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Creating Excel document without using Application.Excel class
Previous Resource: Transparent Windows Forms in .NET
Return to Discussion Resource Index
Post New Resource
Category: Winforms Controls


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

efax

Contact Us    Privacy Policy    Terms Of Use