当前位置:编程学习 > 网站相关 >>

Creo二次开发--函数

本类函数是在二次开发中经常用的到的一个函数,为了达到界面的统一,建议先使用Creo自带的函数进行实现。
 
 
#include <ProUIMessage.h> 
ProError ProUIMessageDialogDisplay (ProUIMessageType type,//消息的类型
                                     wchar_t* title,//对话框的标题
                                     wchar_t* msg_txt,//消息文本
                                     ProUIMessageButton* buttons,//对话框中按钮标识的数组
                                     ProUIMessageButton def_button, //缺省按钮的标识 
                                     ProUIMessageButton* user_choice,//输出用户选择的按钮的标识 
                                    ) 
 
 
typedef enum
{
    PROUIMESSAGE_ERROR   = 0,//错误
    PROUIMESSAGE_WARNING = 1,//警告
    PROUIMESSAGE_INFO    = 2,//信息
    PROUIMESSAGE_QUESTION= 3//确认
} ProUIMessageType;
 
 
typedef enum pro_ui_message_button
{
  PRO_UI_MESSAGE_ABORT     = 0,      /* 放弃 */
  PRO_UI_MESSAGE_RETRY     = 1,      /* 重试 */
  PRO_UI_MESSAGE_IGNORE    = 2,      /* 忽略 */
  PRO_UI_MESSAGE_CONFIRM   = 3,      /* 确认*/
  PRO_UI_MESSAGE_YES       = 4,      /*是 */
  PRO_UI_MESSAGE_NO        = 5,      /* 否 */
  PRO_UI_MESSAGE_OK        = 6,      /* 好*/
  PRO_UI_MESSAGE_CANCEL    = 7       /*取消 */
} ProUIMessageButton;
 
 
帮助文件中的确认函数
 
 
ProError   UserDisplayPopupConfirmation ()
{
ProUIMessageButton* buttons;
ProUIMessageButton user_choice;
 
 
 
 
ProArrayAlloc (2, sizeof (ProUIMessageButton),1, (ProArray*)&buttons);
 
 
buttons [0] = PRO_UI_MESSAGE_YES;
buttons [1] = PRO_UI_MESSAGE_NO;
 
 
ProUIMessageDialogDisplay (PROUIMESSAGE_QUESTION,
L"Confirmation",
L"Do you really want to delete the feature?",
buttons,
PRO_UI_MESSAGE_YES,
&user_choice);
 
 
ProArrayFree ((ProArray*)&buttons);
 
 
if (user_choice == PRO_UI_MESSAGE_YES)
{  www.zzzyk.com
              //确认后的代码
 
 
}
else if (user_choice == PRO_UI_MESSAGE_NO)
{
 
   //取消后的代码
}
        ProArrayFree(buttons);//新添加的代码,笔者认为在申请之后,应该释放内存。
return PRO_TK_NO_ERROR;
}
补充:综合编程 , 其他综合 ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,