Click here to Skip to main content
15,910,981 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: how to get a random number between 0 and 1 Pin
David Crow10-Oct-05 3:34
David Crow10-Oct-05 3:34 
Questionhow to get a random number between 0 and 1 Pin
cauvang9-Oct-05 19:11
cauvang9-Oct-05 19:11 
AnswerRe: how to get a random number between 0 and 1 Pin
S. Senthil Kumar9-Oct-05 19:30
S. Senthil Kumar9-Oct-05 19:30 
AnswerRe: how to get a random number between 0 and 1 Pin
seppo.lahti10-Oct-05 0:18
seppo.lahti10-Oct-05 0:18 
AnswerRe: how to get a random number between 0 and 1 Pin
kevincwong11-Oct-05 11:09
kevincwong11-Oct-05 11:09 
QuestionMinimizing a dialog box Pin
MandiraT9-Oct-05 19:00
MandiraT9-Oct-05 19:00 
AnswerRe: Minimizing a dialog box Pin
ashwin209-Oct-05 20:26
ashwin209-Oct-05 20:26 
AnswerRe: Minimizing a dialog box Pin
Mircea Puiu9-Oct-05 23:43
Mircea Puiu9-Oct-05 23:43 
I understand you want to click the title bar to maximize the dialog on the screen, then you want to click the icon in the task bar to retrieve the original size and position of the dialog.
For that you have to do the following:

Declare the following handlers for your dialog class:
====================================================
afx_msg void OnNcLButtonDown(UINT nHitTest, CPoint point);
afx_msg void OnActivateApp(BOOL bActive, HTASK hTask);

Add the following message map entries:
=====================================
ON_WM_NCLBUTTONDOWN()
ON_WM_ACTIVATEAPP()

Call GetStartRectangle() within OnInitDialog()
Declare and define the following:
====================
void CYourDlg::GetStartRectangle()
{
	CRect	rcArea;
	int		w, h;

	SystemParametersInfo(SPI_GETWORKAREA, 0, &rcArea, 0);
	GetWindowRect(&m_rcInitial);
	w = m_rcInitial.Width();
	h = m_rcInitial.Height();
	m_rcInitial.left = (rcArea.left + rcArea.right) / 2 - w / 2;
	m_rcInitial.right = m_rcInitial.left + w;
	m_rcInitial.top = (rcArea.top + rcArea.bottom) / 2 - h / 2;
	m_rcInitial.bottom = m_rcInitial.top + h;
}

void CYourDlg::Maximize()
{
	CRect	rcArea;

	SystemParametersInfo(SPI_GETWORKAREA, 0, &rcArea, 0);
	MoveWindow(&rcArea);
}

void CYourDlg::Minimize()
{
	MoveWindow(&m_rcInitial);
}

void CYourDlg::OnNcLButtonDown(UINT nHitTest, CPoint point)
{
	if ( nHitTest == HTCAPTION ) Maximize();
	CDialog::OnNcHitTest(point);
}

void CYourDlg::OnActivateApp(BOOL bActive, HTASK hTask)
{
	Minimize();
}


SkyWalker

-- modified at 5:47 Monday 10th October, 2005
QuestionRTF (RichText) draw using GDI+ like VISIO 2003 style. Richtext able to rotate and translate. Pin
Anonymous9-Oct-05 18:29
Anonymous9-Oct-05 18:29 
QuestionBlocking of thread Pin
sthalasayanam9-Oct-05 17:40
sthalasayanam9-Oct-05 17:40 
AnswerRe: Blocking of thread Pin
ThatsAlok9-Oct-05 18:33
ThatsAlok9-Oct-05 18:33 
AnswerRe: Blocking of thread Pin
S. Senthil Kumar9-Oct-05 19:16
S. Senthil Kumar9-Oct-05 19:16 
GeneralRe: Blocking of thread Pin
sthalasayanam9-Oct-05 19:40
sthalasayanam9-Oct-05 19:40 
QuestionHow to get the total sectors of physical disk Pin
Anonymous9-Oct-05 17:24
Anonymous9-Oct-05 17:24 
AnswerRe: How to get the total sectors of physical disk Pin
Jose Lamas Rios9-Oct-05 17:45
Jose Lamas Rios9-Oct-05 17:45 
GeneralRe: How to get the total sectors of physical disk Pin
TeraCoder10-Oct-05 1:43
TeraCoder10-Oct-05 1:43 
GeneralRe: How to get the total sectors of physical disk Pin
bghuang10-Oct-05 5:14
bghuang10-Oct-05 5:14 
QuestionText ROPs Pin
Simon Blundell9-Oct-05 15:42
Simon Blundell9-Oct-05 15:42 
AnswerRe: Text ROPs Pin
Christian Graus9-Oct-05 16:08
protectorChristian Graus9-Oct-05 16:08 
QuestionDo someone use LAPACK ? Pin
rudo329-Oct-05 11:27
rudo329-Oct-05 11:27 
QuestionPurchasing Visual Studio 6! Pin
TeraCoder9-Oct-05 8:50
TeraCoder9-Oct-05 8:50 
AnswerRe: Purchasing Visual Studio 6! Pin
Chris Losinger9-Oct-05 10:36
professionalChris Losinger9-Oct-05 10:36 
JokeRe: Purchasing Visual Studio 6! Pin
Ghasrfakhri9-Oct-05 11:18
Ghasrfakhri9-Oct-05 11:18 
GeneralRe: Purchasing Visual Studio 6! Pin
ThatsAlok9-Oct-05 18:35
ThatsAlok9-Oct-05 18:35 
GeneralRe: Purchasing Visual Studio 6! Pin
TeraCoder10-Oct-05 1:42
TeraCoder10-Oct-05 1:42 

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.