Skip to content
⌘ NSIS Forum Archive

PassDialog - Password SetFocus Problem

5 posts

andryou#

PassDialog - Password SetFocus Problem

Hi all,

I'd like to know how I can set focus to the password box (I am using the password-only parameter).

!define IDC_PASSWORD 1211
...
Function PasswordPageShow
 !insertmacro MUI_HEADER_TEXT "Enter Password" "Enter your password to continue."
 PassDialog::InitDialog /NOUNLOAD Password /HEADINGTEXT "Enter a password"
  Pop $R0 # Page HWND
  GetDlgItem $R1 $R0 ${IDC_PASSWORD}
  SendMessage $R1 ${EM_SETPASSWORDCHAR} 178 0
 PassDialog::Show
FunctionEnd 
Thanks!

I've searched through the forums, and tried the System::Call "user32::SetFocus(i r1, i 0x0007, i,i)i" code, but it doesn't seem to work.

I am using the PassDialog plugin: http://nsis.sourceforge.net/PassDialog_plug-in
kichik#
You passed SetFocus the wrong parameter and some extra unnecessary parameters. It's R1 and not r1 and the 3 extra parameters shouldn't be there.
System::Call user32::SetFocus(iR1)
andryou#
kichik,

Many thanks, I appreciate the reply =] Unfortunately, the code doesn't work, it still doesn't set focus to the password box.

Attached is my script. Can you please let me know where to place it?

Thanks! 🙂
kichik#
You override $R0 in your script with the HWND of the Next button. You also got IDC_PASSWORD wrong. It's 1214 and not 1211.