Building the Right Environment to Support AI, Machine Learning and Deep Learning
I am a Korean and not a native english speacker. Please, forgive my poor english.
I was very happy after finding Alger Pike's article, which is "A CDialogBar with OnInitDialog() and DDX Support".
I struggled so long time to solve the problem. At last I found www.codeguru.com and Alger Pike's article! Can you imagine my shout with greatest pleasure?
But I have an another problem. According to Alger Pike's explanation, I made my dialog bar. But every buttons on that bar don't work! Oopse....what can I do?
I asked Alger Pike that problem via email. He gave me a hint. It is that use CmdUI!
I have some confusions how I can use CmdUI in dialog bar. Probably you make sense already that I'm a novice to MFC. Yes, I am. But at last I soved the quiz.
I'll give my solution to you. Don't waste time for same problem with me.
Thanks again to Alger Pike and www.codeguru.com. Good luck for you and Alger Pike and www.codeguru.com.
Below is breif explanation about my solution. You can find complete source code at header file and source file for CMyDialogBar. CInitDialog is Alger Pike's class.
- Make Dialog Resource for your dialog bar
- Use resource editor provided by Visual C++
- Change style to child
- Change border to none (or as you wish)
- Make Dialog Class for your dialob bar
- Double click your dialog resource in resource editor
- then class wizard will ask if you will make new class, answer yes
- give name for your own dialog class
- go to class header file and change parent class from CDialog to CInitDialogBar
- Don't forget #include "InitDialogBar.h"
- go to class source file and replase all "CDialog" with "CInitDialogBar"
- Add below to header file for your dialog bar
Of coursely, you must change OnButton1() to your own function
void OnUpdateButton1(CCmdUI *pCmdUI);
afx_msg void OnButton1();
- Add below to your source file for your dialog bar
In OnUpdateButton1(), I set button enable always.
But you can enable and disable according to your need.
// TODO: Add your control notification handler code here
void CMyDialogBar::OnUpdateButton1(CCmdUI *pCmdUI)
- Don't forget to make InitDialogBar() function.
Below is my example.
In header file
virtual BOOL OnInitDialogBar();