Hi guys, I've made a GUI for my program as a resource file, and have created a button to display the instructions on how to use it. However, I do not know how to make the popup for the instructions appear when I click the button.
I have created the instructions dialog box in the "dialog" folder of the resource(.rc) as well and named it "IDD_Instructions - Dialog"
The empty button code is below. The instructions dialog also has an "OK" button that should close the pop-up when pressed called "IDOK (Button Control)"
1 2 3 4 5
void CzebraDlg::OnBnClickedinstructions()
{
}
Thanks in advance for the help. I'm new to GUIs in general in C++.
If you are using MFC, then you can use the CDialog class to load the and display the dialog.
Or if you are using the WIN APi, you have the CreateDialog function to load a modeless
dialog or the DialogBox function to load a modal dialog box.
class CInstructionsDlg : public CDialog //Class for instructions dialog
{
public:
CInstructionsDlg() :CDialog(IDD) {} //*******Updated constructor
// Dialog Data
enum { IDD = IDD_Instructions };
//protected: //*** Leave this out for time being
//virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
// Implementation //** Leave this out for time being
//protected:
//DECLARE_MESSAGE_MAP()
};
1 2 3 4 5
void CzebraDlg::OnBnClickedInstructions()
{
CInstructionsDlg cid; //*** Create an instance of our dialog
cid.DoModal(); //Display Dialog box
}
By the way is IDD_Instructions the actual identifier of your dialog - or is that the title of the dialog - don't get the two things mixed up.
Hi there, thanks a lot for your help, I am able to get the pop-up to appear now. IDD_Instructions is the actual identifier under the "Dialog" folder. The title on the window just reads "Instructions".
To create the class, I did the management myself with some reference to a program my friend wrote, but did not run the pop-up. After tweaking it, it still gave me the same problems.
Thanks a lot again for your help, if I need to create other pop-ups I should know how now. :)