Prev: CEdit
Next: Maximize 'off-centre'
From: xg on 19 Apr 2010 01:15 Hi, I am writing an app in which I need to retrieve the mouse coordinates even when it mouse is outside the main frame. How do I do it? Thanks! xg
From: David Lowndes on 19 Apr 2010 04:11 >Hi, I am writing an app in which I need to retrieve the mouse coordinates >even when it mouse is outside the main frame. How do I do it? Thanks! Have you tried calling GetCursorPos? If you want to know when the mouse is moving I think you'll need to use a hook - have a look at SetWindowsHookEx WH_MOUSE. Dave
From: Joseph M. Newcomer on 19 Apr 2010 11:06 IN addition to David's answer, you have not stated the problem you are trying to solve. For example, in doing certain actions such as "rubber-band lines", you are operating in a mode where you need to track the mouse, even though it is outside the bounds of the window. This is best done by using SetCapture to capture the mouse during the mouse-down actions. These algorithms are well-documented (see the "Scribble" app, the MFC trainging app, which goes into great detail about this). You did not say under what conditions you need to actually know where the mouse is, so in addition to the "rubber banding" issue (including highlighting areas of the window, etc.) you did not state what you are trying to accomplish; do you KNOW, by some means, when you should look, or do you need to track the mouse, even though it is being used in some other app. Take a look at my hooks article on my MVP TIps site. joe On Mon, 19 Apr 2010 13:15:18 +0800, "xg" <xg1(a)yahoo.com> wrote: >Hi, I am writing an app in which I need to retrieve the mouse coordinates >even when it mouse is outside the main frame. How do I do it? Thanks! > >xg > Joseph M. Newcomer [MVP] email: newcomer(a)flounder.com Web: http://www.flounder.com MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Jerry Coffin on 19 Apr 2010 12:03 In article <OndAb833KHA.5820(a)TK2MSFTNGP06.phx.gbl>, xg1(a)yahoo.com says... > > Hi, I am writing an app in which I need to retrieve the mouse coordinates > even when it mouse is outside the main frame. How do I do it? Thanks! GetCursorPos(). -- Later, Jerry.
|
Pages: 1 Prev: CEdit Next: Maximize 'off-centre' |