|
比如这种这是菜单程序:
static uiCmdAccessState AccessDefault(uiCmdAccessMode access_mode)
{
return(ACCESS_AVAILABLE);
}
void Test1()
{
AfxMessageBox(_T("测试按钮A"));
}
void Test2()
{
AfxMessageBox(_T("测试按钮B"));
}
extern "C" int user_initialize()
{
ProError status;
ProFileName MsgFile;
ProStringToWstring(MsgFile, "IconMessage.txt"); //注意此处的IconMessage与后面的text文件夹下的IconMessage.txt文件名必须相同
uiCmdCmdId PushButton1_cmd_id,PushButton2_cmd_id;
status=ProMenubarMenuAdd("MainMenu","Function","Help",PRO_B_TRUE,MsgFile);
ProCmdActionAdd("PushButton1_Act",(uiCmdCmdActFn)Test1,12,AccessDefault,PRO_B_TRUE,PRO_B_TRUE,&PushButton1_cmd_id);
ProMenubarmenuPushbuttonAdd("MainMenu","PushButton","FirstButton","this button will show a message",NULL,PRO_B_TRUE,PushButton1_cmd_id,MsgFile);
ProCmdActionAdd("PushButton2_Act",(uiCmdCmdActFn)Test2,uiCmdPrioDefault,AccessDefault,PRO_B_TRUE,PRO_B_TRUE,&PushButton2_cmd_id);
ProMenubarmenuPushbuttonAdd("MainMenu", "PushButton2", "SecondButton", "this button will show a message", NULL, PRO_B_TRUE, PushButton2_cmd_id, MsgFile);
return status;
}
extern "C" void user_terminate()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
}
注册运行点击菜单可以显示:测试按钮A/B,但如何改动才能将编好的对话框打开 |
|