How to Debugging MFC code line by line (vc++ 6.0)

I have  Windows applications  using VC++6.0 and MFC  How to  check code  functionality  (Step Into a Specific Function)
For example
class CServerSettings : public CDialog
{
public:
	CServerSettings(CWnd* pParent = NULL);
enum { IDD = IDD_SERVERSETTINGS };
	CDateTimeCtrl	m_Time;
	CEdit	m_Sec;
	CEdit	m_Server;
	CEdit	m_Port;
	CEdit	m_MailServer;
	DECLARE_MESSAGE_MAP()
};

Open in new window

prashanth agsoftware engineer Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ZoppoCommented:
Hi prashanth ag,

it's not easy to find help for debugging with such an old IDE as VC++ 6.0, but it might anyway be helpful to read some guides for newer versions because the concepts didn't really change.

Just google for something like visual studio debugging tutorial to find some articles about this.

There's even a good article from phoffric here: http://www.experts-exchange.com/articles/2688/C-C-Beginner%27s-Debugging-Guide-using-Visual-Studio-2008-Express.html

BTW: The code you posted is a class declaration, not a function, so there's nothing to debug in there ...

ZOPPO
sarabandeCommented:
in vc6 you can set a breakpoint by setting the cursor to a source code line and then use the breakpoint toolbar button (you'll get the meaning by tooltip) to toggle the breakpoint on/off. you will get a red dot in the left margin of the line when the breakpoint is active.

see more at https://msdn.microsoft.com/en-us/library/aa265710%28v=vs.60%29.aspx#_asug_set_a_breakpoint_at_a_source.2d.code_line

for your dialog class you may override the OnInitDialog function and then set a breakpoint to first statement 'CDialog::OnInitDialog();' which calls the baseclass for to read the dialog form from resources and create the controls.

class CServerSettings : public CDialog
{
public:
	CServerSettings(CWnd* pParent = NULL);
        BOOL OnInitDialog();

enum { IDD = IDD_SERVERSETTINGS };
	CDateTimeCtrl	m_Time;
	CEdit	m_Sec;
	CEdit	m_Server;
	CEdit	m_Port;
	CEdit	m_MailServer;
	DECLARE_MESSAGE_MAP()
};

// serversettings.cpp 

...
BOOL CServerSettings::OnInitDialog()
{
      CDialog::OnInitDialog();

      return TRUE; // return TRUE  unless you set the focus to a control
}

Open in new window


when you start the program, the debugger would break in OnInitDialog function. in the toolbar area you should find debug tool buttons for to step into a call, step out of a function, step to next statement, step to cursor, and more. if some were missing you either could add the whole debug toolbar (right-click into a free space of the toolbar area and choose 'debug' from dropdown-list) or add individual debug toolbar buttons by 'customizing' an already existing toolbar.

Sara

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.