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

iCAx开思网

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

[求助] VS2005二次开发菜单问题

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

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

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

x
// menubar5.cpp : 定义 DLL 的初始化例程。
//
#include "stdafx.h"
#include "ProToolkit.h"
#include "user_tk_error.h"
#include "pro_wchar_t.h"
#include "ProMdl.h"
#include "ProMenu.h"
#include "ProMenuBar.h"
#include "ProMessage.h"
#include "ProNotify.h"
#include "ProObjects.h"
#include "ProUtil.h"
#include "ProUIDialog.h"
#include "ProUIMessage.h"
#include "ProUIPushbutton.h"
#include "ProSolid.h"
#include "ProWindows.h"
#include "ProFamtable.h"
#include "ProFaminstance.h"
#include "ProUICmd.h"
#include "TestError.h"
#include "ProParamval.h"


/*----------------------------------------------------------------------------*\
Application data types
\*----------------------------------------------------------------------------*/
extern "C"typedef struct user_command
{
    char *name;
    uiCmdCmdId id;
} UserCommand;
extern "C"typedef struct user_check_but
{
    uiCmdCmdId command;
    ProBoolean state;
} UserCheckBut;

/*----------------------------------------------------------------------------*\
Application global/external data
\*----------------------------------------------------------------------------*/
extern "C"static wchar_t msgfil[] =
    { 'm','e','n','u','b','a','r','_','m','s','g','.','t','x','t','\0'};
extern "C"static UserCheckBut check_but[2];
extern "C"static uiCmdAccessState access_state = ACCESS_AVAILABLE;
extern "C"static FILE *log_file = NULL;
extern "C"static UserCommand user_actions[] = {
{"TestCheckButtonOpt1", (uiCmdCmdId)NULL},
{"TestCheckButtonOpt2", (uiCmdCmdId)NULL},
{"TestRadioGroupOpt",  (uiCmdCmdId)NULL}};


/*====================================================================*\
    FUNCTION : ProTestAccessFunction()
    PURPOSE  :   Enable access
\*====================================================================*/
extern "C"static uiCmdAccessState ProTestAccessFunction(uiCmdAccessMode access_mode)
{
   
    return (ACCESS_AVAILABLE);
}


/*====================================================================*\
    FUNCTION : ProTestRadioButtonValue()
    PURPOSE  :  Set value for radio group
\*====================================================================*/
extern "C"int ProTestRadioButtonValue(
    uiCmdCmdId command,
    uiCmdValue *p_value)
{
    ProError err;
    ProMenuItemName  name;

#if 0
    err = ProMenubarMenuRadiogrpValueGet (p_value, name);
   
    err = ProMenubarMenuRadiogrpValueSet(p_value, name);
   
#endif
    return (0);
}
/*====================================================================*\
    FUNCTION : ProTestRadioButton()
    PURPOSE  :  Callback functions for radio group options
\*====================================================================*/
extern "C"int ProTestRadioButton(
    uiCmdCmdId command,
    uiCmdValue *p_value)
{
    ProError err;
    ProMenuItemName  name;   
   
   
    err = ProMenubarMenuRadiogrpValueGet (p_value, name);
  
    return(0);
}
/*====================================================================*\
    FUNCTION : ProTestCheckButtonValue()
    PURPOSE  :  Set new value for check buttons
\*====================================================================*/
extern "C"int ProTestCheckButtonValue(
    uiCmdCmdId command,
    uiCmdValue *p_value)
{
    ProError err;
    ProBoolean bool;
    int i;

    for (i=0; i<sizeof(check_but)/sizeof(check_but[0]); i++)
if (check_but[i].command == command)
{
         err = ProMenubarmenuChkbuttonValueGet (p_value, &bool);
     

     if (bool == check_but[i].state)
  continue;
     
   
     err = ProMenubarmenuChkbuttonValueSet(p_value, check_but[i].state);
   
     break;
}
    return(0);
}
/*====================================================================*\
    FUNCTION : ProTestCheckButton()
    PURPOSE  :  Callback function for check button options
\*====================================================================*/
extern "C"int ProTestCheckButton(   
    uiCmdCmdId command,
    uiCmdValue *p_value,
    void *p_push_command_data)
{
    int i;
   
    ProMessageDisplay(msgfil, "TEST Check Button pressed.");
    for (i=0; i<sizeof(check_but)/sizeof(check_but[0]); i++)
if (check_but[i].command == command)
{
     /*  Change state of pressed button */
     check_but[i].state = !check_but[i].state;
     break;
}
    return(0);
}


