找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 1091|回复: 5

[求助]:在非模式对话框中怎么控制一个函数的执行

[复制链接]
发表于 2003-9-24 21:56:18 | 显示全部楼层 |阅读模式

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

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

×
我在用非模式对话框时发现有以下几点问题,请大家指教:
1.  如果在非模式对话框中放一个按扭,点按扭时执行: acedSSGet(...) 函数, 当我按下按扭后,不选择对象(但此时acedSSGet 函数已执行).由于是非模式对话框,我还可以继续点按扭,当点的次数很多时,系统就出错了

  我想在第二次点按扭时,如果前一个按扭没有完成任务(这可以判断出来),就终止前一个任务,执行这个新的任务,就像发送一个ESC消息一样,怎么办

2.  在非模式对话框中放一个按扭,按扭执行:  acedPrompt("....") ,当提示完成后,我想让命令行回到原始状态,即"命令:  " ,  如果就简单在acedPrompt("\n.....\n",好象不行,请指教

我最近做了一个和AuotCAD2004中properties命令一样的对话框,谁有兴趣的,和我联系
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
发表于 2003-10-9 20:16:57 | 显示全部楼层
这就是命令的嵌套问题。命令嵌套不可超过4次!
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

已领礼包: 1个

财富等级: 恭喜发财

发表于 2009-9-17 22:32:04 | 显示全部楼层
最近我在找这个,但看不明白
http://www.xdcad.net/forum/showthread.php?postid=9956#post9956
如何在MFC“非模式”对话框使用acedGetXXX函数和ACAD交互
How can I use ads_getxxx() functions from a MFC modeless dialog box ?
ID 2125
Applies to: AutoCAD

Date 6/19/2000

This document is part of MFC


Question
How can I use ads_getXXX() functions from an MFC modeless dialog box?
Answer
Your code will work properly if you call ads_getXXX() functions directly from an
MFC modeless dialog box handler function because AutoCAD sends the
WM_ACADKEEPFOCUS message to your dialog at the same time you are in the handler
function where you want to make an ads_getpoint(). Then when you pick a point,
you send a WM_LBUTTONDOWN message which goes in the window message queue as
well. But this message does not proceed until you came back to AutoCAD. After
you have come back, the message proceeds. Then you need to give two points where
onlyy one error occurs. This is why AutoCAD asks for the other corner.

Another problem is that modeless windows may try to execute code at the same
time an AutoCAD command is running. This will produce some errors and may cause
AutoCAD to terminate unexpectedly. The reason is that modeless windows have
their own message loop, and while AutoCAD is busy, you must not call any AutoCAD
function. AutoCAD is not design to run in that context.

To solve these problems, move the code contained into this handler function into
a standalone ARX command / function. Then from the button handler function, you
can send a WM_COPYDATA message to AutoCAD to invoke this command which will do
the job.

1. When the button is pressed, the button handler function code is executed. You
need to do the following:
-- hide the dialog
-- change my WM_ACAD_KEEPFOCUS handler function to return FALSE
-- give the focus to the AutoCAD main frame window
-- use the acedGetAcadFrame ()->PostMessage(WM_SETFOCUS, 0L, 0L) method
-- send the WM_COPYDATA message to the main AutoCAD frame window with the
command name (myfunc, for example)

2. In the myfunc function (defined as an ARX command), then perform these steps:
-- put all the code you need to acquire a point
-- post a custom user message (WM_USER+1, for example) to your dialog with the
point in the LPARAM as parameter

3. In the handler of the WM_USER+1 message, perform these steps:
-- change my WM_ACAD_KEEPFOCUS handler function to return TRUE again
-- show the dialog, and give the focus to it
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

已领礼包: 1个

财富等级: 恭喜发财

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

使用道具 举报

已领礼包: 1个

财富等级: 恭喜发财

发表于 2009-10-5 20:44:35 | 显示全部楼层
已经解决了,做成单循环就行
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

发表于 2009-11-17 10:42:49 | 显示全部楼层
做一下文档锁定,同时自己控制前一次命令未结束时候不执行下一个命令

static BOOL bIsRunging=FALSE;
if( bIsRunging==FALSE)
{
     bIsRunging=TRUE;
    文档锁定

    在此填写你的处理代码。

    文档解锁
     bIsRunging=FALSE;
}
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-9-24 10:15 , Processed in 0.439661 second(s), 43 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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