找回密码 注册 QQ登录
一站式解决方案

iCAx开思网

CAD/CAM/CAE/设计/模具 高清视频【积分说明】如何快速获得积分?快速3D打印 手板模型CNC加工服务在线3D打印服务,上传模型,自动报价
查看: 16205|回复: 2
打印 上一主题 下一主题

[求助] 大家看看

[复制链接]
跳转到指定楼层
1
发表于 2009-5-1 22:33:32 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上注册,结交更多同行朋友,交流,分享,学习。

您需要 登录 才可以下载或查看,没有帐号?注册

x
源程序是下面的,为什么注册时连Pro/E也会关闭?
// Gan.cpp : Defines the initialization routines for the DLL.
//
#include "stdafx.h"
#include "Gan.h"
#define PRO_USE_VAR_ARGS 1
/*--------------------------------------------------------------------*\
Pro/TOOLKIT includes
\*--------------------------------------------------------------------*/
#include"ProMenu.h"
#include"ProUtil.h"
#include"ProMenubar.h"
#include <ProMessage.h>
/*--------------------------------------------------------------------*\
Functions declaration  函数声明
\*--------------------------------------------------------------------*/
int ShowMessage1();
int ShowMessage2();
int ShowMessage3();
static uiCmdAccessState AccessAvailable (uiCmdAccessMode);
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//
// Note!
//
//  If this DLL is dynamically linked against the MFC
//  DLLs, any functions exported from this DLL which
//  call into MFC must have the AFX_MANAGE_STATE macro
//  added at the very beginning of the function.
//
//  For example:
//
//  extern "C" BOOL PASCAL EXPORT ExportedFunction()
//  {
//   AFX_MANAGE_STATE(AfxGetStaticModuleState());
//   // normal function body here
//  }
//
//  It is very important that this macro appear in each
//  function, prior to any calls into MFC.  This means that
//  it must appear as the first statement within the
//  function, even before any object variable declarations
//  as their constructors may generate calls into the MFC
//  DLL.
//
//  Please see MFC Technical Notes 33 and 58 for additional
//  details.
//
/////////////////////////////////////////////////////////////////////////////
// CGanApp
BEGIN_MESSAGE_MAP(CGanApp, CWinApp)
//{{AFX_MSG_MAP(CGanApp)
  // NOTE - the ClassWizard will add and remove mapping macros here.
  //    DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CGanApp construction
CGanApp::CGanApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CGanApp object
CGanApp theApp;
/*=======================================================================*\
FUNCTION: user_initialize()
\*=======================================================================*/
extern "C" int user_initialize()
{
    ProError status;
ProFileName MsgFile;
    uiCmdCmdId   PushButton_cmd_id1,PushButton_cmd_id2,PushButton_cmd_id3;
ProStringToWstring(MsgFile, "Message.txt");//设置菜单信息文件名
    /*=========================================================*\
     添加菜单条
    \*=========================================================*/
status=ProMenubarMenuAdd ("UserMenuBar", "UserMenu",
                        "Applications", PRO_B_TRUE, MsgFile);
    /*=========================================================*\
     菜单按钮设置1
    \*=========================================================*/
//设置菜单按钮的动作函数
status=ProCmdActionAdd("PushButtonAct1",(uiCmdCmdActFn)ShowMessage1,
              uiCmdPrioDefault,AccessAvailable,
        PRO_B_TRUE,PRO_B_TRUE,&PushButton_cmd_id1);
    //添加菜单按钮
status=ProMenubarmenuPushbuttonAdd("UserMenuBar", "PushButton", "PushButton1",
             "Adding a push button to the ProE menu bar", NULL,
           PRO_B_TRUE, PushButton_cmd_id1, MsgFile);
/*=========================================================*\
     菜单按钮设置2
    \*=========================================================*/
//设置菜单按钮的动作函数
status=ProCmdActionAdd("PushButtonAct2",(uiCmdCmdActFn)ShowMessage2,
              uiCmdPrioDefault,AccessAvailable,
        PRO_B_TRUE,PRO_B_TRUE,&PushButton_cmd_id2);
    //添加菜单按钮
status=ProMenubarmenuPushbuttonAdd("UserMenuBar", "PushButton", "PushButton2",
             "Adding a push button to the ProE menu bar", NULL,
           PRO_B_TRUE, PushButton_cmd_id2, MsgFile);
/*=========================================================*\
     菜单按钮设置3
    \*=========================================================*/
//设置菜单按钮的动作函数
status=ProCmdActionAdd("PushButtonAct3",(uiCmdCmdActFn)ShowMessage3,
              uiCmdPrioDefault,AccessAvailable,
        PRO_B_TRUE,PRO_B_TRUE,&PushButton_cmd_id3);
    //添加菜单按钮
status=ProMenubarmenuPushbuttonAdd("UserMenuBar", "PushButton", "PushButton3",
             "Adding a push button to the ProE menu bar", NULL,
           PRO_B_TRUE, PushButton_cmd_id3, MsgFile);

   return status;
}
/*===============================================================*\
FUNCTION: user_terminate()
\*===============================================================*/
extern "C" void user_terminate()
{
   AFX_MANAGE_STATE(AfxGetStaticModuleState());
}
/*================================================================*\
FUNCTION: AccessAvailable (菜单项的访问权限设置:可选)
\*================================================================*/
static uiCmdAccessState AccessAvailable (uiCmdAccessMode access_mode)
{
    return (ACCESS_AVAILABLE);
}
/*================================================================*\
FUNCTION: ShowMessage() 菜单按钮1的动作函数
\*================================================================*/
int ShowMessage1()
{
    AfxMessageBox("选择零件快速设计模块!",MB_OK);
return true;
}
int ShowMessage2()
{
    AfxMessageBox("选择三维CAPP系统模块!",MB_OK);
return true;
}
int ShowMessage3()
{
    AfxMessageBox("选择NC加工程序模块!",MB_OK);
return true;
}
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 赞一下!赞一下!
2
 楼主| 发表于 2009-5-1 22:34:44 | 只看该作者

马上注册,结交更多同行朋友,交流,分享,学习。

您需要 登录 才可以下载或查看,没有帐号?注册

x
3
发表于 2009-6-11 00:42:09 | 只看该作者

好贴,不错,顶

马上注册,结交更多同行朋友,交流,分享,学习。

您需要 登录 才可以下载或查看,没有帐号?注册

x
您需要登录后才可以回帖 登录 | 注册

本版积分规则

3D打印手板模型快速制作服务,在线报价下单!

QQ 咨询|手机版|联系我们|iCAx开思网  

GMT+8, 2024-11-10 21:09 , Processed in 0.027931 second(s), 11 queries , Gzip On, Redis On.

Powered by Discuz! X3.3

© 2002-2024 www.iCAx.org

快速回复 返回顶部 返回列表