Click here to Skip to main content
15,886,963 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: quine mccluskey method on C/C++ Pin
Richard MacCutchan2-Oct-14 5:17
mveRichard MacCutchan2-Oct-14 5:17 
JokeRe: quine mccluskey method on C/C++ Pin
CPallini2-Oct-14 7:21
mveCPallini2-Oct-14 7:21 
GeneralRe: quine mccluskey method on C/C++ Pin
Richard MacCutchan2-Oct-14 7:30
mveRichard MacCutchan2-Oct-14 7:30 
GeneralRe: quine mccluskey method on C/C++ Pin
Reuben Cabrera2-Oct-14 21:41
Reuben Cabrera2-Oct-14 21:41 
AnswerRe: quine mccluskey method on C/C++ Pin
Reuben Cabrera2-Oct-14 21:35
Reuben Cabrera2-Oct-14 21:35 
GeneralRe: quine mccluskey method on C/C++ Pin
Richard MacCutchan2-Oct-14 21:45
mveRichard MacCutchan2-Oct-14 21:45 
GeneralRe: quine mccluskey method on C/C++ Pin
Reuben Cabrera2-Oct-14 23:03
Reuben Cabrera2-Oct-14 23:03 
QuestionMFC- receiving Button-Click-Message failed Pin
Member 111256242-Oct-14 4:05
Member 111256242-Oct-14 4:05 
I've created a new dialog in my MFC dialog based application. the new dialog contains 5 control buttons.

the following happens and I don't understand why?
(buttonX is any button).

1. click on buttonX. (result ok, OnBnClicked message is sent)
2. click on on any place of the application, but not on the dialog. (removing focus from dialog)
3. click again on buttonX (FAILED, OnBnClicked message is NOT sent). but if instead I click on any other button in the dialog (result ok, OnBnClicked message is sent).

and when I do:

1. ...
2. ...
3. click on the dialog area just to set focus on the dialog again
4. click again on buttonX. (result ok, OnBnClicked message is sent)

(*) I need to do step 3 only if I want to click again on the buttonX! why??

I think it related to SetFocus() but I m not sure how.

CSS
the buttons IDC are: IDC_BACK_MEDIA_PRESS_BUTTON 1180 IDC_TOOLS_LEFT_RIGHT 1024 IDC_MEDIA_FOREWARD_BUTTON 1103 IDC_MEDIA_BACKWARD_BUTTON 1104 IDC_TOOLS_HOOD_BUTTON 2346

the dialog properties is:

IDD_TOOLS_DIALOG DIALOGEX 0, 0, 51, 218 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Tools" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN PUSHBUTTON "Media &Foreward",IDC_MEDIA_FOREWARD_BUTTON,7,79,37,36,BS_MULTILINE PUSHBUTTON "&Media &BackWard",IDC_MEDIA_BACKWARD_BUTTON,7,43,37,36,BS_MULTILINE PUSHBUTTON "Back Media Press",IDC_BACK_MEDIA_PRESS_BUTTON,7,127,37,36,BS_MULTILINE | NOT WS_VISIBLE PUSHBUTTON "Hood",IDC_TOOLS_HOOD_BUTTON,7,7,37,36 PUSHBUTTON "Left Right",IDC_TOOLS_LEFT_RIGHT,7,175,37,36 END



I've tried different style like, tool windows, overlapped, popup. it happens in all the cases.

Thanks for the help.

.h
<pre>

class CToolsDlg : public CBDialog
{
DECLARE_DYNAMIC(CToolsDlg)

public:
CToolsDlg(CWnd* pParent = NULL); // standard constructor
virtual ~CToolsDlg();
CToolTipCtrl m_ToolsTips;

// Dialog Data
enum { IDD = IDD_TOOLS_DIALOG };

protected:
virtual void OnCancel();
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support

DECLARE_MESSAGE_MAP()
public:
CMFCButton m_HoodButton;
CMFCButton m_MediaForewardButton;
CMFCButton m_MediaBackwardButton;
CMFCButton m_LeftRightButton;
virtual BOOL OnInitDialog();
virtual BOOL PreTranslateMessage(MSG* pMsg);

afx_msg void OnTimer(UINT_PTR nIDEvent);
afx_msg void OnBnClickedCancel();
afx_msg void OnBnClickedToolsHoodButton();
afx_msg void OnBnClickedMediaForewardButton();
afx_msg void OnBnClickedMediaBackwardButton();
afx_msg void OnBnClickedLeftRightButton();
afx_msg void OnBnClickedBackMediaPressButton();
};
.cpp

