马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
- #include "StdAfx.h"
- #include "MsgBox.h"
- #pragma region //MsgBox
- //(crpMsgBox "What the heck are you doing? " "Error" 5 4 )
- int MsgBox(void)
- {
- //
- int Button;
- int Icon;
- UINT ButtonF;
- UINT IconF;
- //
- struct resbuf *pArgs = acedGetArgs();
- if (pArgs == NULL)
- return acedRetNil();
- if (pArgs->restype != RTSTR )
- return acedRetNil();
- CString Text = pArgs->resval.rstring;
- if((pArgs = pArgs->rbnext) == NULL)
- return acedRetNil();
- if (pArgs->restype != RTSTR)
- return acedRetNil();
- CString Caption = pArgs->resval.rstring;
- if((pArgs = pArgs->rbnext) == NULL)
- return acedRetNil();
- if (pArgs->restype != RTSHORT)
- return acedRetNil();
- Button = (int)pArgs->resval.rint;
- switch (Button)
- {
- case 0:
- ButtonF = MB_OK;
- break;
- case 1:
- ButtonF = MB_OKCANCEL;
- break;
- case 2:
- ButtonF = MB_ABORTRETRYIGNORE;
- break;
- case 3:
- ButtonF = MB_YESNOCANCEL;
- break;
- case 4:
- ButtonF = MB_YESNO;
- break;
- case 5:
- ButtonF = MB_RETRYCANCEL;
- break;
- default:
- ButtonF = 0;
- }
- if((pArgs = pArgs->rbnext) == NULL)
- return acedRetNil();
- if (pArgs->restype != RTSHORT)
- return acedRetNil();
- Icon = (int)pArgs->resval.rint;
- Button = (UINT)pArgs->resval.rint;
- switch (Icon)
- {
- case 1:
- IconF = MB_ICONERROR;
- break;
- case 2:
- IconF = MB_ICONQUESTION;
- break;
- case 3:
- IconF = MB_ICONWARNING;
- break;
- case 4:
- IconF = MB_ICONINFORMATION;
- break;
- default:
- IconF = 0;
- }
- //
- HWND hwDocWnd = adsw_acadDocWnd();
- short res = MessageBox(hwDocWnd , Text , Caption , ButtonF | IconF);
- acedRetInt(res) ;
- return (RSRSLT) ;
- }
- #pragma endregion
|