Click here to Skip to main content
15,894,362 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Update only a part of a View with OnUpdateAllViews 2nd ! Pin
CrocodileBuck12-Jul-08 4:11
CrocodileBuck12-Jul-08 4:11 
QuestionRe: Update only a part of a View with OnUpdateAllViews 2nd ! Pin
David Crow12-Jul-08 7:38
David Crow12-Jul-08 7:38 
Questionstring table error Pin
erfi12-Jul-08 1:20
erfi12-Jul-08 1:20 
AnswerRe: string table error Pin
Bram van Kampen12-Jul-08 13:58
Bram van Kampen12-Jul-08 13:58 
QuestionCBitmapbutton Behaviour Pin
AnithaSubramani12-Jul-08 0:10
AnithaSubramani12-Jul-08 0:10 
AnswerRe: CBitmapbutton Behaviour Pin
Gary R. Wheeler12-Jul-08 3:16
Gary R. Wheeler12-Jul-08 3:16 
GeneralRe: CBitmapbutton Behaviour Pin
AnithaSubramani14-Jul-08 4:46
AnithaSubramani14-Jul-08 4:46 
GeneralRe: CBitmapbutton Behaviour Pin
Gary R. Wheeler14-Jul-08 9:37
Gary R. Wheeler14-Jul-08 9:37 
You might try something like this:
class CdfdgDlg
{
//...
private:
  bool HandlingEnterKey;
};
CdfdgDlg::CdfdgDlg()
  : HandlingEnterKey(false)
{
};
BOOL CdfdgDlg::PreTranslateMessage(MSG *pMsg)
{
  if((pMsg->message == WM_KEYDOWN) && (pMsg->wParam == VK_RETURN))
  {
    if (GetFocus() == &m_button4)
    {
       HandlingEnterKey = true;
       MessageBox(/* ... */);
       HandlingEnterKey = false;
    }
  }
  return CDialog::PreTranslateMessage(pMsg);
}
void CdfdgDlg::OnBnKillfocusButton4()//Method for Lost focus
{
  if (!HandlingEnterKey)
  {
    m_button4.LoadBitmaps(IDB_BITMAP1,NULL,IDB_BITMAP1,NULL);
    m_button4.Invalidate();
    m_button4.UpdateWindow();
  }
}
void CdfdgDlg::OnBnSetfocusButton4()//Method for Setfocus
{
  if (!HandlingEnterKey)
  {
    m_button4.LoadBitmaps(IDB_BITMAP2,NULL,IDB_BITMAP2,NULL);
    m_button4.Invalidate();
    m_button4.UpdateWindow();
  }
}
I'vd added a flag to your dialog class. This flag, HandlingEnterKey is set to true while you're displaying the message box. When it is true, the logic that changes the bitmaps on the buttons in the lose focus / get focus handlers will leave the bitmaps alone. If I understand correctly, this will do what you want.

Good luck.

Software Zen: delete this;
Fold With Us![^]

Questiontab controls in vc++ Pin
ani_ikram11-Jul-08 22:50
ani_ikram11-Jul-08 22:50 
AnswerRe: tab controls in vc++ Pin
sudhir_Kumar11-Jul-08 23:04
sudhir_Kumar11-Jul-08 23:04 
GeneralRe: tab controls in vc++ Pin
ani_ikram11-Jul-08 23:11
ani_ikram11-Jul-08 23:11 
GeneralRe: tab controls in vc++ Pin
sudhir_Kumar11-Jul-08 23:28
sudhir_Kumar11-Jul-08 23:28 
GeneralRe: tab controls in vc++ Pin
tkondal12-Jul-08 9:39
tkondal12-Jul-08 9:39 
Questionpls help newbi MFC VC++ reading from MDB Pin
GPat2411-Jul-08 22:21
GPat2411-Jul-08 22:21 
QuestionHow can fix size of SDI type application? Pin
Le@rner11-Jul-08 20:23
Le@rner11-Jul-08 20:23 
AnswerRe: How can fix size of SDI type application? Pin
sudhir_Kumar11-Jul-08 23:02
sudhir_Kumar11-Jul-08 23:02 
AnswerRe: How can fix size of SDI type application? Pin
krmed12-Jul-08 3:28
krmed12-Jul-08 3:28 
QuestionPrint Preview on SDI splitter application. Pin
Le@rner11-Jul-08 19:07
Le@rner11-Jul-08 19:07 
QuestionUnhandled exception at 0x5d0f0892 in Demo.exe: 0xC0000094: Integer division by zero. Pin
Le@rner11-Jul-08 18:22
Le@rner11-Jul-08 18:22 
AnswerRe: Unhandled exception at 0x5d0f0892 in Demo.exe: 0xC0000094: Integer division by zero. Pin
Cedric Moonen11-Jul-08 22:51
Cedric Moonen11-Jul-08 22:51 
Questionc code for image scaling Pin
md shafaeat hossain11-Jul-08 18:21
md shafaeat hossain11-Jul-08 18:21 
AnswerRe: c code for image scaling Pin
Sameerkumar Namdeo11-Jul-08 18:59
Sameerkumar Namdeo11-Jul-08 18:59 
AnswerRe: c code for image scaling Pin
Ștefan-Mihai MOGA11-Jul-08 21:22
professionalȘtefan-Mihai MOGA11-Jul-08 21:22 
AnswerRe: c code for image scaling Pin
CPallini11-Jul-08 22:01
mveCPallini11-Jul-08 22:01 
QuestionWhich IPC mechanism should be used? Pin
Sameerkumar Namdeo11-Jul-08 18:06
Sameerkumar Namdeo11-Jul-08 18:06 

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.