购买与咨询 NX 二次开发视频教程,请联系微信号:13890821008  QQ号:85585969  								
								
								
								
								函数结构:ufusr_cleanup函数说明:用户提供的日常清理用户的功能程序之前卸载。如果在你的源代码中定义NX调用这个入口点。前一个共享库的入口点是立即调用卸载并允许您执行所必须的清理任务在NX进行。例如,如果你的内部程序打开你可以使用调用数据库程序ufusr_cleanup为契机,关闭所有打开的数据库文件之前的图像被卸载。注意:您结合使用ufusr_cleanup与ufusr_ask_unload。如果你的代码ufusr_cleanup没有定义ufusr_ask_unload,然后在ufusr_cleanup入口点被忽略。 ufusr_cleanup函数实例代码演示:
[quote]
#include <uf.h>
#include <stdio.h>
 #define UF_CALL(X) (report( __FILE__, __LINE__, #X, (X)))
 static int report( char *file, int line, char *call, int irc)
 {
   if (irc)
   {
       char    messg[133];
       printf("%s, line %d:  %s\n", file, line, call);
       (UF_get_fail_message(irc, messg)) ?
           printf("    returned a %d\n", irc) :
           printf("    returned error %d:  %s\n", irc, messg);
   }
   return(irc);
 }
 static void do_ugopen_api(void)
 {
 char *ptr;
 
 UF_CALL(UF_set_variable("UGII_NEW_VARIABLE", "value"));
 UF_CALL(UF_translate_variable("UGII_NEW_VARIABLE", &ptr));
 printf("value of UGII_NEW_VARIABLE is : %s\n", ptr);
  }
 void ufusr(char *param, int *retcode, int paramLen)
 {
   if (!UF_CALL(UF_initialize()))
   {
       do_ugopen_api();
       UF_CALL(UF_terminate());
   }
 }
 int ufusr_ask_unload(void)
 {
   return (UF_UNLOAD_IMMEDIATELY);
 }
  void ufusr_cleanup(void)
 {
    /* Perform cleanup *
 }
[/quote]