Click here to Skip to main content
15,908,166 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to disable minimized, maximized and restore button of my window? Pin
toxcct24-Jan-05 21:25
toxcct24-Jan-05 21:25 
AnswerRe: How to disable minimized, maximized and restore button of my window? Pin
Cedric Moonen24-Jan-05 22:55
Cedric Moonen24-Jan-05 22:55 
GeneralExtract text from Ms -office documents Pin
mjvalan24-Jan-05 17:48
mjvalan24-Jan-05 17:48 
GeneralRe: Extract text from Ms -office documents Pin
Member 30761224-Jan-05 20:39
Member 30761224-Jan-05 20:39 
GeneralRe: Extract text from Ms -office documents Pin
Anonymous16-Mar-05 18:28
Anonymous16-Mar-05 18:28 
GeneralRe: Extract text from Ms -office documents Pin
mjvalan16-Mar-05 18:29
mjvalan16-Mar-05 18:29 
GeneralSnapping windows to the desktop edge Pin
Timothy Grabrian24-Jan-05 17:24
professionalTimothy Grabrian24-Jan-05 17:24 
GeneralRe: Snapping windows to the desktop edge Pin
Ryan Binns24-Jan-05 18:01
Ryan Binns24-Jan-05 18:01 
The problem is that if the mouse moves slowly, you'll put it back where it was so that the user keeps having to drag it from the same spot. If they don't move enough, you'll keep snapping it back to where it was.

I think the easiest way (and I'm happy for someone to correct this) is to keep track of where the window and mouse cursor were when the operation was initiated (handle the WM_ENTERSIZEMOVE message) and calculate the full window position each time, rather than using the rectangle that was provided to you in the WM_MOVING message. Something like this:

In WM_ENTERSIZEMOVE:
- Get the window rectangle (GetWindowRect()) - I'll call it oldWindowPos
- Get the mouse cursor position (GetMessagePos()) - I'll call it oldCursorPos

In WM_MOVING:
- Get the current cursor position (GetMessagePos()) - I'll call it newCursorPos
- newWindowPos.left = newCursorPos.x + (oldWindowPos.left - oldCursorPos.x)
- newWindowPos.right = newCursorPos.x + (oldWindowPos.right - oldCursorPos.x)
- newWindowPos.top = newCursorPos.y + (oldWindowPos.top - oldCursorPos.y)
- newWindowPos.bottom = newCursorPos.y + (oldWindowPos.bottom - oldCursorPos.y)

[edit]Forgot to mention that after this, you'd snap the window position D'Oh! | :doh: [/edit]

Something like that, anyway Smile | :)

Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

GeneralRemoving metadata from MS Office documents Pin
sps-itsec4624-Jan-05 12:38
sps-itsec4624-Jan-05 12:38 
GeneralRe: Removing metadata from MS Office documents Pin
Michael P Butler24-Jan-05 13:42
Michael P Butler24-Jan-05 13:42 
GeneralRe: Removing metadata from MS Office documents Pin
sps-itsec4624-Jan-05 23:47
sps-itsec4624-Jan-05 23:47 
Generalint to string for TextOut Pin
shilton8424-Jan-05 11:08
shilton8424-Jan-05 11:08 
GeneralRe: int to string for TextOut Pin
Ryan Binns24-Jan-05 17:24
Ryan Binns24-Jan-05 17:24 
GeneralRe: int to string for TextOut Pin
ThatsAlok24-Jan-05 17:53
ThatsAlok24-Jan-05 17:53 
GeneralRe: int to string for TextOut Pin
toxcct24-Jan-05 21:32
toxcct24-Jan-05 21:32 
GeneralRe: int to string for TextOut Pin
ThatsAlok24-Jan-05 21:53
ThatsAlok24-Jan-05 21:53 
GeneralSystem function DOS widows problem Pin
Anonymous24-Jan-05 9:22
Anonymous24-Jan-05 9:22 
GeneralRe: System function DOS widows problem Pin
David Crow24-Jan-05 10:07
David Crow24-Jan-05 10:07 
GeneralCClientSocket Pin
rmunguia24-Jan-05 6:53
rmunguia24-Jan-05 6:53 
QuestionFUZZY Set help ? Pin
faroqtam24-Jan-05 6:38
faroqtam24-Jan-05 6:38 
AnswerRe: FUZZY Set help ? Pin
Christian Graus24-Jan-05 8:55
protectorChristian Graus24-Jan-05 8:55 
GeneralRe: FUZZY Set help ? Pin
Ryan Binns24-Jan-05 17:26
Ryan Binns24-Jan-05 17:26 
GeneralRe: FUZZY Set help ? Pin
Christian Graus24-Jan-05 17:30
protectorChristian Graus24-Jan-05 17:30 
GeneralRe: FUZZY Set help ? Pin
Ryan Binns24-Jan-05 18:05
Ryan Binns24-Jan-05 18:05 
AnswerRe: FUZZY Set help ? Pin
Andy Brummer24-Jan-05 10:44
sitebuilderAndy Brummer24-Jan-05 10:44 

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.