|
马上注册登录,享用更多网站功能!
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
我想在菜单栏添加一个一个菜单条,然后在下面添加一个PUSHBUTTON,
不知怎么了,一注册就退出,
代码如下
// proe_MenubarAdd.cpp : Defines the initialization routines for the DLL.
//
#include "stdafx.h"
#include "proe_MenubarAdd.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 ShowMessage();
static uiCmdAccessState AccessAvailable (uiCmdAccessMode);
static uiCmdAccessState AccessUnAvailable (uiCmdAccessMode);
static uiCmdAccessState AccessRemove (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.
//
/////////////////////////////////////////////////////////////////////////////
// CProe_MenubarAddApp
BEGIN_MESSAGE_MAP(CProe_MenubarAddApp, CWinApp)
//{{AFX_MSG_MAP(CProe_MenubarAddApp)
// 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()
/////////////////////////////////////////////////////////////////////////////
// CProe_MenubarAddApp construction
CProe_MenubarAddApp::CProe_MenubarAddApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CProe_MenubarAddApp object
CProe_MenubarAddApp theApp;
/*=======================================================================*\
FUNCTION: user_initialize()
\*=======================================================================*/
extern "C" int user_initialize()
{
ProError status;
ProFileName MsgFile;
uiCmdCmdId PushButton_cmd_id;//radio_act,ModeMenu_cmd_id;//修改处1
ProStringToWstring(MsgFile, "Message1.txt");//设置菜单信息文件名.修改处2
/*=========================================================*\
添加菜单条"练习"
\*=========================================================*/
status=ProMenubarMenuAdd ("UserMenuBar", "Exercise",
"help", PRO_B_TRUE, MsgFile);
/*=========================================================*\
菜单按钮设置(添加菜单条按钮‘创建模型’)
\*=========================================================*/
//设置菜单按钮的动作函数
ProCmdActionAdd("PushButtonAct",(uiCmdCmdActFn)ShowMessage,//激活菜单条菜单命令时调用的动作函数
uiCmdPrioDefault,AccessAvailable,
PRO_B_TRUE,PRO_B_TRUE,&PushButton_cmd_id);
//添加菜单按钮
ProMenubarmenuPushbuttonAdd("UserMenuBar", "PushButton", "CreateModel",
"Adding a push button to the ProE menu bar", NULL,
PRO_B_TRUE, PushButton_cmd_id, 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: AccessUnAvailable()(菜单项的访问权限设置:不可选)
\*================================================================*/
static uiCmdAccessState AccessUnAvailable (uiCmdAccessMode access_mode)
{
return (ACCESS_UNAVAILABLE);
}
/*================================================================*\
FUNCTION: AccessRemove()(菜单项的访问权限设置:移除菜单项)
\*================================================================*/
static uiCmdAccessState AccessRemove (uiCmdAccessMode access_mode)
{
return (ACCESS_REMOVE);
}
/*================================================================*\
FUNCTION: ShowMessage() 菜单按钮1的动作函数
\*================================================================*/
int ShowMessage()
{
ProFileName MsgFile;
ProStringToWstring(MsgFile, "DisplayMessage2.txt");
ProMessageDisplay(MsgFile, "Push button pressed");
return true;
}
点F7会出现下面错误
--------------------Configuration: proe_MenubarAdd - Win32 Debug--------------------
Compiling...
proe_MenubarAdd.cpp
Linking...
LINK : warning LNK4075: ignoring /INCREMENTAL due to /FORCE specification
LIBC.lib(crt0dat.obj) : warning LNK4006: _exit already defined in msvcrtd.lib(MSVCRTD.dll); second definition ignored
LIBC.lib(unlink.obj) : warning LNK4006: _remove already defined in msvcrtd.lib(MSVCRTD.dll); second definition ignored
LIBC.lib(crt0init.obj) : warning LNK4006: ___xc_z already defined in msvcrtd.lib(cinitexe.obj); second definition ignored
LIBC.lib(crt0init.obj) : warning LNK4006: ___xc_a already defined in msvcrtd.lib(cinitexe.obj); second definition ignored
LIBC.lib(crt0init.obj) : warning LNK4006: ___xi_z already defined in msvcrtd.lib(cinitexe.obj); second definition ignored
LIBC.lib(crt0init.obj) : warning LNK4006: ___xi_a already defined in msvcrtd.lib(cinitexe.obj); second definition ignored
LIBC.lib(crt0dat.obj) : warning LNK4006: _exit already defined in msvcrtd.lib(MSVCRTD.dll); second definition ignored
LIBC.lib(unlink.obj) : warning LNK4006: _remove already defined in msvcrtd.lib(MSVCRTD.dll); second definition ignored
LIBC.lib(crt0init.obj) : warning LNK4006: ___xc_z already defined in msvcrtd.lib(cinitexe.obj); second definition ignored
LIBC.lib(crt0init.obj) : warning LNK4006: ___xc_a already defined in msvcrtd.lib(cinitexe.obj); second definition ignored
LIBC.lib(crt0init.obj) : warning LNK4006: ___xi_z already defined in msvcrtd.lib(cinitexe.obj); second definition ignored
LIBC.lib(crt0init.obj) : warning LNK4006: ___xi_a already defined in msvcrtd.lib(cinitexe.obj); second definition ignored
Creating library Debug/proe_MenubarAdd.lib and object Debug/proe_MenubarAdd.exp
LINK : warning LNK4098: defaultlib "msvcrtd.lib" conflicts with use of other libs; use /NODEFAULTLIB:library
LINK : warning LNK4098: defaultlib "LIBC" conflicts with use of other libs; use /NODEFAULTLIB:library
protk_dll.lib(cu_appid.obj) : error LNK2001: unresolved external symbol __ftol2
protk_dll.lib(cttime.obj) : error LNK2001: unresolved external symbol __ftol2
protk_dll.lib(ctwcfun.obj) : error LNK2001: unresolved external symbol __ftol2
protk_dll.lib(ctfileutil.obj) : error LNK2001: unresolved external symbol __ftol2
protk_dll.lib(frgnalt3.obj) : error LNK2001: unresolved external symbol __ftol2
protk_dll.lib(windows_32.obj) : error LNK2001: unresolved external symbol __ftol2
protk_dll.lib(cu_dll_tools.obj) : error LNK2001: unresolved external symbol [email=_GetModuleFileNameExW@16]_GetModuleFileNameExW@16[/email]
protk_dll.lib(cu_dll_tools.obj) : error LNK2001: unresolved external symbol [email=_GetModuleInformation@16]_GetModuleInformation@16[/email]
protk_dll.lib(cu_dll_tools.obj) : error LNK2001: unresolved external symbol [email=_EnumProcessModules@16]_EnumProcessModules@16[/email]
LIBC.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/proe_MenubarAdd.dll : warning LNK4088: image being generated due to /FORCE option; image may not run
proe_MenubarAdd.dll - 10 error(s), 16 warning(s)
我是菜鸟,,大侠帮帮忙啊
对了,我用得是VC6.0+PROE3.0
请问这和版本有关吗 |
|