Click here to Skip to main content
15,899,313 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: Best way of handling querystring Pin
Marko B.L.29-Mar-07 1:15
Marko B.L.29-Mar-07 1:15 
GeneralRe: Best way of handling querystring Pin
Chris Maunder29-Mar-07 21:25
cofounderChris Maunder29-Mar-07 21:25 
GeneralRe: Best way of handling querystring Pin
eggsovereasy2-Apr-07 7:49
eggsovereasy2-Apr-07 7:49 
GeneralCreate exception handling Pin
Fatbuddha 128-Mar-07 22:09
Fatbuddha 128-Mar-07 22:09 
GeneralRe: Create exception handling Pin
Vasudevan Deepak Kumar29-Mar-07 9:10
Vasudevan Deepak Kumar29-Mar-07 9:10 
General100% Bug Free - 0% Logic Pin
Parthi_Appu25-Mar-07 23:25
Parthi_Appu25-Mar-07 23:25 
GeneralRe: 100% Bug Free - 0% Logic Pin
Don Miguel26-Mar-07 2:24
Don Miguel26-Mar-07 2:24 
GeneralRe: 100% Bug Free - 0% Logic Pin
Mike Dimmick26-Mar-07 3:46
Mike Dimmick26-Mar-07 3:46 
Check whether they've used SetCapture anywhere. If the mouse is captured, you will get mouse event messages outside the window's client rectangle. Also, note that GetCursorPos tells you the current position - a WM_MOUSEMOVE message tells you that the mouse moved when captured or when over the window at some point in the past. Perhaps they were trying to filter out old events? This would only be a problem if the application isn't very responsive to window messages, however.

If you want to know the cursor position when the message was generated, that appears in the WM_MOUSEMOVE message's lParam parameter. This is actually relative to the client rectangle already, so ClientToScreen is not required. MFC's OnMouseMove function extracts the lParam message parameter to the point parameter.

Do note however that Windows limits the rate at which it sends WM_MOUSEMOVE messages so that applications aren't overwhelmed, if the application is busy. You used to be able to see this effect in Windows Paint if you moved the mouse very rapidly while drawing - the line would be in lots of straight segments, rather than being smooth - but modern PCs are well up to the demands of Paint, so you don't see it any more.

(Personally I would use ScreenToClient on the cursor's location and then use client rectangle-relative co-ordinates throughout, rather than converting the other way).

Stability. What an interesting concept. -- Chris Maunder

GeneralRe: 100% Bug Free - 0% Logic Pin
Christian Graus26-Mar-07 14:10
protectorChristian Graus26-Mar-07 14:10 
GeneralRe: 100% Bug Free - 0% Logic Pin
Parthi_Appu26-Mar-07 17:26
Parthi_Appu26-Mar-07 17:26 
GeneralRe: 100% Bug Free - 0% Logic Pin
Parthi_Appu26-Mar-07 17:23
Parthi_Appu26-Mar-07 17:23 
GeneralRe: 100% Bug Free - 0% Logic Pin
Vasudevan Deepak Kumar28-Mar-07 8:28
Vasudevan Deepak Kumar28-Mar-07 8:28 
QuestionFunny Redirection Pin
N a v a n e e t h22-Mar-07 18:05
N a v a n e e t h22-Mar-07 18:05 
AnswerRe: Funny Redirection Pin
peterchen23-Mar-07 3:49
peterchen23-Mar-07 3:49 
AnswerRe: Funny Redirection Pin
Russell Jones23-Mar-07 5:08
Russell Jones23-Mar-07 5:08 
GeneralRe: Funny Redirection Pin
Nish Nishant23-Mar-07 9:01
sitebuilderNish Nishant23-Mar-07 9:01 
GeneralRe: Funny Redirection Pin
Dan Neely23-Mar-07 9:05
Dan Neely23-Mar-07 9:05 
GeneralRe: Funny Redirection Pin
Nish Nishant23-Mar-07 9:10
sitebuilderNish Nishant23-Mar-07 9:10 
GeneralRe: Funny Redirection Pin
Dan Neely23-Mar-07 10:03
Dan Neely23-Mar-07 10:03 
GeneralRe: Funny Redirection Pin
N a v a n e e t h23-Mar-07 20:08
N a v a n e e t h23-Mar-07 20:08 
GeneralHall of Shame I think Pin
Teashirt222-Mar-07 16:30
Teashirt222-Mar-07 16:30 
GeneralRe: Hall of Shame I think Pin
Sho_Asylumn24-Mar-07 13:31
Sho_Asylumn24-Mar-07 13:31 
GeneralRe: Hall of Shame I think Pin
Emil - Gabriel26-Mar-07 23:12
Emil - Gabriel26-Mar-07 23:12 
GeneralSeriously Pin
Christian Graus22-Mar-07 10:19
protectorChristian Graus22-Mar-07 10:19 
GeneralRe: Seriously Pin
Dave Kreskowiak22-Mar-07 16:15
mveDave Kreskowiak22-Mar-07 16:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.