找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 2122|回复: 0

ObjectARX Technical Newsletter - June 2000

[复制链接]

已领礼包: 145个

财富等级: 日进斗金

发表于 2002-1-7 02:22:26 | 显示全部楼层 |阅读模式

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

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

×
ObjectARX Technical Newsletter - June 2000  
This document is part of    ObjectARX Newsletter Archive     


ObjectARX Technical Newsletter - June 21st 2000
===============================================
/Note: Have you missed a Newsletter issue? Visit our Newsletter archive at
the following URL:/

http://adn.autodesk.com/techsupp/techsupp/docs/newsletters.htm

Dear ObjectARX developer,

Note: Welcome to the June 2000 edition of the ObjectARX Technical
Newsletter. First let us apologize to those of you who were expecting
a May 2000 edition of the ObjectARX Technical Newsletter. We did
not post an ObjectARX newsletter for May 2000. This was due to the
implementation and roll out of the brand new and redesigned ADN
Technical web site. Please take a visit and inspect the new ADN
web site for yourself. We hope you like it.

http://www.autodesk.com/adn
  

Table of contents:
==================
  
1- How to veto application QUIT and/or document close in ObjectARX 2000
2- Starting an OEM 2000 product through automation.
3- Preventing toolbar customization in OEM 2000 products.
4- Announcing ADN e-Learning Courses on Autodesk e-Learning Website!
  
  
1- How to veto application QUIT and/or document close in ObjectARX 2000
-----------------------------------------------------------------------

QUESTION:

How can I intercept and veto the QUIT and CLOSE commands in AutoCAD 2000?
In AutoCAD R14, redefining the QUIT and CLOSE commands works in all cases.
However, in AutoCAD 2000 it works if the commands are typed, but they do
not work from the menu (File -> Exit) or if the application is
"terminated" using the "X" window button. How can I intercept and veto
QUIT and CLOSE in these cases? In R14, redefining QUIT command works
in all cases. However, in R2000 it works OK if the command is typed,
but it doesn't work from the menu (File->Exit) or if the application is
"terminated" using "X" window button. How can I intercept and possibly
veto QUIT in these cases? Also, the same problem exists when redefining
document CLOSE command. How can I intercept and possibly veto CLOSE in
all cases?
  

ANSWER:

It is true that due to the MDI implementation in R2000, only typed QUIT
and CLOSE can be redefined. There are solutions for other cases and some
are not straightforward. To systematically cover all the cases, let's first
summarize how the AutoCAD application (app) can be QUIT-ed, and how a
document (doc) can be CLOSE-ed:

APP1. typed QUIT command
APP2. AutoCAD menu File->Exit
APP3. "X" button on the app frame
APP4. Window menu -> Close (or Alt+F4) - if you click on the window icon
      in top left corner, or right-click app taskbar icon or window frame.

DOC1. typed CLOSE command
DOC2. AutoCAD menu File->Close
DOC3. "X" button on the doc window frame
DOC4. Window menu -> Close (or Ctrl+F4) - if you click on the doc window
      icon in top left corner

If you only want to do some clean-up operations, the simplest solution
covering all the above cases is to use AcEditorReactor::beginQuit() for
APP1-4 and AcEditorReactor::beginClose(AcDbDatabase* pDwg) for DOC1-4.

If you want to veto the application QUIT process, the following will
work for ALL cases APP1-4. You do not have to redefine QUIT command at
all, just add the following editor reactor as shown in the following
code fragment:

<code_begin>
// AsdkTheEditorRctr derived from AcEditorReactor
void AsdkTheEditorRctr::beginQuit()
{
  //...
  veto();
}
<code_end>

Unfortunately, you CANNOT veto document CLOSE in the same manner in
beginClose() - it would return and error status of eNotApplicable.
Also you cannot veto CLOSE in
AcApDocManagerReactor::documentToBeDestroyed(AcApDocument* pDoc) reactor.
Additionally you CANNOT veto CLOSE by sending a CANCEL command in
AcEditorReactor::commandWillStart(). Therefore for the CLOSE operation,
we need to resolve each case DOC1-4. The following is a summary and code
details are in the attached project.

