找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
热搜: 活动 交友 discuz
查看: 169|回复: 0

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

[复制链接]

1

主题

0

回帖

33

积分

管理员

积分
33
发表于 2024-3-14 21:01:51 | 显示全部楼层 |阅读模式
  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
复制代码
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|膜结构网

GMT+8, 2024-12-29 20:41 , Processed in 0.136778 second(s), 22 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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