Click here to Skip to main content
15,881,139 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionPlacing the dialog bar Pin
manoharbalu17-Dec-18 23:12
manoharbalu17-Dec-18 23:12 
AnswerRe: Placing the dialog bar Pin
Richard MacCutchan17-Dec-18 23:48
mveRichard MacCutchan17-Dec-18 23:48 
GeneralRe: Placing the dialog bar Pin
manoharbalu18-Dec-18 1:42
manoharbalu18-Dec-18 1:42 
GeneralRe: Placing the dialog bar Pin
Richard MacCutchan18-Dec-18 1:54
mveRichard MacCutchan18-Dec-18 1:54 
GeneralRe: Placing the dialog bar Pin
manoharbalu18-Dec-18 1:59
manoharbalu18-Dec-18 1:59 
QuestionRe: Placing the dialog bar Pin
David Crow18-Dec-18 4:19
David Crow18-Dec-18 4:19 
GeneralRe: Placing the dialog bar Pin
Richard MacCutchan18-Dec-18 4:49
mveRichard MacCutchan18-Dec-18 4:49 
GeneralRe: Placing the dialog bar Pin
Richard MacCutchan18-Dec-18 6:28
mveRichard MacCutchan18-Dec-18 6:28 
Here is what I have:
C++
RECT	rectParent, rectDialog;
SIZE	sizeParent, sizeDialog;
POINT	point;

// get the size of the dialog
GetWindowRect(hDialog, &rectDialog);
sizeDialog.cx = rectDialog.right - rectDialog.left;
sizeDialog.cy = rectDialog.bottom - rectDialog.top;

// get the size of the parent Window's client area
GetClientRect(GetParent(hDialog), &rectParent);
sizeParent.cx = rectParent.right - rectParent.left;
sizeParent.cy = rectParent.bottom - rectParent.top;

// parent's sizes minus dialog's sizes divided by 2
// give the coordinates of the centre position
point.x = (sizeParent.cx - sizeDialog.cx) / 2;
point.y = (sizeParent.cy - sizeDialog.cy) / 2;
// we need to make parent coordinates relative to the screen
ClientToScreen(GetParent(hDialog), &point);

// now move the Window to the new position
MoveWindow(hDialog, point.x, point.y, sizeDialog.cx, sizeDialog.cy, true);


modified 18-Dec-18 12:39pm.

GeneralRe: Placing the dialog bar Pin
manoharbalu18-Dec-18 22:55
manoharbalu18-Dec-18 22:55 
GeneralRe: Placing the dialog bar Pin
mo149219-Dec-18 0:18
mo149219-Dec-18 0:18 
GeneralRe: Placing the dialog bar Pin
mo149219-Dec-18 1:44
mo149219-Dec-18 1:44 
GeneralRe: Placing the dialog bar Pin
manoharbalu20-Dec-18 2:01
manoharbalu20-Dec-18 2:01 
GeneralRe: Placing the dialog bar Pin
mo149220-Dec-18 12:31
mo149220-Dec-18 12:31 
GeneralRe: Placing the dialog bar Pin
manoharbalu20-Dec-18 17:40
manoharbalu20-Dec-18 17:40 
GeneralRe: Placing the dialog bar Pin
Richard MacCutchan19-Dec-18 4:20
mveRichard MacCutchan19-Dec-18 4:20 
QuestionPassing / modifying char* to/ by function. Pin
Vaclav_16-Dec-18 16:33
Vaclav_16-Dec-18 16:33 
AnswerRe: Passing / modifying char* to/ by function. Pin
CPallini16-Dec-18 21:23
mveCPallini16-Dec-18 21:23 
AnswerRe: Passing / modifying char* to/ by function. Pin
Richard MacCutchan16-Dec-18 22:30
mveRichard MacCutchan16-Dec-18 22:30 
GeneralRe: Passing / modifying char* to/ by function. Pin
CPallini16-Dec-18 22:56
mveCPallini16-Dec-18 22:56 
GeneralRe: Passing / modifying char* to/ by function. Pin
Richard MacCutchan16-Dec-18 23:01
mveRichard MacCutchan16-Dec-18 23:01 
GeneralRe: Passing / modifying char* to/ by function. Pin
Vaclav_17-Dec-18 3:26
Vaclav_17-Dec-18 3:26 
GeneralRe: Passing / modifying char* to/ by function. Pin
Richard MacCutchan17-Dec-18 3:50
mveRichard MacCutchan17-Dec-18 3:50 
GeneralRe: Passing / modifying char* to/ by function. Pin
leon de boer17-Dec-18 18:48
leon de boer17-Dec-18 18:48 
AnswerRe: Passing / modifying char* to/ by function. Pin
Joe Woodbury17-Dec-18 8:20
professionalJoe Woodbury17-Dec-18 8:20 
GeneralRe: Passing / modifying char* to/ by function. Pin
Vaclav_17-Dec-18 11:20
Vaclav_17-Dec-18 11:20 

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.