engine
3rd August 2006 20:20 UTC
System::Call "How to call User32.dll's API GetKeyboardLayoutList"
Hello everyone.
I am writing a IME intaller with NSIS.
I want to call User32.dll's API GetKeyboardLayoutList with the System plugin. but, I don't know how to write.
I think the script should be..
...
System::Call "user32.dll::GetKeyboardLayoutList(???)??"
...
I am a novice at NSIS.:( It is too difficult for me to use system.dll now.
Anybody can help me?
Thanks very much.:)
engine
4th August 2006 20:12 UTC
:( There is nobody gave reply to my problem. why?:(
kichik
4th August 2006 20:26 UTC
It'd be easier with a plug-in, because of the array management. But if you really wish...
System::Call 'user32::GetKeyboardLayoutList(i 0, i 0) i .r0'
IntOp $1 $0 * 4
System::Alloc $1
Pop $2
System::GetKeyboardLayoutList(i r0, i r2)
# $2 is a pointer to the handles list
# $0 is its length
Of course some error handling is needed...
engine
4th August 2006 20:52 UTC
Thank you, kichik.
I have noticed that you are one of the best here.
Your answer helps a lot. I need to have a try myself now.
Is NsisArray.dll the plugin you just referred to? It looks that it will make the work much easier.
Thanks again.
kichik
4th August 2006 20:54 UTC
NSISArray.dll won't help you here. You need direct memory access, not string arrays. You'll need to manipulate the array pointer and read the values one by one.
engine
4th August 2006 21:29 UTC
Forgive my stupidity.:)
I have to analyze it seriously right away.
I am sorry for my poor English. :(
engine
4th August 2006 23:39 UTC
MessageBox MB_OK "Test Start... "
System::Call 'user32::GetKeyboardLayoutList(i 0, i 0)i .r0'
IntOp $1 $0 * 4
System::Alloc $1
Pop $2
System::Call 'user32::GetKeyboardLayoutList(i r0, i r2)i .r0'
StrCpy $1 1
loop:
System::Call '*$2(i .R1)'
IntFmt $R1 "%08X" $R1
ReadRegStr $R2 HKLM \
"SYSTEM\CurrentControlSet\Control\Keyboard Layouts\$R1" "Layout Text"
StrCpy $R1 "0x$R1"
MessageBox MB_OK "($1/$0) --> $R1 $R2"
StrCmp $1 $0 done
IntOp $1 $1 + 1
IntOp $2 $2 + 4
Goto loop
done:
MessageBox MB_OK "Test End! "
Well done in this test means that the big problem in uninstall section of my IME package has been resolved!
My Best Regards to kichik.:) Thank you very very much!