明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 5293|回复: 11

[原创]显示Windows的MSGBOX对话框

  [复制链接]
发表于 2003-11-22 22:27 | 显示全部楼层 |阅读模式
本帖最后由 作者 于 2004-2-21 23:47:32 编辑

函数:(MsgBox  msg  timeout  title  buttons)
  1. ;;;Buttons
  2. ;;;
  3. ;;;0    OK
  4. ;;;1    OK  and  Cancel
  5. ;;;2    Abort,  Retry,  and  Ignore
  6. ;;;3    Yes,  No,  Cancel
  7. ;;;4    Yes  and  No
  8. ;;;5    Retry  and  Cancel
  9. ;;;
  10. (setq  bt_OK  0
  11.             bt_OK_Cancel  1
  12.             bt_Abort_Retry_Ignore  2
  13.             bt_Yes_No_Cancel  3
  14.             bt_Yes_No  4
  15.             bt_Retry_Cancel  5
  16. )
  17. ;;;Icon  Types
  18. ;;;
  19. ;;;16  Stop  Mark  icon
  20. ;;;32  Question  Mark  icon
  21. ;;;48  Exclamation  Mark  icon
  22. ;;;64  Information  Mark  icon
  23. (setq  icon_Stop  16
  24.             icon_Question  32
  25.             icon_Exclamation  48
  26.             icon_Information  64
  27. )
  28. ;;;1    OK  button
  29. ;;;2    Cancel  button
  30. ;;;3    Abort  button
  31. ;;;4    Retry  button
  32. ;;;5    Ignore  button
  33. ;;;6    Yes  button
  34. ;;;7    No  button
  35. (setq  rs_OK  1
  36.             rs_Cancel  2
  37.             rs_Abort  3
  38.             rs_Retry  4
  39.             rs_Ignore  5
  40.             rs_Yes  6  
  41.             rs_No  7)
  42. (defun  msgbox  (  msg  timeout  title  buttons  /  ws)
  43.     (setq  ws  (vlax-create-object  "wscript.shell"))
  44.     (vlax-invoke-method  ws  'popup  msg  timeout  title  buttons)
  45. )
  46. ;;;  test
  47. ;;;(if  (=  (msgbox  "This  is  a  test  line."  5  "Qiu  Feng"  (+  bt_OK_Cancel  Icon_Question))
  48. ;;;              rs_OK)
  49. ;;;    (alert  "You  select  OK")
  50. ;;;    (alert  "You  select  Cancel")
  51. ;;;)

评分

参与人数 1威望 +1 金钱 +5 贡献 +8 激情 +5 收起 理由
龙龙仔 + 1 + 5 + 8 + 5 【好评】好文章WSCRIPT.SHELL很少人提供

查看全部评分

"觉得好,就打赏"
还没有人打赏,支持一下
发表于 2003-11-23 08:36 | 显示全部楼层
好程序 ! 鮮花表揚.
发表于 2003-11-24 07:45 | 显示全部楼层
好程序 !
发表于 2003-11-24 12:23 | 显示全部楼层
秋風兄:
wscript.shell引用項目是那一個

本帖子中包含更多资源

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

x
 楼主| 发表于 2003-11-24 13:38 | 显示全部楼层
我没有在VBA中试过。这是WScript Host自带的ActiveX服务。
所以,我猜是这个:

本帖子中包含更多资源

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

x
发表于 2003-11-24 14:56 | 显示全部楼层
应该是这个,我在VBA里这样调用的,
Sub aaa()
  Dim ws As WshShell
  Set ws = New WshShell
  ws.Popup "a", 2, "hello", 33
End Sub

本帖子中包含更多资源

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

x
 楼主| 发表于 2003-11-24 15:00 | 显示全部楼层
Good,你对了。
发表于 2003-11-24 16:49 | 显示全部楼层
;;非常好,有空再研究
(defun C:TT (/ WS USERNAME USERDOMAIN)
  (setq WS (vlax-create-object "wscript.network"))
  (alert
    (strcat "USERNAME= "
            (vlax-get-property WS 'USERNAME)
            "\n\nUSERDOMAIN= "
            (vlax-get-property WS 'USERDOMAIN)
            "\n\nCOMPUTERNAME= "
            (vlax-get-property WS 'COMPUTERNAME)
    )
  )
  (vlax-release-object WS)
)
发表于 2003-11-24 17:02 | 显示全部楼层
龙兄的那些对象的方法和属性都是这样从VB或VBA中去获得吗?
发表于 2003-11-25 08:00 | 显示全部楼层

  1. 可以這麼說,也就是把VB或VBA或 vb script & java script轉為vlisp格式

  2. 下列從網上找的儲存為: popup.js

  3. function showit(){
  4.     var Message = "Hello, World!";
  5.   var timeout = 0;
  6.   var title = "Hello, World!";
  7.   var buttons = 65;
  8.   var rslt;

  9.   var WS = WScript.CreateObject("WScript.Shell");
  10.   rslt = WS.Popup(Message, timeout, title, buttons);
  11.   if ( rslt == 2 ) {
  12.   WScript.Quit;
  13.   }
  14.   }
  15.   showit();

  16. 是不是很像秋楓兄的!!
复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-5-17 14:09 , Processed in 0.269248 second(s), 29 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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