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

C / C++ / MFC

 
QuestionHow to disable minimized, maximized and restore button of my window? Pin
Anonymous24-Jan-05 18:12
Anonymous24-Jan-05 18:12 
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 
Here is what I've coded for the task
case WM_MOVING:
	{
		LPRECT lprc = (LPRECT)lParam;

		RECT WD;//get width and height of window - WD = WindowDimensions
		GetWindowRect(hwndDlg,&WD);
		WD.right -= WD.left;//Width
		WD.bottom -= WD.top;//Height

		RECT VDR;//VDR = VisibleDesktopRect
		SystemParametersInfo(SPI_GETWORKAREA,0,&VDR,0);

		if(lprc->left <= VDR.left + 5 &&
			lprc->left >= VDR.left - 5)//Left
		{
			lprc->left = VDR.left;
			lprc->right = lprc->left + WD.right;
		}

		if(lprc->top <= VDR.top + 5 &&
			lprc->top >=  VDR.top - 5)//Top
		{
			lprc->top = VDR.top;
			lprc->bottom = lprc->top + WD.bottom;
		}

		if(lprc->right >= VDR.right - 5 &&
			lprc->right <= VDR.right + 5)//Right
		{
			lprc->right = VDR.right;
			lprc->left = lprc->right - WD.right;
		}

		if(lprc->bottom >= VDR.bottom - 5 &&
			lprc->bottom <= VDR.bottom + 5)//Bottom
		{
			lprc->bottom = VDR.bottom;
			lprc->top = lprc->bottom - WD.bottom;
		}

		int HalfHeight = ((VDR.bottom - VDR.top) / 2) - (WD.bottom / 2);
		int HalfWidth = ((VDR.right - VDR.left) / 2) - (WD.right / 2 ); 

		if ((lprc->top >= HalfHeight - 5 && lprc->top <= HalfHeight) ||
			(lprc->top <= HalfHeight + 5 && lprc->top >= HalfHeight))//Center Up-Down
		{
			lprc->top = HalfHeight;
			lprc->bottom = lprc->top + WD.bottom;
		}

		if ((lprc->left >= HalfWidth - 5 && lprc->left <= HalfWidth) ||
			(lprc->left <= HalfWidth + 5 && lprc->left >= HalfWidth))//Center Left-Right
		{
			lprc->left = HalfWidth;
			lprc->right = lprc->left + WD.right;
		}

		return TRUE;
	} break;


The only problem is after it's been snapped, when you move the mouse slowly away from the edge the window will stay put! Why does it do that?

I want it to mimic DVD Decrypter

Thank you.
GeneralRe: Snapping windows to the desktop edge Pin
Ryan Binns24-Jan-05 18:01
Ryan Binns24-Jan-05 18:01 
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 

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.