IMPLEMENT_DYNAMIC(CToolsDlg, CBDialog)

CToolsDlg::CToolsDlg(CWnd* pParent /*=NULL*/)
: CBDialog(CToolsDlg::IDD, pParent)
{

}
CToolsDlg::~CToolsDlg()
{
}
void CToolsDlg::DoDataExchange(CDataExchange* pDX)
{
CBDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_TOOLS_HOOD_BUTTON, m_HoodButton);
DDX_Control(pDX, IDC_MEDIA_FOREWARD_BUTTON, m_MediaForewardButton);
DDX_Control(pDX, IDC_MEDIA_BACKWARD_BUTTON, m_MediaBackwardButton);
DDX_Control(pDX, IDC_TOOLS_LEFT_RIGHT, m_LeftRightButton);
}


BEGIN_MESSAGE_MAP(CToolsDlg, CBDialog)
ON_WM_CLOSE()
ON_WM_DESTROY()
ON_WM_TIMER()
ON_BN_CLICKED(IDC_TOOLS_HOOD_BUTTON, &CToolsDlg::OnBnClickedToolsHoodButton)
ON_BN_CLICKED(IDC_MEDIA_FOREWARD_BUTTON, &CToolsDlg::OnBnClickedMediaForewardButton)
ON_BN_CLICKED(IDC_MEDIA_BACKWARD_BUTTON, &CToolsDlg::OnBnClickedMediaBackwardButton)
ON_BN_CLICKED(IDC_TOOLS_LEFT_RIGHT, &CToolsDlg::OnBnClickedLeftRightButton)
ON_BN_CLICKED(IDC_BACK_MEDIA_PRESS_BUTTON, &CToolsDlg::OnBnClickedBackMediaPressButton)
END_MESSAGE_MAP()


// CToolsDlg message handlers

BOOL CToolsDlg::OnInitDialog()
{
CBDialog::OnInitDialog();

// Window position
//////////////////////////////////////////////////////////////////////////
CMainFrame* mf = (CMainFrame*)AfxGetMainWnd();
RECT MFwinRect;
RECT ThiswinRect;
CWnd* fv = mf->m_wndSplitter.GetView( mf->m_wndSplitter.GetCurrentViewIndex(0,0) );
fv->GetWindowRect(&MFwinRect);
GetWindowRect(&ThiswinRect);
MoveWindow(
MFwinRect.right - (ThiswinRect.right - ThiswinRect.left) - 14, // X
MFwinRect.top + 14, // Y
(ThiswinRect.right - ThiswinRect.left), // nWidth
(ThiswinRect.bottom - ThiswinRect.top) ); // nHeight

// Set controls state
//////////////////////////////////////////////////////////////////////////
m_ToolsTips.Create(this);
m_ToolsTips.AddTool(&m_HoodButton, TOOLTIP_HOOD_BUTTON);
m_ToolsTips.AddTool(&m_MediaForewardButton, TOOLTIP_MEDIA_FOREWARD_BUTTON);
m_ToolsTips.AddTool(&m_MediaBackwardButton, TOOLTIP_MEDIA_BACKWARD_BUTTON);
m_ToolsTips.AddTool(&m_LeftRightButton, TOOLTIP_LEFT_RIGHT_BUTTON);
m_ToolsTips.SetDelayTime(1000);
m_ToolsTips.Activate(BARAK_PREFS->m_Params.m_bShowToolTips);

// Main timer loop (no need for now)
// SetTimer( 1, 1000, NULL );
return TRUE;
}

