Click here to Skip to main content
15,914,820 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: AES encryption for steaming data for Windows Mobile 5.0 Pin
gauravzhere17-May-07 23:36
gauravzhere17-May-07 23:36 
GeneralRe: AES encryption for steaming data for Windows Mobile 5.0 Pin
newbiesworld8-Feb-10 5:39
newbiesworld8-Feb-10 5:39 
QuestionWhy does SetWindowPos called with original ClientCoordinates move the window? Pin
Chilli7116-May-07 4:26
Chilli7116-May-07 4:26 
AnswerRe: Why does SetWindowPos called with original ClientCoordinates move the window? Pin
Hans Dietrich16-May-07 4:37
mentorHans Dietrich16-May-07 4:37 
GeneralRe: Why does SetWindowPos called with original ClientCoordinates move the window? Pin
Chilli7116-May-07 8:50
Chilli7116-May-07 8:50 
GeneralRe: Why does SetWindowPos called with original ClientCoordinates move the window? Pin
Hans Dietrich16-May-07 9:09
mentorHans Dietrich16-May-07 9:09 
GeneralRe: Why does SetWindowPos called with original ClientCoordinates move the window? Pin
Chilli7117-May-07 7:53
Chilli7117-May-07 7:53 
AnswerSolution Pin
Chilli717-Jun-07 20:07
Chilli717-Jun-07 20:07 
The description of the SetWindow/MoveWindow functions is correct when it says you have to use client corrdinates.
However it does not tell you that you move you child window within the client space of the parent window and therefore need to give the coordinates in the parent window client space format.

This is one possible solution:
inline void CMyWnd::MoveWindowRelative(RECT* Displacement, BOOL bRepaint)
{CWnd*	pParCWnd;
 RECT	WndCoor;

	pParCWnd = GetParent();					//Get pointer to parent window object
	ASSERT (IsKindOf (RUNTIME_CLASS(CWnd)));
	
	GetWindowRect(&WndCoor);				//Get screen coordinates of object assosiated window
	pParCWnd->ScreenToClient(&WndCoor);			//transform to Client coordinates of parent (!) window
	WndCoor.left	+= Displacement->left;			//Displace
	WndCoor.top	+= Displacement->top;
	WndCoor.right	+= Displacement->right;
	WndCoor.bottom	+= Displacement->bottom;

	MoveWindow(&WndCoor, bRepaint);
}


top + left of Displacement specify the amount you want to shift the window, bottom + rightod Displacement specify how you want to shrink or enlarge the window.

Regards
Leo
QuestionAbout Tetris game Pin
Mojtaba Karimi16-May-07 4:22
Mojtaba Karimi16-May-07 4:22 
AnswerRe: About Tetris game Pin
ajitatif angajetor16-May-07 4:35
ajitatif angajetor16-May-07 4:35 
AnswerRe: About Tetris game Pin
CPallini16-May-07 9:36
mveCPallini16-May-07 9:36 
QuestionCatching Key Event of an Edit Box Pin
ajitatif angajetor16-May-07 3:49
ajitatif angajetor16-May-07 3:49 
AnswerRe: Catching Key Event of an Edit Box Pin
led mike16-May-07 5:13
led mike16-May-07 5:13 
GeneralRe: Catching Key Event of an Edit Box Pin
ajitatif angajetor16-May-07 6:34
ajitatif angajetor16-May-07 6:34 
GeneralRe: Catching Key Event of an Edit Box Pin
malaugh16-May-07 8:58
malaugh16-May-07 8:58 
Questionstatic text box , GetClientRect, GetTextExtent [modified] Pin
daveyerwin16-May-07 3:34
daveyerwin16-May-07 3:34 
AnswerRe: static text box , GetClientRect, GetTextExtent Pin
shivditya16-May-07 4:55
shivditya16-May-07 4:55 
AnswerRe: static text box , GetClientRect, GetTextExtent Pin
Mark Salsbery16-May-07 5:21
Mark Salsbery16-May-07 5:21 
GeneralRe: static text box , GetClientRect, GetTextExtent Pin
daveyerwin16-May-07 7:50
daveyerwin16-May-07 7:50 
GeneralRe: static text box , GetClientRect, GetTextExtent [modified] Pin
Mark Salsbery16-May-07 8:24
Mark Salsbery16-May-07 8:24 
GeneralRe: static text box , GetClientRect, GetTextExtent Pin
daveyerwin16-May-07 14:13
daveyerwin16-May-07 14:13 
GeneralRe: static text box , GetClientRect, GetTextExtent Pin
Mark Salsbery16-May-07 14:26
Mark Salsbery16-May-07 14:26 
QuestionRe: static text box , GetClientRect, GetTextExtent Pin
Hamid_RT16-May-07 5:25
Hamid_RT16-May-07 5:25 
Questionenum Pin
klutez12316-May-07 3:09
klutez12316-May-07 3:09 
AnswerRe: enum Pin
David Crow16-May-07 3:15
David Crow16-May-07 3: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.