iCAx开思网

标题: NX Open 对话框编译错误 [打印本页]

作者: zishuiyang    时间: 2011-7-26 11:51
标题: NX Open 对话框编译错误
我使用NX7.5 Block Style创建的对话框,生成语言为C++, 可是在代码编译时在
  30      TextDlg::theUI = UI::GetUI();
  31      theDialogName = "TextDlg.dlx";
  32      theDialog = TextDlg::theUI->CreateDialog(theDialogName.c_str());
在32行出现如下错误
error C2059: syntax error : ',' c:\program files (x86)\ugs\nx 6.0\ugopen\nxopen\ui.hxx 117 1 NxOpen
Error 6 error C2059: syntax error : ',' d:\project\nxopen\nxopen\textdlg.cpp 65 1 NxOpen
其中textdlg.cpp自动生成的代码,
求救,谢谢各位大侠,小弟感激万分。
生成cpp代码如下:
//==============================================================================
//  WARNING!!  This file is overwritten by the Block Styler while generating
//  the automation code. Any modifications to this file will be lost after
//  generating the code again.
//
//       Filename:  D:\project\MFCDll\Dialog\TextDlg.cpp
//
//        This file was generated by the NX Block Styler
//        Created by: user
//              Version: NX 6
//              Date: 07-26-2011  (Format: mm-dd-yyyy)
//              Time: 10:04 (Format: hh-mm)
//
//==============================================================================
//==============================================================================
//  Purpose:  This TEMPLATE file contains C++ source to guide you in the
//  construction of your Block application dialog. The generation of your
//  dialog file (.dlx extension) is the first step towards dialog construction
//  within NX.  You must now create a NX Open application that
//  utilizes this file (.dlx).
//
//  The information in this file provides you with the following:
//
//  1.  Help on how to load and display your Block Styler dialog in NX
//      using APIs provided in NXOpen.BlockStyler namespace
//  2.  The empty callback methods (stubs) associated with your dialog items
//      have also been placed in this file. These empty methods have been
//      created simply to start you along with your coding requirements.
//      The method name, argument list and possible return values have already
//      been provided for you.
//==============================================================================
//------------------------------------------------------------------------------
//These includes are needed for the following template code
//------------------------------------------------------------------------------
#include "stdafx.h"
#include "TextDlg.hpp"
#include "string.h"
using namespace NXOpen;
using namespace NXOpen::BlockStyler;
//------------------------------------------------------------------------------
// Initialize static variables
//------------------------------------------------------------------------------
Session *(TextDlg::theSession) = NULL;
UI *(TextDlg::theUI) = NULL;
//------------------------------------------------------------------------------
// Declaration of global variables
//------------------------------------------------------------------------------
TextDlg *theTextDlg;
//------------------------------------------------------------------------------
// Constructor for NX Styler class
//------------------------------------------------------------------------------
TextDlg::TextDlg()
{
    try
    {
        // Initialize the NX Open C++ API environment
        TextDlg::theSession = NXOpen::Session::GetSession();
        TextDlg::theUI = UI::GetUI();
        theDialogName = "TextDlg.dlx";
        theDialog = TextDlg::theUI->CreateDialog(theDialogName.c_str());
        // Registration of callback functions
        theDialog->AddApplyHandler(make_callback(this, &TextDlg::apply_cb));
        theDialog->AddOkHandler(make_callback(this, &TextDlg:k_cb));
        theDialog->AddUpdateHandler(make_callback(this, &TextDlg::update_cb));
        theDialog->AddInitializeHandler(make_callback(this, &TextDlg::initialize_cb));
        theDialog->AddDialogShownHandler(make_callback(this, &TextDlg::dialogShown_cb));
    }
    catch(exception& ex)
    {
        //---- Enter your exception handling code here -----
        throw ex;
    }
}
//------------------------------------------------------------------------------
// Destructor for NX Styler class
//------------------------------------------------------------------------------
TextDlg::~TextDlg()
{
    if (theDialog != NULL)
    {
        delete theDialog;
        theDialog = NULL;
    }
}
//------------------------------- DIALOG LAUNCHING ---------------------------------
//
//    Before invoking this application one needs to open any part/empty part in NX
//    because of the behavior of the blocks.
//
//    Make sure the dlx file is in one of the following locations:
//        1.) From where NX session is launched
//        2.) $UGII_USER_DIR/application
//        3.) For released applications, using UGII_CUSTOM_DIRECTORY_FILE is highly
//            recommended. This variable is set to a full directory path to a file
//            containing a list of root directories for all custom applications.
//            e.g., UGII_CUSTOM_DIRECTORY_FILE=<NX install directory>\ugii\menus\custom_dirs.dat
//
//    You can create the dialog using one of the following way:
//
//    1. USER EXIT
//
//        1) Create the Shared Library -- Refer "Block Styler programmer's guide"
//        2) Invoke the Shared Library through File->Execute->NX Open menu.
//
//------------------------------------------------------------------------------
extern "C" DllExport void  ufusr(char *param, int *retcod, int param_len)
{
    try
    {
        theTextDlg = new TextDlg();
        // The following method shows the dialog immediately
        theTextDlg->Show();
    }
    catch(exception& ex)
    {
        //---- Enter your exception handling code here -----
        TextDlg::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:ialogTypeError, ex.what());
    }
    delete theTextDlg;
}
//------------------------------------------------------------------------------
// This method specifies how a shared image is unloaded from memory
// within NX. This method gives you the capability to unload an
// internal NX Open application or user  exit from NX. Specify any
// one of the three constants as a return value to determine the type
// of unload to perform:
//
//
//    Immediately : unload the library as soon as the automation program has completed
//    Explicitly  : unload the library from the "Unload Shared Image" dialog
//    AtTermination : unload the library when the NX session terminates
//
//
// NOTE:  A program which associates NX Open applications with the menubar
// MUST NOT use this option since it will UNLOAD your NX Open application image
// from the menubar.
//------------------------------------------------------------------------------
extern "C" DllExport int ufusr_ask_unload()
{
    //return (int)Session:ibraryUnloadOptionExplicitly;
    return (int)Session:ibraryUnloadOptionImmediately;
    //return (int)Session:ibraryUnloadOptionAtTermination;
}
//------------------------------------------------------------------------------
// Following method cleanup any housekeeping chores that may be needed.
// This method is automatically called by NX.
//------------------------------------------------------------------------------
extern "C" DllExport void ufusr_cleanup(void)
{
    try
    {
        //---- Enter your callback code here -----
    }
    catch(exception& ex)
    {
        //---- Enter your exception handling code here -----
        TextDlg::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:ialogTypeError, ex.what());
    }
}
int TextDlg::Show()
{
    try
    {
        theDialog->Show();
    }
    catch(exception& ex)
    {
        //---- Enter your exception handling code here -----
        TextDlg::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:ialogTypeError, ex.what());
    }
    return 0;
}
//------------------------------------------------------------------------------
//---------------------Block Styler Callback Functions--------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//Callback Name: initialize_cb
//------------------------------------------------------------------------------
void TextDlg::initialize_cb()
{
    try
    {
        group0 = theDialog->TopBlock()->FindBlock("group0");
        button0 = theDialog->TopBlock()->FindBlock("button0");
    }
    catch(exception& ex)
    {
        //---- Enter your exception handling code here -----
        TextDlg::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:ialogTypeError, ex.what());
    }
}
//------------------------------------------------------------------------------
//Callback Name: dialogShown_cb
//This callback is executed just before the dialog launch. Thus any value set
//here will take precedence and dialog will be launched showing that value.
//------------------------------------------------------------------------------
void TextDlg::dialogShown_cb()
{
    try
    {
        //---- Enter your callback code here -----
    }
    catch(exception& ex)
    {
        //---- Enter your exception handling code here -----
        TextDlg::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox:ialogTypeError, ex.what());
    }
}
//------------------------------------------------------------------------------
//Callback Name: apply_cb
//------------------------------------------------------------------------------
int TextDlg::apply_cb()
{
    try
    {
        //---- Enter your callback code here -----
    }
    catch(exception& ex)
    {
        //---- Enter your exception handling code here -----
        TextDlg::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
    }
    return 0;
}
//------------------------------------------------------------------------------
//Callback Name: update_cb
//------------------------------------------------------------------------------
int TextDlg::update_cb(NXOpen::BlockStyler::UIBlock* block)
{
    try
    {
        if(block == button0)
        {
        //---------Enter your code here-----------
        }
    }
    catch(exception& ex)
    {
        //---- Enter your exception handling code here -----
        TextDlg::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
    }
    return 0;
}
//------------------------------------------------------------------------------
//Callback Name: ok_cb
//------------------------------------------------------------------------------
int TextDlg:k_cb()
{
    try
    {
        apply_cb();
    }
    catch(exception& ex)
    {
        //---- Enter your exception handling code here -----
        TextDlg::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
    }
    return 0;
}

小弟拜谢了。


作者: answergx    时间: 2013-12-5 22:46
问题解决了吗?同样问题求请教





欢迎光临 iCAx开思网 (https://www.icax.org/) Powered by Discuz! X3.3