Author Topic: Managed HotKeys  (Read 36331 times)

0 Members and 1 Guest are viewing this topic.

Chuck Gabriel

  • Guest
Re: Managed HotKeys
« Reply #15 on: June 16, 2006, 07:40:37 AM »
This appears to be where the error is occurring:
Code: [Select]
CmdActive cmdActive = (CmdActive)Application.GetSystemVariable("CMDACTIVE");

CmdActive is defined thusly:

Code: [Select]
        private enum CmdActive : int
        {
            CMDACTIVE_NONE = 0x0000,
            CMDACTIVE_ORDINARY = 0x0001,
            CMDACTIVE_ORDINARY_TRANSPARENT = 0x0002,
            CMDACTIVE_SCRIPT = 0x0004,
            CMDACTIVE_DIALOG = 0x0008,
            CMDACTIVE_AUTOLISP = 0x0010
        }

My first thought would be to store the return value from GetSystemVariable in an int rather than trying to cast it directly to one of the enum values.  Can anyone verify that?  I don't want to waste Andy's (or anyone else's time) blindly testing iteration after iteration of the code.

Regarding the demand loading Andy, you should have a key in your registry similar to this:

HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R15.0\ACAD-1:409\Applications\HotKeys.NET

If you do, could you export that key to a file and post it here?  If you don't have a key like that then the bug is more fundamental than I'm thinking.

BTW - What do you mean by "this isn't compatible?"

hudster

  • Gator
  • Posts: 2848
Re: Managed HotKeys
« Reply #16 on: June 16, 2006, 08:49:57 AM »
i've sent you a pm with the file attached.**edit** coulodn't get logged in to my lily pond account so i'll attach the zip here

by not compatible, I mean Autodesk re-wrote the arx components stuff for 2007, so some of the old arx stuff doesn't load anymore

I get this message when I try to load hotkeys.arx - C:\Program Files\AutoCAD 2007\acad.exeUnable to load AsdkHotKeys.arx file.

« Last Edit: June 16, 2006, 08:56:57 AM by Andy Hudson »
Revit BDS 2017, 2016, 2015, 2014, AutoCAD 2017, 2016, Navisworks 2017, 2016, BIM360 Glue

Chuck Gabriel

  • Guest
Re: Managed HotKeys
« Reply #17 on: June 16, 2006, 09:43:03 AM »
When i said this:

Incidentally, you should have to resort to the startup suite

I actually meant this:

Incidentally, you should not have to resort to the startup suite

Sorry.  Hope that didn't cause too much confusion.

Still, after looking at the info from your registry, I'm at a loss as to why demand loading isn't working.  Everything looks just like I think it should in the file you attached.

As to the other issue, if I don't hear from any of the other members about it, I'll go with my gut and post the updated code this evening (my time).

hudster

  • Gator
  • Posts: 2848
Re: Managed HotKeys
« Reply #18 on: June 16, 2006, 09:53:17 AM »
If I don't use netload and load the dll, none of the hotkey commands work, not even the keysconfig.
Revit BDS 2017, 2016, 2015, 2014, AutoCAD 2017, 2016, Navisworks 2017, 2016, BIM360 Glue

Chuck Gabriel

  • Guest
Re: Managed HotKeys
« Reply #19 on: June 16, 2006, 08:36:13 PM »
Here is a stab in the dark.

I'm still clueless about the demand loading issue.  Perhaps someone else will chime in with something that will break the case.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Managed HotKeys
« Reply #20 on: June 16, 2006, 08:42:44 PM »
Demand loading can be managed with a registry entry ..

I'm running at the moment .. will try to elucidate when I have time ..
... Have a look at the Layers managed interface demand load entry ..

added:
This may help

http://images.autodesk.com/adsk/files/AutoCAD_2006_API_Overview.ppt   <<<< about half way through the doc

more added:
Quote
[HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD\R16.2\ACAD-4001:409\Applications\AcLayer]
 "DESCRIPTION"="AutoCAD Layer Manager"
 "LOADER"="C:\\Program Files\\AutoCAD 2006\\aclayer.dll"
 "LOADCTRLS"=dword:0000000e
 "MANAGED"=dword:00000001

[HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD\R16.2\ACAD-4001:409\Applications\AcLayer\Commands]
 "LAYER"="LAYER"

[HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD\R16.2\ACAD-4001:409\Applications\AcLayer\Groups]
 "ACLAYER_CMDS"="ACLAYER_CMDS"

HKEY_LOCAL_MACHINE
    SOFTWARE
        Autodesk
            AutoCAD
                R16.2 <<<<  [ or whatever ]
                    [Your AutoCAD Version Key]
                        Applications
                            [Your app name]

Create the following values under the key:

DESCRIPTION = [A description of your app]
LOADER = [Full path to your assembly DLL]
MANAGED = 1 (dword)
LOADCTRLS = 2 (dword)

Look in the ObjectARX documentation for the values you can use for LOADCTRLS. The value 2 is used when you want your app to load when AutoCAD starts up.
« Last Edit: June 16, 2006, 08:55:35 PM by Kerry Brown »
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

--> Donate to theSwamp<--

Chuck Gabriel

  • Guest
Re: Managed HotKeys
« Reply #21 on: June 16, 2006, 09:34:43 PM »
Thanks Kerry.  MANAGED is not documented.  I assume that's what has been tripping me up.

LE

  • Guest
Re: Managed HotKeys
« Reply #22 on: June 16, 2006, 09:44:59 PM »
Do not know if for managed code the sample provided in the ARX SDK of polysamp could help.

Have a look into: samples\entity\polysamp\demandload directory

Glenn R

  • Water Moccasin
  • Posts: 1932
  • What idiot child of married cousins wrote this?!
Re: Managed HotKeys
« Reply #23 on: June 16, 2006, 09:46:30 PM »
Also Chuck, I think you will want to cast to a short instead of int...I've noticed this with sysvars that return int.
Me

Chuck Gabriel

  • Guest
Re: Managed HotKeys
« Reply #24 on: June 16, 2006, 09:52:14 PM »
Luis - I was missing the dword value named MANAGED, which apparently is required for managed apps but not for unmanaged, and is completely undocumented.

Glenn - Thanks for the tip.  I'll probably incorporate that into the next round of changes (I feel sure there will be one).

Bobby C. Jones

  • Swamp Rat
  • Posts: 516
  • Cry havoc and let loose the dogs of war.
Re: Managed HotKeys
« Reply #25 on: June 17, 2006, 11:53:38 PM »
Thanks Glenn.  I was thinking more of the people who might read this thread and think "What the heck is a HotKeys?"
What the heck is a HotKey, Chuck?

Modified: Added a comma after HotKey per my 14 y.o. daughter  :-D
« Last Edit: June 18, 2006, 12:20:07 PM by Bobby C. Jones »
Bobby C. Jones

Chuck Gabriel

  • Guest
Re: Managed HotKeys
« Reply #26 on: June 18, 2006, 10:27:59 AM »
Thanks Glenn.  I was thinking more of the people who might read this thread and think "What the heck is a HotKeys?"
What the heck is a HotKey Chuck?

AsdkHotKeys.arx is (and HotKeys.dll hopefully eventually will be) an ObjectARX application that allows users to assign actions to keystroke combinations in AutoCAD.  The main thing that sets it apart from standard AutoCAD keyboard accelerators is that it allows you to use the ALT key in your key combinations.  It has a couple of other unusual features that were actually requested by users (otherwise I would never have believed anyone would have wanted those features).

I wrote it for my own use, but then decided to give it away as a way of saying thanks to all the people in forums like this that had helped me learn what I needed to know to write it.

The original application was written in C++, which made it impractical for me to update it for new versions of AutoCAD, since I have not upgraded since 2000i.  Fortunately, when Autodesk forced developers to upgrade to Visual Studio 2002 Glenn R. generously offered to update the program for AutoCAD 2004.  That version continued to be usable through AutoCAD 2006 (or so I am told), but then Autodesk decided that it was again time to force developers to upgrade to Microsoft's latest development environment.  The managed API (and the free tools available to code for it) presented an opportunity for me to try to update the program myself without having to purchase any expensive development tools.  Unfortunately, I still can't test the application myself (AutoCAD 2000i).

Aren't you glad you asked? :D

hudster

  • Gator
  • Posts: 2848
Re: Managed HotKeys
« Reply #27 on: June 19, 2006, 03:53:26 AM »
still crashing whenever I try to use any hotkey I've setup.
Revit BDS 2017, 2016, 2015, 2014, AutoCAD 2017, 2016, Navisworks 2017, 2016, BIM360 Glue

Chuck Gabriel

  • Guest
Re: Managed HotKeys
« Reply #28 on: June 19, 2006, 07:01:39 AM »
Ok.  Let's try casting to a short per Glenn's suggestion then.


hudster

  • Gator
  • Posts: 2848
Re: Managed HotKeys
« Reply #29 on: June 19, 2006, 07:30:25 AM »
Hooray it's working.

Cheers Chuck, you've made my day. :-)

***Edit ***

It now autoloads as well
Revit BDS 2017, 2016, 2015, 2014, AutoCAD 2017, 2016, Navisworks 2017, 2016, BIM360 Glue