DOC1: Use standard UNDEFINE command to undefine CLOSE. In ARX, you would
typically do this in the InitApplication() function, use ads_queueexpr().

DOC2: UNDEFINE will not work here, so you need standard Acad message
filter (see acedRegisterFilterWinMsg()). Monitor for WM_COMMAND with
ID_FILE_CLOSE.

DOC3: Neither UNDEFINE nor acedRegisterFilterWinMsg() work here. You
need to trap WM_SYSCOMMAND (not passed to acedRegisterFilterWinMsg())
with SC_CLOSE. You must use standard Windows hook of WH_CBT type
(::SetWindowsHookEx(WH_CBT,...).

DOC4: same as DOC3.
  

The following URL is for Developer Note 56977 on the ADN WEB site is
the project that demonstrates implementation details. The application
defines the SETVETO command to toggle app QUIT and/or doc CLOSE
vetoing. There are a number of message boxes displayed to clarify
the execution flow. There are also indications where APP2-4 cases
can be alternatively covered, since redefining QUIT would cover
only APP1. In the CBTHook() callback function for windows hook,
there are number of calculations to verify if the SC_CLOSE is for
application or document. Note that different sub-cases of
APP4 and DOC4 yield different messages but some may still be
impossible to distinguish (e.g. Alt+F4). DOC3 case also produces
completely different message if the window is zoomed (maximized)
when no mouse coordinates are passed in. All this is redundant
if you are not interested in what is being SC_CLOSE-ed
(see the code comments).

/cgi-bin/solution.pl?SID=56977
  
  
2- Starting an OEM 2000 product through automation.
---------------------------------------------------

AutoCAD OEM does not expose an Application object, so you cannot
access it from another application. What you need to do is access
your ARX module directly. Here's what you need to do:

First, you need to setup the registry so the CLSID of the top level
object in your ARX application is registered as LocalServer implemented
by your product's EXE.

You need to make the ARX application load on startup. The best way to do
this is to make your ARX application a required module.

Lastly, in the kInitAppMsg for the ARX application, register the class
factory of your top level object with CoRegisterClassObject() and add
an instance of your top level object as the active object with
RegisterActiveObject().

As your ARX application is no longer a local server, you will not need
DllRegisterServer(), DllCanUnloadNow() etc.

Take a look at the PolySamp sample application to see how this is done,
or you follow the link below to see just the relevant code.

/cgi-bin/solution.pl?SID=54842
  

3- Preventing toolbar customization in OEM 2000 products.
---------------------------------------------------------

If you've disabled menu customization in your OEM 2000 product, the
toolbars can still be modified if you right-click on them and choose
"Customize" from the context menu. This works fine only for this
editing session, but when the product is closed and restarted it will
only display the default menu, which will have none of your commands
you added with the "Customize" dialog for the previous session.

The reason for this is because modifying the toolbars rewrites the MNS
file, making the MNS file newer than the MNC file. This tells AutoCAD
and OEM that the MNC file needs to be recompiled, but since menu
customization is turned off there is no way for the product to recompile
the menu, so it resorts to it's default menu.

If this happens, you can get the full menu back by altering the dates on
either the MNC or MNS file. It doesn't matter which one you change as
long as the MNC file more recent than the MNS file. Of course, the custom
toolbars will be lost, but the full menu will return.

There really isn't any way to fully disable toolbar customization with
the OEM APIs because the right-click menu is hard-coded into the engine
and cannot be changed. Since you can't change the actual engine code,
one way around this is to use the Win32 API to intercept the
WM_RBUTTONUP and WM_RBUTTONDOWN messages. If they are being sent to a
toolbar (a window who's class is ToolbarWindow32), then you will just
return without passing that message along. By filtering in this manner,
right-clicking will have no effect over toolbars but will still work
in the drawing area or the text window.
  

4. Announcing ADN e-Learning Courses on Autodesk e-Learning Website!
--------------------------------------------------------------------

ADN e-Learning courses are now available on the Autodesk e-Learning
Website at the following URL:

http://www.autodesk.com/e-learning

The main features of the website include (see the related Press Release)
at the following URL:

http://www3.autodesk.com/adsk/item/0,,282165,00.html

Bringing together online courses, e-courseware, and virtual classroom
training in a one-stop website*

Providing access to the courses to all of our Autodesk partners and users
(including non-ADN members)

Some free preview courses to get you started.

More than 2,600 courses on operating systems, database, network
administration, programming, strategic planning, communications,
management, and more besides courses on Autodesk products.

We now have e-Learning modules with HTML and streaming audio for
2 ObjectARX2000 labs, 2 Visual LISP lessons and an introductory module
for Actrix Technical API on the Autodesk e-Learning website.

We will continue to roll out more and more ADN courses on this website,
in the coming weeks.

*Presently, ADN material is only provided as online training material
on the Autodesk e-Learning website.

Actions:

Please test drive free courses for your team
http://www.headlight.com/promo/sign_others_up/1,1346,ad-,00.html

Please test drive free courses for yourself
http://www.headlight.com/promo/b ... ,1606,ad-74,00.html

Please familiarize yourself with the customization area of the web site
http://www.headlight.com/browse_channels/0,1036,ad-675,00.html

Consider participating in the relevant chat session
http://adn.autodesk.com/techsupp/training/ecschedule.htm

We welcome your feedback on the material and what material and chat sessions
you need most in the future.

Please e-mail <adn-training-worldwide@autodesk.com> with your input.

Please watch this space for future material, chat schedules and more
information on the ADN e-Learning program.

-----------------------------------------------------------------------------
To subscribe or unsubscribe, go to
http://adn.autodesk.com/techsupp/techsupp/docs/newsletters.htm
-----------------------------------------------------------------------------

     You received this message as a result of your registration
     on the ADN List Server subscription page.  If you no longer wish
     to receive these messages, read the next section, How to use this
     mailing list.

     How to use this mailing list:

     You may unsubscribe from this e-mail newsletter, or subscribe to
     a variety of other informative e-mail newsletters, by returning
     to the ADN List Server subscription page at
       http://adn.autodesk.com/techsupp/techsupp/docs/newsletters.htm
     and changing your subscription preferences.

     Alternatively, from the subscribed account you can send an e-mail to
     <Majordomo-partnersys@autodesk.com> with the following command in the
     body of your email message:

     unsubscribe <list-name>

     ----------------------------------------------------------------------

     Autodesk Developer Network (ADN) information and events:

     For information on all ADN topics, please visit:
       http://www.autodesk.com/adn

     ----------------------------------------------------------------------

     THIS DOCUMENT IS PROVIDED FOR INFORMATIONAL PURPOSES ONLY.  The
     information contained in this document represents the current view of
     Autodesk Inc. on the issues discussed as of the date of publication.
     Because Autodesk must respond to change in market conditions, it
     should not be interpreted to be a commitment on the part of Autodesk
     and Autodesk cannot guarantee the accuracy of any information
     presented after the date of publication.
     INFORMATION PROVIDED IN THIS DOCUMENT IS PROVIDED 'AS IS' WITHOUT
     WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT
     LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
     PARTICULAR PURPOSE AND FREEDOM FROM INFRINGEMENT.
     The user assumes the entire risk as to the accuracy and the use of
     this document. This  document may be copied and distributed subject to
     the following conditions:
     1.   All text must be copied without modification and all pages must
          be included
     2.   All copies must contain Autodesk's copyright notice and any other
          notices provided therein
     3.   This document may not be distributed for profit

     ----------------------------------------------------------------------
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2024-11-22 00:10 , Processed in 0.357156 second(s), 31 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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