
Thu, 10/23/2014 - 04:06
Hello,
I'm having a problem with the viewing window on my program. The window opens normally and displays the desired model (IGES), but when I move the mouse cursor over it, the mouse icon changes to that of the "busy" icon. If I click on the window, the program stops responding.
It's a Win 32 console app, running on a 64-bit Win 8.1 using Visual Studio Exp 2013 for Win Desktop.
I tried using VS's local windows debugger, but when I do so the program doesn't crash when I click on the window. The window remains unresponsive, and because there was no crash, nothing appears on the debugger for me to investigate.
Here is a simplified version of the relevant portion of the code. Any clues? I plan to include mouse events for model manipulation, so i can't have this problem happening.
Thanks in advance.
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/*
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
int main(void){
//Create a Graphic Driver from the default Aspect_DisplayConnection
Handle(Aspect_DisplayConnection) aDisplayConnection;
Handle(Graphic3d_GraphicDriver) myGraphicDriver = Graphic3d::InitGraphicDriver(aDisplayConnection);
// Creates a viewer
Handle(V3d_Viewer)aViewer = new V3d_Viewer(myGraphicDriver, (short const*)"Viewer");
aViewer->SetDefaultLights();
aViewer->SetLightOn();
// Creates an interactive context
Handle(AIS_InteractiveContext)aContext = new AIS_InteractiveContext(aViewer);
// Creates and opens a window
Handle(WNT_WClass) myWClass = new WNT_WClass((char*)L"some_class_fdfdddd", NULL, 0);
Handle(WNT_Window) aWindow = new WNT_Window("Teste Inicial", myWClass, 1, 1, 1, 600, 600, Quantity_NOC_MATRAGRAY, 0, 0, 0);
aWindow->Map();
// Creates a view from the viewer, and maps the view to the previously created window
Handle(V3d_View) aView = aViewer->CreateView();
aViewer->SetViewOn(aView);
aView->SetWindow(aWindow);
return 0;
}
*/
Fri, 10/24/2014 - 09:23
Solved. Well, not SOLVED, but I got around it. I had to change the line:
Handle(WNT_Window) aWindow = new WNT_Window("Teste Inicial", myWClass, 1, 1, 1, 600, 600, Quantity_NOC_MATRAGRAY, 0, 0, 0);
and use instead:
Handle(WNT_Window) aWindow = new WNT_Window(Hnwd);
Where Hnwd was created based on the code I found on the following link:
http://www.sysnative.com/forums/programming/5221-%5Bc-%5D-console-applic...
So basically I had to abandon the OCCT window creation method for the less easy Win32 API one.
Thanks!