Click here to Skip to main content
15,901,035 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionGet PROPERTYKEY from Name Pin
Emulator ®11-Oct-09 9:47
Emulator ®11-Oct-09 9:47 
Questionfilter CListCtrl with the extension of files Pin
MrKBA11-Oct-09 9:23
MrKBA11-Oct-09 9:23 
AnswerRe: filter CListCtrl with the extension of files Pin
Richard MacCutchan11-Oct-09 9:33
mveRichard MacCutchan11-Oct-09 9:33 
QuestionC++ Web Control Pin
Arnon A11-Oct-09 7:33
Arnon A11-Oct-09 7:33 
AnswerRe: C++ Web Control Pin
Richard MacCutchan11-Oct-09 7:44
mveRichard MacCutchan11-Oct-09 7:44 
GeneralRe: C++ Web Control Pin
Arnon A12-Oct-09 9:05
Arnon A12-Oct-09 9:05 
GeneralRe: C++ Web Control Pin
Richard MacCutchan12-Oct-09 22:01
mveRichard MacCutchan12-Oct-09 22:01 
GeneralRe: C++ Web Control Pin
kilt13-Oct-09 2:27
kilt13-Oct-09 2:27 
GeneralRe: C++ Web Control Pin
Richard MacCutchan13-Oct-09 2:58
mveRichard MacCutchan13-Oct-09 2:58 
QuestionGreek letter in a dialog Pin
Gagnon Claude11-Oct-09 6:06
Gagnon Claude11-Oct-09 6:06 
AnswerRe: Greek letter in a dialog Pin
Richard MacCutchan11-Oct-09 7:27
mveRichard MacCutchan11-Oct-09 7:27 
AnswerRe: Greek letter in a dialog Pin
CPallini11-Oct-09 11:34
mveCPallini11-Oct-09 11:34 
QuestionClosing CDialog when it looses the focus Pin
msn9211-Oct-09 5:08
msn9211-Oct-09 5:08 
AnswerRe: Closing CDialog when it looses the focus Pin
Iain Clarke, Warrior Programmer11-Oct-09 5:24
Iain Clarke, Warrior Programmer11-Oct-09 5:24 
GeneralRe: Closing CDialog when it looses the focus Pin
msn9211-Oct-09 7:35
msn9211-Oct-09 7:35 
GeneralRe: Closing CDialog when it looses the focus Pin
Joe Woodbury11-Oct-09 7:57
professionalJoe Woodbury11-Oct-09 7:57 
GeneralRe: Closing CDialog when it looses the focus Pin
msn9211-Oct-09 10:35
msn9211-Oct-09 10:35 
GeneralRe: Closing CDialog when it looses the focus Pin
Joe Woodbury11-Oct-09 10:46
professionalJoe Woodbury11-Oct-09 10:46 
GeneralRe: Closing CDialog when it looses the focus Pin
David Crow11-Oct-09 16:50
David Crow11-Oct-09 16:50 
GeneralRe: Closing CDialog when it looses the focus Pin
Iain Clarke, Warrior Programmer11-Oct-09 20:37
Iain Clarke, Warrior Programmer11-Oct-09 20:37 
GeneralRe: Closing CDialog when it looses the focus Pin
msn9213-Oct-09 15:18
msn9213-Oct-09 15:18 
LOLz, Yes I've really missed it! Big Grin | :-D
Thanks man!

All I need is to override OnNcDestroy() and OnLButtonUp(), and it's working!!!

BOOL COptionsDlg::OnInitDialog()
{
	CDialog::OnInitDialog();
	SetCapture();//Thank you Iain
	return TRUE;
}

void COptionsDlg::OnNcDestroy()
{//Thanks to DavidCrow
	CDialog::OnNcDestroy();
	delete this;
}

void COptionsDlg::OnLButtonUp(UINT nFlags, CPoint point)
{//Thanks to Iain
	CDialog::OnLButtonUp(nFlags,point);
	CRect rect;
	this->GetWindowRect(rect);
	DWORD pos=GetMessagePos();
	point=CPoint(LOWORD(pos),HIWORD(pos));
	if(!rect.PtInRect(point)){this->DestroyWindow();}//close only if click was outside of the window
}


Thank you Iain and DavidCrow!!! Big Grin | :-D

And one last question: How do I exchange data between my main window and that dialog I show?
GeneralRe: Closing CDialog when it looses the focus Pin
Iain Clarke, Warrior Programmer13-Oct-09 21:28
Iain Clarke, Warrior Programmer13-Oct-09 21:28 
GeneralRe: Closing CDialog when it looses the focus Pin
msn9217-Oct-09 7:29
msn9217-Oct-09 7:29 
GeneralRe: Closing CDialog when it looses the focus Pin
Iain Clarke, Warrior Programmer17-Oct-09 7:48
Iain Clarke, Warrior Programmer17-Oct-09 7:48 
GeneralRe: Closing CDialog when it looses the focus Pin
msn9231-Oct-09 19:41
msn9231-Oct-09 19:41 

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.