 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
drcode
Joined: 14 May 2007 Posts: 8
|
Posted: Mon May 14, 2007 5:43 am Post subject: Send password to Edit with hide |
|
|
Hi All
I want to send password with hide text, I use :
ControlSend,Edit1,MyPassword,Untitled - Notepad
I want to hide the Text that I send like:
Control, Style,-0x20,
Any idea? |
|
| Back to top |
|
 |
Grumpy Guest
|
Posted: Mon May 14, 2007 9:01 am Post subject: |
|
|
Sorry, but I don't understand what you want to do exactly. Is Notepad just an example? Are you targetting some other control in an application?
Also I don't understand what the Control Style, -0x20 is supposed to do, pure numbers are not very expressive... |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 8688
|
Posted: Mon May 14, 2007 9:28 am Post subject: |
|
|
ES_PASSWORD is 0x20
Do you want to flag notepad's edit control with with +0x20 so that the entire text is asterisked ?  |
|
| Back to top |
|
 |
drcode
Joined: 14 May 2007 Posts: 8
|
Posted: Mon May 14, 2007 9:42 am Post subject: I have Edit1 with password |
|
|
Hi
I don't mean notepad , I took notepad has example, I have software that have Edit1 with password that show up to users, I want to mask this password.
I use controlsend to send the password, is there way to make it mask?
Thanx
drcode |
|
| Back to top |
|
 |
Grumpy Guest
|
Posted: Mon May 14, 2007 10:06 am Post subject: |
|
|
Thanks Skan, I missed it as there are numerous styles starting with 0x20, that's why I complained.
If you want to set this style, use +0x20, not -0x20
I tried:
| Code: | appTitle = AutoHotkey Help
Control Style, +0x20, Edit2, %appTitle%
ControlSetText Edit2, foo, %appTitle%
| but it doesn't work (I see 'foo'), it might be a style needing to be set before creating the control. Maybe for security reasons, it might be annoying to be able to remove this style... |
|
| Back to top |
|
 |
drcode
Joined: 14 May 2007 Posts: 8
|
Posted: Mon May 14, 2007 11:48 am Post subject: so is there other idea? |
|
|
it dosnt work , is there other idea?
Thanx
DrCode |
|
| Back to top |
|
 |
Grumpy Guest
|
Posted: Mon May 14, 2007 12:34 pm Post subject: |
|
|
That's what I wrote...
Another idea is to hide the control (Control Hide) or to mask it with a little GUI. |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 8688
|
Posted: Mon May 14, 2007 12:35 pm Post subject: Re: so is there other idea? |
|
|
| drcode wrote: | | is there other idea? |
Sure.
1) Run Autohotkey help and select the Index tab.
2) Run the following code
| Code: | EM_SETPASSWORDCHAR := 0xCC
ES_PASSWORD := 0x20
PASSWORDCHAR := "*"
appTitle = AutoHotkey Help
ControlGet, cHwnd, Hwnd,, Edit1, %appTitle%
Control, ExStyle, +0x20, ,ahk_id %cHwnd%
SendMessage, EM_SETPASSWORDCHAR, Asc(PASSWORDCHAR), 0,, ahk_id %cHwnd% |
PS: This looks like a candidate for my TipsNTricks |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 8688
|
Posted: Mon May 14, 2007 12:36 pm Post subject: |
|
|
| Grumpy wrote: | | Maybe for security reasons, it might be annoying to be able to remove this style... |
It can be done: http://www.nirsoft.net/vb/passrev.html
 |
|
| Back to top |
|
 |
Grumpy Guest
|
Posted: Mon May 14, 2007 12:48 pm Post subject: |
|
|
It doesn't work for me, neither your code (with Edit1, Search tab, or Edit2, Index tab) nor the simplified:
| Code: | appTitle = AutoHotkey Help
Control ExStyle, +0x20, Edit2, %appTitle%
SendMessage 0xCC, Asc("*"), 0, Edit2, %appTitle%
msgbox %errorlevel%
ControlSetText Edit2, foo, %appTitle%
Return
| For some reason, on my system (WinXP Pro SP2), I get a FAIL on SendMessage. In your code, the cHwnd looks OK. |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 8688
|
Posted: Mon May 14, 2007 12:50 pm Post subject: |
|
|
Oh! I will check it in XP and post again.  |
|
| Back to top |
|
 |
Grumpy Guest
|
Posted: Mon May 14, 2007 12:51 pm Post subject: |
|
|
| Not really, ie. it doesn't change the style but it resets the password char. |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 8688
|
Posted: Mon May 14, 2007 12:58 pm Post subject: |
|
|
The following works for me in Win XP SP2
| Code: | EM_SETPASSWORDCHAR := 0xCC
ES_PASSWORD := 0x20
PASSWORDCHAR := "*"
appTitle = AutoHotkey Help
ControlGet, cHwnd, Hwnd,, Edit2, %appTitle%
Control, ExStyle, +0x20, ,ahk_id %cHwnd%
SendMessage, EM_SETPASSWORDCHAR, Asc(PASSWORDCHAR), 0,, ahk_id %cHwnd% |
The only change in code is Edit2 for Index which was Edit1 for me in Win 2000.
After running the code, minimize and maximize the CHM once.
I guess there must be drawing problems.
 |
|
| Back to top |
|
 |
Grumpy Guest
|
Posted: Mon May 14, 2007 1:03 pm Post subject: |
|
|
That's what I tried, and even with your hidding trick, it doesn't work (FAIL on SendMessage). Note that's what is done in the link you gave: the InvalidateRect refreshes the control.
Did you tried with a SP2 XP? It might be a new security thingy. |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 8688
|
Posted: Mon May 14, 2007 1:08 pm Post subject: |
|
|
| Grumpy wrote: | | Did you tried with a SP2 XP? It might be a new security thingy. |
The system properties read as:
Microsoft Windows XP
Professional
Version 2002
Service Pack 2
Can anybody else confirm whether this stuff works ( or does not work ) in XP ? |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|