【NX二次开发】NX内部函数,获取附加UG标题字符

NX内部函数,获取附加UG标题字符

如果附加标题是中文则会乱码0.0

源码:

#include <windows.h> 
#include <stdio.h> 

extern DllExport void ufusr(char *param, int *returnCode, int rlen)
{
    UF_initialize();

    char function_name[257] = "";
    strcpy(function_name, "?MT_ask_appended_ug_title@@YAPEADXZ");

    typedef char *(*load_ufusr_f_p_t)(void);
    load_ufusr_f_p_t load_ufusr_ptr = NULL;
    char* file_path = "D:\\Program Files\\Siemens\\NX 12.0\\NXBIN\\libugui.dll";
    UF_load_library(file_path, function_name, (UF_load_f_p_t *)& load_ufusr_ptr);
    if (load_ufusr_ptr != NULL)
    {
        string strTitleAppend = "";
        strTitleAppend = load_ufusr_ptr();
    
        char c1601[256]="";
        sprintf(c1601, "附加标题字符=%s", strTitleAppend.c_str());
        uc1601(c1601, 1);
    }
    else
    {
        uc1601("is_null", 1);
    }


    UF_terminate();
}
extern int ufusr_ask_unload(void)
{
    return (UF_UNLOAD_IMMEDIATELY);
}

效果:

 

posted @ 2020-12-08 17:13  王牌飞行员_里海  阅读(109)  评论(0编辑  收藏  举报