找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 591|回复: 1

[每日一码] 接受LISP参数,实现message box

[复制链接]

已领礼包: 1个

财富等级: 恭喜发财

发表于 2021-1-17 11:04:29 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

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

×
  1. #include "StdAfx.h"
  2. #include "MsgBox.h"

  3. #pragma region //MsgBox
  4. //(crpMsgBox "What the heck are you doing? " "Error" 5 4 )
  5. int MsgBox(void)
  6. {

  7.   //
  8.   int Button;
  9.   int Icon;
  10.   UINT ButtonF;
  11.   UINT IconF;
  12.   //
  13.   struct resbuf *pArgs = acedGetArgs();

  14.   if (pArgs == NULL)
  15.     return acedRetNil();

  16.   if (pArgs->restype != RTSTR )
  17.     return acedRetNil();

  18.   CString Text = pArgs->resval.rstring;

  19.   if((pArgs = pArgs->rbnext) == NULL)
  20.     return acedRetNil();

  21.   if (pArgs->restype != RTSTR)
  22.     return acedRetNil();

  23.   CString Caption = pArgs->resval.rstring;

  24.   if((pArgs = pArgs->rbnext) == NULL)
  25.     return acedRetNil();

  26.   if (pArgs->restype != RTSHORT)
  27.     return acedRetNil();

  28.   Button = (int)pArgs->resval.rint;
  29.   switch (Button)
  30.   {
  31.   case 0:
  32.     ButtonF = MB_OK;
  33.     break;
  34.   case 1:
  35.     ButtonF = MB_OKCANCEL;
  36.     break;
  37.   case 2:
  38.     ButtonF = MB_ABORTRETRYIGNORE;
  39.     break;
  40.   case 3:
  41.     ButtonF = MB_YESNOCANCEL;
  42.     break;
  43.   case 4:
  44.     ButtonF = MB_YESNO;
  45.     break;
  46.   case 5:
  47.     ButtonF = MB_RETRYCANCEL;
  48.     break;
  49.   default:
  50.     ButtonF = 0;
  51.   }

  52.   if((pArgs = pArgs->rbnext) == NULL)
  53.     return acedRetNil();

  54.   if (pArgs->restype != RTSHORT)
  55.     return acedRetNil();

  56.   Icon = (int)pArgs->resval.rint;
  57.   Button = (UINT)pArgs->resval.rint;

  58.   switch (Icon)
  59.   {
  60.   case 1:
  61.     IconF = MB_ICONERROR;
  62.     break;
  63.   case 2:
  64.     IconF = MB_ICONQUESTION;
  65.     break;
  66.   case 3:
  67.     IconF = MB_ICONWARNING;
  68.     break;
  69.   case 4:
  70.     IconF = MB_ICONINFORMATION;
  71.     break;
  72.   default:
  73.     IconF = 0;
  74.   }

  75.   //
  76.   HWND hwDocWnd = adsw_acadDocWnd();
  77.   short res = MessageBox(hwDocWnd , Text , Caption ,  ButtonF | IconF);
  78.   acedRetInt(res) ;
  79.   return (RSRSLT) ;
  80. }
  81. #pragma endregion


论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
发表于 2021-1-18 15:55:38 | 显示全部楼层
感谢分享,alert增强版本。。。
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|申请友链|Archiver|手机版|小黑屋|辽公网安备|晓东CAD家园 ( 辽ICP备15016793号 )

GMT+8, 2024-4-26 01:06 , Processed in 0.160046 second(s), 29 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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