BOOL CToolsDlg::PreTranslateMessage(MSG* pMsg)
{
m_ToolsTips.RelayEvent(pMsg);

return CBDialog::PreTranslateMessage(pMsg);
}

void CToolsDlg::OnCancel()
{
// When closing the window, destroy it and not only hide (its a floating window).
DestroyWindow();
}

void CToolsDlg::OnTimer(UINT_PTR nIDEvent)
{
CBDialog::OnTimer(nIDEvent);
}

void CToolsDlg::OnBnClickedToolsHoodButton()
{
...
}

void CToolsDlg::OnBnClickedMediaForewardButton()
{
...
}

void CToolsDlg::OnBnClickedMediaBackwardButton()
{
...
}

void CToolsDlg::OnBnClickedLeftRightButton()
{
...
}

void CToolsDlg::OnBnClickedBackMediaPressButton()
{
...
}
AnswerRe: MFC- receiving Button-Click-Message failed Pin
Richard Andrew x642-Oct-14 10:47
professionalRichard Andrew x642-Oct-14 10:47 
GeneralRe: MFC- receiving Button-Click-Message failed Pin
Member 111256243-Oct-14 1:15
Member 111256243-Oct-14 1:15 
Questionreplace malloc by new Pin
_Flaviu2-Oct-14 2:32
_Flaviu2-Oct-14 2:32 
AnswerRe: replace malloc by new Pin
_Flaviu2-Oct-14 3:02
_Flaviu2-Oct-14 3:02 
Questionhow to utilize "(int argc, const char * argv[]) " in a program Pin
Stefan611-Oct-14 13:25
Stefan611-Oct-14 13:25 
AnswerRe: how to utilize "(int argc, const char * argv[]) " in a program Pin
enhzflep1-Oct-14 19:59
enhzflep1-Oct-14 19:59 
AnswerRe: how to utilize "(int argc, const char * argv[]) " in a program Pin
CPallini1-Oct-14 22:03
mveCPallini1-Oct-14 22:03 
QuestionIs it possible to bind the "this" pointer Pin
elelont230-Sep-14 20:30
elelont230-Sep-14 20:30 
AnswerRe: Is it possible to bind the "this" pointer Pin
CPallini30-Sep-14 21:48
mveCPallini30-Sep-14 21:48 
AnswerRe: Is it possible to bind the "this" pointer Pin
CubbiMew1-Oct-14 16:42
CubbiMew1-Oct-14 16:42 
QuestionOnly Desktop capturing without some active windows or capture only Desktop i.e Desktop Background and Icons Pin
narmadha_s30-Sep-14 2:53
narmadha_s30-Sep-14 2:53 
QuestionRe: Only Desktop capturing without some active windows or capture only Desktop i.e Desktop Background and Icons Pin
Richard MacCutchan30-Sep-14 6:04
mveRichard MacCutchan30-Sep-14 6:04 
AnswerRe: Only Desktop capturing without some active windows or capture only Desktop i.e Desktop Background and Icons Pin
narmadha_s6-Oct-14 19:33
narmadha_s6-Oct-14 19:33 
GeneralRe: Only Desktop capturing without some active windows or capture only Desktop i.e Desktop Background and Icons Pin
Richard MacCutchan6-Oct-14 21:13
mveRichard MacCutchan6-Oct-14 21:13 
AnswerRe: Only Desktop capturing without some active windows or capture only Desktop i.e Desktop Background and Icons Pin
David Crow30-Sep-14 9:25
David Crow30-Sep-14 9:25 
GeneralRe: Only Desktop capturing without some active windows or capture only Desktop i.e Desktop Background and Icons Pin
narmadha_s6-Oct-14 19:42
narmadha_s6-Oct-14 19:42 
AnswerRe: Only Desktop capturing without some active windows or capture only Desktop i.e Desktop Background and Icons Pin
David Crow7-Oct-14 2:24
David Crow7-Oct-14 2:24 

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.