/*============================================================================*\
  Function : ProTestMenuBar
  Purpose  : Create a menu to test Menu Bar functions
\*============================================================================*/
extern "C"int ProTestMenuBar()
{
   
    ProError err;
    uiCmdCmdId   push_act, push_act2, action;
    uiCmdCmdId   radio_act;
    int i;
    static ProMenuItemName radio_group_items[]=
{"TestRadio1", "TestRadio2", "TestRadio3", ""};
    static ProMenuItemLabel radio_group_labels[]=
{"Radio button 1", "Radio button 2", "Radio button 3", ""};
    static ProMenuLineHelp radio_group_help[]=
{"Test radio button", "Test radio button", "Test radio button", ""};
/*---------------------------------------------------------------------*\
    Add new button to the menu bar
\*---------------------------------------------------------------------*/
    err = ProMenubarMenuAdd( "TestMenuBar", "-MenuBar", "Help", PRO_B_FALSE,
msgfil);
   

    err = ProCmdOptionAdd("TestCheckButtonOpt1",
(uiCmdCmdActFn)ProTestCheckButton, PRO_B_TRUE,
(uiCmdCmdValFn)ProTestCheckButtonValue,
ProTestAccessFunction, PRO_B_TRUE, PRO_B_TRUE, &check_but[0].command);
    err = ProCmdOptionAdd("TestCheckButtonOpt2",
(uiCmdCmdActFn)ProTestCheckButton, PRO_B_TRUE,
(uiCmdCmdValFn)ProTestCheckButtonValue,
ProTestAccessFunction, PRO_B_TRUE, PRO_B_TRUE, &check_but[1].command);
   
    err = ProCmdOptionAdd("TestRadioGroupOpt",
(uiCmdCmdActFn)ProTestRadioButton, PRO_B_FALSE,
(uiCmdCmdValFn)ProTestRadioButtonValue,
ProTestAccessFunction, PRO_B_TRUE, PRO_B_TRUE, &radio_act);
   
   
   
    err = ProMenubarmenuChkbuttonAdd("TestMenuBar", "TestChkBut1",
"Check button 1",
"Test check button 1",NULL, PRO_B_TRUE, check_but[0].command,
msgfil);

    err = ProMenubarmenuChkbuttonAdd("TestMenuBar", "TestChkBut2", "Check button 2",
"Test check button 2", "TestChkBut1", PRO_B_TRUE, check_but[1].command,
msgfil);
   
    err = ProMenubarmenuRadiogrpAdd("TestMenuBar", "TestRadioGrp1",
3, radio_group_items, radio_group_labels, radio_group_help,
"TestChkBut2", PRO_B_TRUE, radio_act, msgfil);
   
    return(0);
}
extern "C"int user_initialize()
{
ProTestMenuBar();

return 0;
}
/*---------------------------------------------------------------------------*\
    End the Pro/TOOLKIT application
\*---------------------------------------------------------------------------*/
extern "C"void user_terminate()
{
     return;
}
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 赞一下!赞一下!
2
发表于 2009-3-31 17:13:35 | 只看该作者
编译结果为:1>d:\backup\visual studio 2005\projects\menubar5\menubar5\menubar5.cpp(88) : warning C4101: “name”: 未引用的局部变量
1>d:\backup\visual studio 2005\projects\menubar5\menubar5\menubar5.cpp(87) : warning C4101: “err”: 未引用的局部变量
1>d:\backup\visual studio 2005\projects\menubar5\menubar5\menubar5.cpp(128) : error C2628: “ProBoolean”后面接“bool”是非法的(是否忘记了“;”?)
1>d:\backup\visual studio 2005\projects\menubar5\menubar5\menubar5.cpp(137) : error C2062: 意外的类型“bool”
1>d:\backup\visual studio 2005\projects\menubar5\menubar5\menubar5.cpp(140) : error C2059: 语法错误 : “==”
1>d:\backup\visual studio 2005\projects\menubar5\menubar5\menubar5.cpp(171) : error C2440: “=”: 无法从“bool”转换为“ProBoolean”
1>        转换为枚举类型要求显式转换(static_cast、C 样式转换或函数样式转换)

我的附加的库

wsock32.lib
mpr.lib
psapi.lib
protk_dllmd.lib
预处理器定义添加:PRO_USE_VAR_ARGS
请问究竟哪里出问题了?
3
发表于 2009-3-31 19:22:20 | 只看该作者
没玩过这么加菜单的。
4
发表于 2010-4-16 14:56:30 | 只看该作者
我也遇到这样的问题啊,都是教材上的程序,怎么会出这样的错呢,兄弟问题解决了吗??
5
发表于 2010-4-26 16:22:01 | 只看该作者
同求,为什么老是这种问题呢
6
发表于 2010-8-21 16:34:42 | 只看该作者
我也是学习中。。。。。。。。找资料
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

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

GMT+8, 2024-12-23 18:57 , Processed in 0.031228 second(s), 14 queries , Gzip On, Redis On.

Powered by Discuz! X3.3

© 2002-2024 www.iCAx.org

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