Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Win32 (http://www.go4expert.com/forums/win32/)
-   -   How can I start programming this program ? (http://www.go4expert.com/forums/i-start-programming-program-t4250/)

domain 9May2007 19:11

How can I start programming this program ?
 
Hi everyone,
I was asked to write a program with MFC. It's about Linked List .
This is how I would start :


http://my.mail299.googlepages.com/GV01.jpg

When the user press button EXIT, the program should terminate ( How can I do that ? ).

When the user press button Singly linked list, the program should open another Dialog ( #2 ) and the others the same ( How can I do that ? ).

domain 9May2007 19:14

Re: How can I start programming this program ?
 
To be more clear, What Should I Write In This Function :

PHP Code:

void CTetDlg::OnButton1() 
{
    
// TODO: Add your control notification handler code here
    


While the Button1 points to EXIT button ?

domain 9May2007 19:25

Re: How can I start programming this program ?
 
OK, I figure it out :

PHP Code:

 void CTetDlg::OnButton1()
{
    exit(
1);
    



domain 9May2007 19:30

Re: How can I start programming this program ?
 
Note: the program I'm creating is based on Dialogs only.

Now, I want to fox in creating a SLL Dialog , which should appears when I press the Singly linked list button on the First Dialog.

This is the function for button 3 :

PHP Code:

void CTetDlg::OnButton3() 
{
    
// TODO: Add your control notification handler code here
    
SLL newSll;
    


That does not work, even when I created a SLL class, this the header file for SLL class:

PHP Code:

#if !defined(AFX_SLL_H__4C827A8A_AB05_4879_8765_3161DEFA7142__INCLUDED_)
#define AFX_SLL_H__4C827A8A_AB05_4879_8765_3161DEFA7142__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// SLL.h : header file
//

/////////////////////////////////////////////////////////////////////////////
// SLL dialog

class SLL : public CDialog
{
// Construction
public:
    
SLL(CWndpParent NULL);   // standard constructor

// Dialog Data
    //{{AFX_DATA(SLL)
    
enum IDD IDD_PROPPAGE_MEDIUM };
        
// NOTE: the ClassWizard will add data members here
    //}}AFX_DATA


// Overrides
    // ClassWizard generated virtual function overrides
    //{{AFX_VIRTUAL(SLL)
    
protected:
    
virtual void DoDataExchange(CDataExchangepDX);    // DDX/DDV support
    //}}AFX_VIRTUAL

// Implementation
protected:

    
// Generated message map functions
    //{{AFX_MSG(SLL)
    
afx_msg void OnButton7();
    
afx_msg void OnButton1();
    
afx_msg void OnButton2();
    
afx_msg void OnButton3();
    
afx_msg void OnButton4();
    
//}}AFX_MSG
    
DECLARE_MESSAGE_MAP()
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_SLL_H__4C827A8A_AB05_4879_8765_3161DEFA7142__INCLUDED_) 

So, what should I do ? :confused:

domain 9May2007 20:07

Re: How can I start programming this program ?
 
Where are you people ? :( I need help really ..

Here you are what I have done by now ( Just designing, I don not know how to write commands to open or close or to call ...etc ):

http://my.mail299.googlepages.com/vc04.gif

http://my.mail299.googlepages.com/vc03.gif

http://my.mail299.googlepages.com/vc02.gif

http://my.mail299.googlepages.com/vc01.gif

Now, I want the IDD_SLL_DIALOG opens when I press SLL button & create a new SLL object ( I have the code for it but I don not know where should I put it ).

And, when I press EXIT button ( on IDD_SLL_DIALOG ) I want the program return to IDD_TET_DIALOG not ending the whole program.

shabbir 9May2007 21:53

Re: How can I start programming this program ?
 
Now it Looks you already have everything ready and done. Just double click on the button and it will add the necessary handler to the button by the studio wizard.

domain 9May2007 22:12

Re: How can I start programming this program ?
 
Thank you Mr.Shabbir for the reply :)

I do not know how to do this :
Quote:

Now, I want the IDD_SLL_DIALOG opens when I press SLL button & create a new SLL object ( I have the code for it but I don not know where should I put it ).
could you please help me by using the previous information in reply #5 ?

shabbir 9May2007 23:03

Re: How can I start programming this program ?
 
You need to add the code in the button handler which is generated with the IDE as I mentioned above.

For quiting the application you can do lots of things

1. Use API DestroyWindow
2. Use API PostQuitMessage
3. Send the WM_CLOSE message to the window
4. Use EndDialog API.

domain 13May2007 13:43

Re: How can I start programming this program ?
 
PHP Code:

You need to add the code in the button handler which is generated with the IDE as I mentioned above

Could you please tell me what code should I add ?
I tried this :

PHP Code:

SLL dlg;
dlg.DoModal();
if ( 
dlg.DoModal() == IDCOK )
        
AfxMessageBox(_T("Its OK!")); 

and the compiler didn't show me any error, although, the program crashed when I pressed SLL button !

shabbir 13May2007 19:06

Re: How can I start programming this program ?
 
If you wrote the following
Code:

SLL dlg;
dlg.DoModal();

and the compiler crashed means something somewhere is terribly wrong because the DoModal on the object should not be crashing unless you have some code in the dialog to be doing the crashing. Check the code you have edited in the InitDialog or OnCreate / PreCreate dialog handler ....


All times are GMT +5.5. The time now is 21:56.