//注意,上面多了一块蛋糕
k u ,TOOL.
//哈哈,完整程序是这样的.
// testdlg3.cpp : Defines the initialization routines for the DLL.
//
#include "stdafx.h"
#include "testdlg3.h"
#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.
//
/////////////////////////////////////////////////////////////////////////////
// CTestdlg3App
BEGIN_MESSAGE_MAP(CTestdlg3App, CWinApp)
//{{AFX_MSG_MAP(CTestdlg3App)
// 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()
/////////////////////////////////////////////////////////////////////////////
// CTestdlg3App construction
CTestdlg3AppTestdlg3App()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CTestdlg3App object
CTestdlg3App theApp;
#include <roToolkit.h>
#include <roMenu.h>
#include <roMenuBar.h>
#include <roUtil.h>
static uiCmdAccessState TestAccessDefault(uiCmdAccessMode access_mode)
{
return (ACCESS_AVAILABLE);
}
void Check()
{
AfxMessageBox("haha");
}
/*====================================================================*\
FUNCTION : user_initialize()
PURPOSE : Pro/TOOLKIT程序的总入口,完成初始化工作
\*====================================================================*/
extern "C" int user_initialize(
int argc,
char *argv[],
char *version,
char *build,
wchar_t errbuf[80])
{
ProError status;
uiCmdCmdId cmd_id;
ProFileName mf;
ProStringToWstring(mf,"usermsg.txt");
status = ProMenubarMenuAdd ("Menu0", "USER Menu0",
"Help", PRO_B_TRUE, mf);
// 0添加父菜单Menu0
status = ProMenubarmenuMenuAdd ("Menu0", "Menu1", "USER Menu1",
NULL, PRO_B_TRUE, mf);
添加弹出式菜单Menu1
// status = ProCmdActionAdd("Menu2", (uiCmdCmdActFn)Check,
// uiCmdPrioDefault, Check, PRO_B_TRUE, PRO_B_TRUE, [$cmd_id)]
-1菜单Menu2动作
status = ProCmdActionAdd("Menu2", (uiCmdCmdActFn)Check,
uiCmdPrioDefault, TestAccessDefault, PRO_B_TRUE, PRO_B_TRUE, [$cmd_id)]
-1菜单Menu2动作
status = ProMenubarmenuPushbuttonAdd ("Menu1", "Menu2",
"USER Menu2", "USER Menu2 help", NULL, PRO_B_TRUE,cmd_id, mf);
-1添加菜单Menu2
return 0;
}
extern "C" void user_terminate()
{
} |