<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to ask for a password on the command line of AutoCAD 2013 using ObjectAR in ObjectARX Forum</title>
    <link>https://forums.autodesk.com/t5/objectarx-forum/how-to-ask-for-a-password-on-the-command-line-of-autocad-2013/m-p/3649116#M14236</link>
    <description>&lt;P&gt;Try this: &lt;A href="http://adndevblog.typepad.com/autocad/2012/06/asking-for-a-password-on-the-command-line-of-autocad-using-objectarx.html" target="_blank"&gt;http://adndevblog.typepad.com/autocad/2012/06/asking-for-a-password-on-the-command-line-of-autocad-using-objectarx.html&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 06 Oct 2012 09:58:30 GMT</pubDate>
    <dc:creator>Alexander.Rivilis</dc:creator>
    <dc:date>2012-10-06T09:58:30Z</dc:date>
    <item>
      <title>How to ask for a password on the command line of AutoCAD 2013 using ObjectARX?</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/how-to-ask-for-a-password-on-the-command-line-of-autocad-2013/m-p/3649084#M14235</link>
      <description>&lt;P&gt;How can I ask for a password, replacing each keystroke with a generic character, on the command line of &lt;STRONG&gt;AutoCAD 2013&lt;/STRONG&gt; using ObjectARX?&lt;BR /&gt;&lt;BR /&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Sat, 06 Oct 2012 07:35:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/how-to-ask-for-a-password-on-the-command-line-of-autocad-2013/m-p/3649084#M14235</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-10-06T07:35:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to ask for a password on the command line of AutoCAD 2013 using ObjectAR</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/how-to-ask-for-a-password-on-the-command-line-of-autocad-2013/m-p/3649116#M14236</link>
      <description>&lt;P&gt;Try this: &lt;A href="http://adndevblog.typepad.com/autocad/2012/06/asking-for-a-password-on-the-command-line-of-autocad-using-objectarx.html" target="_blank"&gt;http://adndevblog.typepad.com/autocad/2012/06/asking-for-a-password-on-the-command-line-of-autocad-using-objectarx.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 06 Oct 2012 09:58:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/how-to-ask-for-a-password-on-the-command-line-of-autocad-2013/m-p/3649116#M14236</guid>
      <dc:creator>Alexander.Rivilis</dc:creator>
      <dc:date>2012-10-06T09:58:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to ask for a password on the command line of AutoCAD 2013 using ObjectAR</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/how-to-ask-for-a-password-on-the-command-line-of-autocad-2013/m-p/3649184#M14237</link>
      <description>&lt;P&gt;Thanks Alexander, but &lt;STRONG&gt;the solution in adndevblog fails in AutoCAD 2013&lt;/STRONG&gt;. Look the comment by Thierry Prince below the solution.&lt;/P&gt;</description>
      <pubDate>Sat, 06 Oct 2012 12:34:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/how-to-ask-for-a-password-on-the-command-line-of-autocad-2013/m-p/3649184#M14237</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-10-06T12:34:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to ask for a password on the command line of AutoCAD 2013 using ObjectAR</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/how-to-ask-for-a-password-on-the-command-line-of-autocad-2013/m-p/3658474#M14238</link>
      <description>&lt;P&gt;Hi Jose,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using hooks is a hack that is not generally advisable to use. If you have the option, switch over to a UI to take that input&amp;nbsp;which you are&amp;nbsp;trying to mask. That way you will not need to use hooks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However if you still need to go this route, then here is a code snippet based on the low level keyboard hooks. Hope this helps. I havent tested it very extensively but seems to work in general using AutoCAD 2013.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the sample code :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;static ACHAR password[133]; 
static int pwdLen; 
static HHOOK hKeyboardHook;

// - AdskMyTest1.MyCommand1 command (do not rename)
static void AdskTestCommand(void)
{
	ACHAR pwd[133];   
	adskGetPassword(1, ACRX_T("Password please ?"), pwd);	
}

static int adskGetPassword(int cronly,ACHAR* prompt,ACHAR* result)
{
	pwdLen = 0;
	password[pwdLen]='\0';
	HINSTANCE hInstance = GetModuleHandle(NULL);
	if (!hInstance) 
		return 1;

	hKeyboardHook = SetWindowsHookEx ( 
										WH_KEYBOARD_LL, 
										(HOOKPROC) KeyboardEvent, 
										hInstance, 
										NULL 
										);
		
	ACHAR tempResult[133];
	int ret = acedGetString(cronly, prompt, tempResult);

	UnhookWindowsHookEx(hKeyboardHook);

	if(ret != RTNORM)
		acutPrintf(ACRX_T("\nCancelled."));
	else
	{
		password[++pwdLen] = '\0';
		acutPrintf(password);
	}

	wcscpy(result, password);

	return ret;
}

static LRESULT CALLBACK KeyboardEvent (int nCode, WPARAM wParam, LPARAM lParam)
{
	if ((nCode == HC_ACTION) &amp;amp;&amp;amp; 
	((wParam == WM_SYSKEYDOWN) || 
	(wParam == WM_KEYDOWN))) 
	{
		KBDLLHOOKSTRUCT hooked_key = *((KBDLLHOOKSTRUCT*)lParam);
		DWORD dwMsg = 1;
		dwMsg += hooked_key.scanCode &amp;lt;&amp;lt; 16;
		dwMsg += hooked_key.flags &amp;lt;&amp;lt; 24;
		int key = hs.vkCode;
		if ((key &amp;gt;= 'A' &amp;amp;&amp;amp; key &amp;lt;= 'Z')  || (key &amp;gt;= '0' &amp;amp;&amp;amp; key &amp;lt;= '9'))
		{
			GetKeyNameText(dwMsg, &amp;amp;password[pwdLen], 0xFF) + 1;
			password[++pwdLen] = '\0';
			keybd_event(VK_MULTIPLY, hooked_key.scanCode, hooked_key.flags, 0);
			return 1;
		}
		else if(hooked_key.vkCode == VK_BACK)
		{
			password[--pwdLen] = '\0';
		}
	}
	return CallNextHookEx(hKeyboardHook, nCode,wParam,lParam);
}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 13 Oct 2012 16:36:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/how-to-ask-for-a-password-on-the-command-line-of-autocad-2013/m-p/3658474#M14238</guid>
      <dc:creator>Balaji_Ram</dc:creator>
      <dc:date>2012-10-13T16:36:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to ask for a password on the command line of AutoCAD 2013 using ObjectAR</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/how-to-ask-for-a-password-on-the-command-line-of-autocad-2013/m-p/3658494#M14239</link>
      <description>&lt;P&gt;Thanks Balaji for your reply. The code works well with some corrections:&lt;/P&gt;&lt;P&gt;The line&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800000" face="courier new,courier"&gt;int key = hs.vkCode;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;must be&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF" face="courier new,courier"&gt;int key = hooked_key.vkCode;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;and the line&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800000" face="courier new,courier"&gt;GetKeyNameText(dwMsg, &amp;amp;password[pwdLen], 0xFF) + 1;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;must be&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;FONT color="#0000FF"&gt;GetKeyNameText(dwMsg, &amp;amp;password[pwdLen], 0xFF)&lt;/FONT&gt;;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 13 Oct 2012 18:05:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/how-to-ask-for-a-password-on-the-command-line-of-autocad-2013/m-p/3658494#M14239</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-10-13T18:05:37Z</dc:date>
    </item>
  </channel>
</rss>

