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


Tip of the Day
Language: Visual Basic
Expertise: Beginner
Nov 18, 1997

Picking coordinates outside your window(s)

Question:
How do I make my program respond to "mousedown" outside my form? For instance: How would I get my program to tell me the pixel coordinants of my cursor when I click?

Answer:
You really can't do that under Win32. However, you *can* have it respond to MouseUp! I showed, in some detail, how to do this in the Q&A column (VBPJ, Sept 97).

In short, you create a drop-target, using the DragIcon property of a picture box. When MouseDown fires, call SetCapture, and that control's MouseMove and MouseUp events will then fire regardless of where the cursor is. In MouseUp, call GetCursorPosition to obtain the screen coordinates of the cursor.

DevX Pro
 
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