Hi
I am using visual C++ 2010
My dialog include button and using event handler I am jumping to request function my problem is that:
When I am going back I need to go back directly to specific point.
How can I do it? longjump?

Main()
{
.
.
.
Back to here
.
.
.
	}

void CEnglishDlg::OnStnClicked1()
{
.
.
.
.
.
Return back

}

Everything in MFC is handled via events -- messages that are passed through the event handler (Windows Message Pump)located in an MFC function that is called from main(). OnStnClicked() will not be called until program control returns back to that message pump. When OnStnClicked() returns, program control is returned back to MFC internals, not the part of the program that you are writing.

longjmp() is not supported in c++ (not related to MFC).

Edited 6 Years Ago by Ancient Dragon: n/a

In MFC or any other GUI library, things are Event Driven which mean that the execution of the program is not your typical main_while_loop type of thing you find in procedural programming. Your application is simply reacting to events (handling) as they come, so your question is a bit bizarre, it seems you are trying to mix event-driven execution with procedural execution. You can have both, but on separate threads of execution (in fact that's what happens by default because starting up Windows Message Pump will start a thread of its own (and actually several threads) to handle the incoming events and messages).

So for things to look at for achieving whatever goal to which this jumping problem is a problem for. I suggest looking into the topics of: state machines for GUIs, multi-threading (that goes without saying), and issuing user-defined windows message.

A simple example of what? We need to know your exact requirements before we can make any worthwhile suggestions.

Hi Dragon
my projects contain 5 lines of 4 buttons:
in the begining I enable the first line only : the user push on one of them, make them disable and enable the second line until the fifth line.

I read several articles about the message handling functions and message loop like

http://www.codeproject.com/KB/dialog/messagehandling.aspx
http://www.winprog.org/tutorial/message_loop.html

But I don’t know how to use them in my projects. can you give me direction?

This article has been dead for over six months. Start a new discussion instead.