Open/Save

Hi:
I imitate the TSampleOcaf_Application in the SampleOCAf to my program. I just renamed it to be TStars_Application. I don't get it why it works fine in Opencase 3.0; but, not in 4.0. I took off
/*
SetEnvironmentVariable ( "CSF_ResourcesUserDefauls",szDirectory);
sprintf(szString,"CSF_ResourcesUserDefauls=%s",szDirectory);
putenv (szString);
cout

SetEnvironmentVariable ( "CSF_PluginUserDefauls",szDirectory);
sprintf(szString,"CSF_PluginUserDefauls=%s",szDirectory);
putenv (szString);
cout and set 4 variables in system
CSF_PluginDefauls=d:\opencascade\src\StdResource\Plugin
CSF_PluginUserDefauls=d:\opencascade\src\StdResource\Plugin
CSF_ResourcesDefauls=d:\opencascade\src\StdResource\Standard
CSF_ResourcesUserDefauls=d:\opencascade\src\StdResource\Standard

The compile and execution are good. When I try to open/save it. It couldn't make it. I don't know why??? thanks a lot

try
{ myGraphicDevice = new Graphic3d_WNTGraphicDevice(); }
catch (Standard_Failure)
{
AfxMessageBox("Fatal Error in graphic initialisation");
}

char szString [256] ;
char szDirectory [256] ;

_getcwd (szDirectory,sizeof szDirectory);
if (szDirectory[strlen(szDirectory)-1] != '\\') {
strcat(szDirectory,"\\");
}
/*
SetEnvironmentVariable ( "CSF_ResourcesDefaults",szDirectory);
sprintf(szString,"CSF_ResourcesDefaults=%s",szDirectory);
putenv (szString);
cout

SetEnvironmentVariable ( "CSF_PluginDefaults",szDirectory);
sprintf(szString,"CSF_PluginDefaults=%s",szDirectory);
putenv (szString);
cout myApp = new TStars_Application();

// Set the local system units
try
{ UnitsAPI::SetLocalSystem(UnitsAPI_MDTV); }
catch (Standard_Failure)
{
AfxMessageBox("Fatal Error in units initialisation");
}

thanks a lot.

Sincerely
shawn

Canziani Paolo's picture

I have the same problem in Xp / Vc7 .
The release version (not recompiled) works.
If I compile even the sample code not motified open/save doesn'work.
I have the problem in
CsampleOcafDoc::OnOpenDocument

....

TPrsStd_AISViewer::New(myOcafDoc),myViewer);