Application does not support just-in-time (JIT)
debugging. See the end of this message for details.
************** Exception Text **************
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for 'HotKeys.Main' threw an exception. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at HotKeys.AppRegistry.get_allowCapsLockMod()
at HotKeys.Main..ctor()
at HotKeys.Main..cctor()
--- End of inner exception stack trace ---
at HotKeys.Main.keysOn()
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at AcMgCommandClass.InvokeWorker(AcMgCommandClass* , MethodInfo mi, Object commandObject, Boolean bLispFunction)
at AcMgCommandClass.Invoke(AcMgCommandClass* , gcroot<System::Reflection::MethodInfo ^>* mi, Boolean bLispFunction)
at Autodesk.AutoCAD.Runtime.TargetInvocationSEHExceptionFilter.InvokeWorker()
at Autodesk.AutoCAD.Runtime.ExceptionFilter.Invoke()
************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
acdbmgd
Assembly Version: 17.0.54.0
Win32 Version: 17.0.54.0
CodeBase: file:///C:/Program%20Files/AutoCAD%202007/AcdbMgd.DLL
----------------------------------------
msvcm80
Assembly Version: 8.0.50608.0
Win32 Version: 8.00.50727.42
CodeBase: file:///C:/WINDOWS/WinSxS/x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.42_x-ww_0de06acd/msvcm80.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
acmgd
Assembly Version: 17.0.54.0
Win32 Version: 17.0.54.0
CodeBase: file:///C:/Program%20Files/AutoCAD%202007/acmgd.DLL
----------------------------------------
AcDxUi
Assembly Version: 17.0.54.0
Win32 Version: 17.0.54.0
CodeBase: file:///C:/Program%20Files/AutoCAD%202007/AcDxUi.DLL
----------------------------------------
AcDx
Assembly Version: 17.0.54.0
Win32 Version: 17.0.54.0
CodeBase: file:///C:/Program%20Files/AutoCAD%202007/AcDx.DLL
----------------------------------------
AcDxUi.resources
Assembly Version: 17.0.54.0
Win32 Version: 17.0.54.0
CodeBase: file:///C:/Program%20Files/AutoCAD%202007/en-US/AcDxUi.resources.DLL
----------------------------------------
AcMgdShared
Assembly Version: 17.0.54.0
Win32 Version: 17.0.54.0
CodeBase: file:///C:/Program%20Files/AutoCAD%202007/AcMgdShared.DLL
----------------------------------------
AcLayer
Assembly Version: 17.0.54.0
Win32 Version: 17.0.54.0
CodeBase: file:///C:/Program%20Files/AutoCAD%202007/AcLayer.DLL
----------------------------------------
AcLayer.resources
Assembly Version: 17.0.54.0
Win32 Version: 17.0.54.0
CodeBase: file:///C:/Program%20Files/AutoCAD%202007/en-US/AcLayer.resources.DLL
----------------------------------------
HotKeys
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Program%20Files/HotKeys2004/HotKeys.dll
----------------------------------------
Microsoft.VisualBasic
Assembly Version: 8.0.0.0
Win32 Version: 8.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualBasic/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
************** JIT Debugging **************
Application does not support Windows Forms just-in-time (JIT)
debugging. Contact the application author for more
information.
namespace DCS_3D
{
///
/// The entry point for Autocad, it get's called at least once
/// when you use 'Netload' to load and configure your application
/// There can only be one instance of inherited IExtensionApplication
/// per class library.
///
public class App : IExtensionApplication
{
public static string appPath;
public void
Initialize()
{
appPath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
//Let the user know what's happening while loading your app
//You could also alert user of failed loading operations here.
//load the hlr api:
Autodesk.AutoCAD.Runtime.SystemObjects.DynamicLinker.LoadModule("AsdkHlrApi16.dbx",true,true);
Utils.PrintMessage("\n Loading DCS_3D application...\n");
Utils.PrintMessage("\n Beta Version 0.1.6 2nd.June.2006.");
Utils.PrintMessage("\nEnter DCS3D to open DCS3D tools dialog:\n");
}
public void
Terminate()
{
//Nothing to put here yet!
}
}
}
UnloadedApps:AcLaunchNFWWS.arx(621a0000,b000);C:\Program Files\AutoCAD 2007\AcStar.arx(60170000,14000);
Clr Data:
at HotKeys.HookProcedures.keyboardProc(Int32 code, IntPtr wParam, IntPtr lParam) in C:\Documents and Settings\Chuck2000\My Documents\Visual Studio 2005\Projects\HotKeys\HotKeys\HookProcedures.cs:line 165
]]>
</AppCDATA>
<OpenGLInfo Vendor="ATI Technologies Inc." Renderer="RADEON 7500 DDR x86/SSE2" Version="1.3.4454 WinXP Release" />
</CERInfo>
CmdActive cmdActive = (CmdActive)Application.GetSystemVariable("CMDACTIVE");
private enum CmdActive : int
{
CMDACTIVE_NONE = 0x0000,
CMDACTIVE_ORDINARY = 0x0001,
CMDACTIVE_ORDINARY_TRANSPARENT = 0x0002,
CMDACTIVE_SCRIPT = 0x0004,
CMDACTIVE_DIALOG = 0x0008,
CMDACTIVE_AUTOLISP = 0x0010
}
Incidentally, you should have to resort to the startup suite
[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"
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?
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?
Woo Hoo!
Thanks Andy, Glenn, Kerry, Luis, and Mick for all your help and suggestions.
Mark - would it be alright if I direct folks who inquire about HotKeys to TheSwamp, or would you prefer that I host it from my own space?
// Check to see if a modal dialog box is active
// If so, ignore hotkeys
CmdActive cmdActive = (CmdActive)((short)Application.GetSystemVariable("CMDACTIVE"));
if ((cmdActive & CmdActive.CMDACTIVE_DIALOG) == CmdActive.CMDACTIVE_DIALOG)
return WindowsHook.CallNextHookEx(hHook, code, wParam, lParam);
...... Any suggestion how to get around it? For now, I'm using XML Notepad 2007 to edit the .xml file directly.
Kerry, did you run into the same problem before? Thanks.
--
Kelie
string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string cfgPath = Path.Combine(path, "yourXmlFileNameHere.xml");
...
XmlDocument cfgDoc = new XmlDocument();
cfgDoc.Load(cfgPath);
//Rest of mojo here...
(btw, just noticed .bmp file is not allowed as attachment here.)
I tried to set up Hotkeys on a new computer (from Dell). When using HotKeysEdit.exe, I got an error. Please see attched image. I'm guessing one of the old .ocx or .dll is missing or not registered properly on the new computer? Anyone has a clue?
Thanks!
(btw, just noticed .bmp file is not allowed as attachment here.)
), registered all them except for STDOLE2.TLB. (can't do it).
Kelie;
There is a tool here:
http://www.vbcodemagician.dk/resources/ccrpregutil.htm
Is anyone using Hotkeys with Civil3D? I tried compiling the project using acdbmgd.dll and acmgd.dll from C:\Program Files\Autodesk Civil 3D 2007. It reported 9 warnings, but no errors. After NETLOADing the dll, AutoCAD Civil3D 2007 crashes as soon as any hotkey combination is pressed. Any comments? Thanks!
Is anyone using Hotkeys with Civil3D? I tried compiling the project using acdbmgd.dll and acmgd.dll from C:\Program Files\Autodesk Civil 3D 2007. It reported 9 warnings, but no errors. After NETLOADing the dll, AutoCAD Civil3D 2007 crashes as soon as any hotkey combination is pressed. Any comments? Thanks!
I had problems with making HotKeys work in Vanilla 2007. I tried many things but only when I added HotKeys folder in Program Files in the AutoCAD's search path, it solved the problem. I don't know if this will work in Civil3D but it could be worth to try it.
Sorry Kelie. I know absolutley nothing about Civil3D.
I tried to set up Hotkeys on a new computer (from Dell). When using HotKeysEdit.exe, I got an error. Please see attched image. I'm guessing one of the old .ocx or .dll is missing or not registered properly on the new computer? Anyone has a clue?
Thanks!
(btw, just noticed .bmp file is not allowed as attachment here.)
i was able to fix this problem by installing the arx version (using the setup file HotKeys2004Setup_4.0.0.3.exe). since the arx version doesn't work with AutoCAD 2007, i uninstalled it right away. but the problem with HotKeyEdit was fixed.
Just noticed a problem. When editing MText (command MTEDIT), AutoCAD crashes if a hotkey combination is pressed. Error messge is:
FATAL ERROR: Unhandled e0434f4dh Exception at 7c812a5bh. Not sure if others have the same problem. It does not happen when editing Text or Block attributes. Thanks.
Kelie found a bug in the last version of HotKeys that I posted in this thread. Basically, key combinations that already have some action assigned to them by vanilla AutoCAD would do those actions in addition to whatever commands you assigned to them using HotKeys. I *think* the attached file will fix the bug. Please let me know if I am wrong.
Kelie found a bug in the last version of HotKeys that I posted in this thread. Basically, key combinations that already have some action assigned to them by vanilla AutoCAD would do those actions in addition to whatever commands you assigned to them using HotKeys. I *think* the attached file will fix the bug. Please let me know if I am wrong.
Chuck,
Can you tell me which part of the code is relevant to this problem? I looked through your code and could not spot it. The reason why I asked is because I would really like to get a working version of Hotkeys for Civil3D, but my C# knowledge is VERY limited. So I'm thinking of using a totally different approach: I'll use Python to monitor the key press event system wide, when a predefined key combination occurs, the corresponding commands will be sent to AutoCAD if the AutoCAD Application is active. It doesn't seem to be a difficult task, but I don't know how to turn off the default action associated with a particular key combination, such as "Alt+F" to pop up the "File" menu.
Thanks!
It's been a while, but I assume that bug must have been caused by returning the result of CallNextHook from the hook procedure rather than just returning 1.
Are you subclassing the AutoCAD window, or are you using hooks?
Can you post your code? I can muddle my way through Python code. I might be able to identify the problem.
Can you post your code? I can muddle my way through Python code. I might be able to identify the problem.
please see attached. i just started it and it is far from being a completed solution.
Say the definition is ALT+E for _ENDPOINT
The cursor actually locks up.
Press ESC and the selection continues with the correct snap set.
too brain dead to have a further look at it tonight :|
Hello Chuck,
I tried disabling the UAC last night. no joy.
I'll have another look tonight.
Thanks
Kerry.
public void Initialize()
{
try
{
//todo
}
catch (System.Exception ex)
{
Autodesk.AutoCAD.ApplicationServices.Application.
DocumentManager.MdiActiveDocument.Editor.
WriteMessage("\n{0}\n{1}", ex.Message, ex.StackTrace);
}
}
Great!
We should probable put this in a FAQ somewhere, if you use IExtensionApplication, add a try catchCode: [Select]public void Initialize()
{
try
{
//todo
}
catch (System.Exception ex)
{
Autodesk.AutoCAD.ApplicationServices.Application.
DocumentManager.MdiActiveDocument.Editor.
WriteMessage("\n{0}\n{1}", ex.Message, ex.StackTrace);
}
}
where is your xml file?
look under HKEY_CURRENT_USER\Software\ManagedHotKeys
quick fix, put a file called HotKeys.xml in my documents.
launch Acad and load dll.
use the keysconfig command to locate your personal xml
this should save the setting in the reg.
@ Chuck -- Rule #1749-5 of the programmers handbook, always test your code on a virgin machine :lol:
using System;
using System.IO;
using System.Xml;
using System.Text;
using System.Collections;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.ApplicationServices;
using System.Runtime.InteropServices;
namespace HotKeys
{
public class KeysFile
{
private Hashtable m_keyCombos;
private const String KEYS_FILE_NAME = "HotKeys.xml";
public KeysFile(Hashtable keyCombos)
{
m_keyCombos = keyCombos;
}
[DllImport("acad.exe", CharSet = CharSet.Auto, CallingConvention = CallingConvention.Cdecl)]
private static extern int acedFindFile(string fileName, string result);
public static String locateKeysFile()
{
// Will only be called if there is no entry in the registry
// First, try a Findfile
// alternatively in the Hotkeys Folder,
// alternatively in the Documents Folder
// revised kdub 2010.07.04
// try a Findfile in the Autocad searchPath, Current drawing Folder
String qualifiedFileName = string.Empty;
acedFindFile(KEYS_FILE_NAME, qualifiedFileName);
// else try in the Hotkeys Folder
if (qualifiedFileName == "")
{
String assemblyName = System.Reflection.Assembly.GetExecutingAssembly().Location;
String appDir = Path.GetDirectoryName(assemblyName);
String fn = appDir + "/" + KEYS_FILE_NAME;
if (System.IO.File.Exists(fn))
qualifiedFileName = fn;
}
// else try in the Documents Folder
if (qualifiedFileName == "")
{
String docFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
String[] fileNames = Directory.GetFiles(docFolder, KEYS_FILE_NAME, SearchOption.TopDirectoryOnly);
if (fileNames.Length != 0)
qualifiedFileName = fileNames[0];
}
if (qualifiedFileName != "")
AppRegistry.keysFileName = qualifiedFileName;
return qualifiedFileName;
}
public bool reload()
{
String keysFileName = AppRegistry.keysFileName;
if ((keysFileName == "") || !File.Exists(keysFileName))
keysFileName = locateKeysFile();
if (keysFileName == "")
return false;
m_keyCombos.Clear();
XmlDocument doc = new XmlDocument();
doc.PreserveWhitespace = true;
doc.Load(keysFileName);
XmlElement root = doc.DocumentElement;
XmlNodeList hotKeyElements = root.GetElementsByTagName("HotKey");
int len = hotKeyElements.Count;
foreach (XmlElement element in hotKeyElements)
{
XmlNode nodeModifiers = element.GetElementsByTagName("Modifiers").Item(0);
UInt16 modifiers = XmlConvert.ToUInt16(nodeModifiers.InnerText);
XmlNode nodeVkey = element.GetElementsByTagName("VirtualKey").Item(0);
UInt16 virtualKey = XmlConvert.ToUInt16(nodeVkey.InnerText);
UInt32 keyCombo = (UInt32)virtualKey | ((UInt32)modifiers << 16);
if (!m_keyCombos.ContainsKey(keyCombo))
{
XmlNode nodeCommand = element.GetElementsByTagName("Command").Item(0);
StringBuilder command = new StringBuilder(nodeCommand.InnerText);
command.Replace('|', '\n');
m_keyCombos.Add(keyCombo, command.ToString());
}
}
return true;
}
}
}
public void Initialize()
{
try
{
AppRegistry.initialize();
allowCapsLockMod = AppRegistry.allowCapsLockMod;
kbdHook.Install();
msgHook.Install();
keysOn();
docMan.MdiActiveDocument.Editor.WriteMessage(
"\nHotkeys_2010 are loaded.\n Commands: KeysOn, KeysOff, KeysToggle, KeysConfig, EditKeys");
}
catch (System.Exception ex)
{
docMan.MdiActiveDocument.Editor.WriteMessage("\n{0}\n{1}", ex.Message, ex.StackTrace);
}
}
They're pretty difficult to find Dan .... virgin machines I mean :)
(int)AppDomain.GetCurrentThreadId());
is depricated.
(int)AppDomain.GetCurrentThreadId());
is depricated.
System.Threading.Thread.CurrentThread.ManagedThreadId is what the compiler suggests in lieu of AppDomain.GetCurrentThreadId(). I can't remember for certain if that is what I tried. Wanna give it a go?
Say the definition is ALT+E for _ENDPOINT
The cursor actually locks up.
Press ESC and the selection continues with the correct snap set.
too brain dead to have a further look at it tonight :|
I'm not sure if this is the same problem you are experiencing, but I had a similar problem when I tested on AutoCAD 2009 if the menubar was displayed. The Alt key was trying to activate the pulldown menus. Here is the binary that fixes that bug.
Say the definition is ALT+E for _ENDPOINT
The cursor actually locks up.
Press ESC and the selection continues with the correct snap set.
too brain dead to have a further look at it tonight :|
I'm not sure if this is the same problem you are experiencing, but I had a similar problem when I tested on AutoCAD 2009 if the menubar was displayed. The Alt key was trying to activate the pulldown menus. Here is the binary that fixes that bug.
Chuck,
Would you happen to still have the source for this binary? Or could you share what you did to solve the problem. The binary didn't work with my 2011.
Thanks in advance!
Jeff
Command: editkeys
Editor not found.
I downloaded Kerry's files from here (http://www.theswamp.org/index.php?topic=10570.msg409779#msg409779), and Netloaded the ..\Release\*.dll (which seems to load fine), yet I am apparently missing something:Code: [Select]Command: editkeys
Editor not found.
The editor isn't in the zip file, so expect the editkeys command to flop if you don't already have an older version of HotKeys installed.
**Edit - Just remembered the post(s) about editing the XML manually... Perhaps I'm just doing this wrong... Do I modify the HOTKEYS.XML file (or a copy of)? And if so, what does VirtualKey 88 correlate to on the keyboard (for example)? *lost*
<HotKey>
<!--Alt ???-->
<Modifiers>1</Modifiers>
<!--C ???-->
<VirtualKey>67</VirtualKey>
<Command>_CEN </Command>
</HotKey>
If necessary I can make changes to the XML file for anyone who has problems.
.... may be a good chance to explain the actual structure :)
Kerry if you do a re-write would you use the Application.PreTranslateMessage event or would that work here?
Sounds like it's time to pull my finger out and re-write the editor as well ... perhaps it's a good excuse for a full re-write.
Kerry if you do a re-write would you use the Application.PreTranslateMessage event or would that work here?
Sounds like it's time to pull my finger out and re-write the editor as well ... perhaps it's a good excuse for a full re-write.
They show this as correct way here (http://adndevblog.typepad.com/autocad/2012/06/reacting-to-the-cursor-keys-properly-without-affecting-autocad-using-net.html) but seemed as easy here (http://www.theswamp.org/index.php?topic=39118.msg443316#msg443316)
Kerry -
Only because you mentioned having 2013 'working', would you by chance have the 2010 build available for those of us stuck back with 2010-2012 apps? :angel:
Here we go !
That build doesn't work (http://www.theswamp.org/index.php?topic=10570.msg469979#msg469979)... That's why I asked again. :wink:
That build doesn't work (http://www.theswamp.org/index.php?topic=10570.msg469979#msg469979)... That's why I asked again. :wink:
** Edit - Just saw that you added some attachments... Off to play. :lol:
BTW BlackBox/Renderman, I was able to load and use the Hotkeys[2010] in C3D2012 without a problem.
I get AutoCAD crashes when I use Ctrl-V, Ctrl-C etc when either the Command line or VLIDE have focus.
This does not happened prior to 2013.