WNT window excutes and terminates

Hi All,

That question may sound a bit silly but how do you stop console application from exiting, bcoz following working code immediately executes the code and exits, where I was waiting it to be interact with the end user.

My code is as follow :



int main(void)
Handle_V3d_Viewer myViewer;
Handle(Graphic3d_GraphicDriver) m_GraphicDriver;
if ( m_GraphicDriver.IsNull() )
Handle(Aspect_DisplayConnection) displayConnection;
m_GraphicDriver = new OpenGl_GraphicDriver (displayConnection);

myViewer = new V3d_Viewer(m_GraphicDriver, Standard_ExtString("Visu3D"));

// Creates an interactive context
Handle(AIS_InteractiveContext)aContext = new AIS_InteractiveContext(myViewer);

Handle(WNT_WClass) myWClass = new WNT_WClass((char*)L"some_class_fdfdddd", NULL, 0);
Handle(WNT_Window) aWindow = new WNT_Window("Teste Inicial", myWClass, 0, 1, 1, 400, 400, Quantity_NOC_MATRAGRAY, 0, 0, 0);

Handle(V3d_View) aView = myViewer->CreateView();

Standard_Real dx = 50; //Parameters
Standard_Real dy = 50; //to build a box
Standard_Real dz = 50;
BRepPrimAPI_MakeBox w(dx, dy, dz);
//BRepPrimAPI_MakeCylinder c(dx
TopoDS_Solid S = w.Solid();
Handle(AIS_Shape) anAis = new AIS_Shape(S);

//Display the presentable object in the 3D viewer.

cout return 1;

Rodrigo Castro Andrade's picture

Hello Sonya,

You could try the basic cin attempt:

int x;
cin >> x;

However you should you will only be able to view the object on screen, without being able to interact with that. For that you will need do deal with Win32 API window events.

Good Luck

Shing Liu's picture

Hello Sonya,

I found the answer in StackOverflow: