/* Terminate the API environment */
errorCode = UF_terminate();
}
/* Print out any error messages */
//PrintErrorMessage( errorCode );
}
VC中的环境设置如下
project->setting->debug->excecutable for debug session = ugraf.exe
// Unigraphics Startup
// This entry point activates the application at Unigraphics startup
extern "C" DllExport void ufsta( char *param, int *returnCode, int rlen )
{
/* Initialize the API environment */
int errorCode = UF_initialize();
/* TODO: Add your application code here */
/* TODO: Add your application code here */
UF_PART_load_status_t error_status;
/* Terminate the API environment */
errorCode = UF_terminate();
}
/* Print out any error messages */
//PrintErrorMessage( errorCode );
/* Terminate the API environment */
errorCode = UF_terminate();
/* Print out any error messages */
 rintErrorMessage( errorCode );
}
// Unload Handler
// This function specifies when to unload your application from Unigraphics.
// If your application registers a callback (from a MenuScript item or a
// User Defined Object for example), this function MUST return
// "UF_UNLOAD_UG_TERMINATE".
extern "C" int ufusr_ask_unload( void )
{
return( UF_UNLOAD_UG_TERMINATE );
}
/* PrintErrorMessage
**
** Prints error messages to standard error and the Unigraphics status
** line. */
static void PrintErrorMessage( int errorCode )
{
if ( 0 != errorCode )
{
/* Retrieve the associated error message */
char message[133];
UF_get_fail_message( errorCode, message );
/* Print out the message */
UF_UI_set_status( message );
// Construct a buffer to hold the text.
ostrstream error_message;
// Initialize the buffer with the required text.
error_message << endl
<< "Error:" << endl
<< message
<< endl << endl << ends;
// Write the message to standard error
cerr << error_message.str();
}
}
这是程序的全部内容,运行后出现下列对话框:作者: jinbit 时间: 2004-7-17 21:55
这个对话框写着:
please specify the executable file
然后我点击了下面的按钮.有三个选项:分别是 browse, active control test comtainer,--我选择了BROWSE,然后在UG11里选择了ugraf可执行文件.
结果是只打开了UG 的环境.
我的目的是不出现这个对话框直接打开UG文件;
不知毛病出在那里.另外我的项目的建立都是在默认状态下完成的.
让您费心了/作者: jinbit 时间: 2004-7-17 21:56
我的也是NX1.0作者: haiying 时间: 2004-7-18 11:17
试试在UG环境下 File->Execute UG/open->user Function,执行你生成的dll文件。