deguix
29th February 2004 21:46 UTC
Dialog APIs
I tried to use it using System.dll, but without success. Its structure is more complex than other ones I saw before:
!define _OPENFILENAME "(i, i, i, t, t, i, i, t, i, t, i, t, t, i, i, i, t, t, t, t, v, i, i) i"
>FindWindow $0 "#32770" "" $HWNDPARENT
System::Call "*${_OPENFILENAME}(400, r0,,,,, 0, 'Test.exe', 256,, 256, 'C:\', 'Open Test',,,,'exe',,,, 0,,) .r0"
>System::Call "Comdlg32::GetOpenFileNameA(t) i(r0) e.r1"
Everytime I try to change it and use "GetLastError" API after, GetLastError returns 71-75.
I really need this, I'm using a ListBox with several sound files to play, and if the user wants to change one of them, he/she needs to click in a button to appear the "Open File" dialog.
I have:
WinXP
NSIS Latest Development version from today.
(I'm trying the Color Dialogbox, but not sufficient to debug it yet)
eccles
29th February 2004 23:35 UTC
Re: Dialog APIs
System::Call "Comdlg32::GetOpenFileNameA(t) i(r0) e.r1"
I've not studied it all, but at first glance this line seems wrong. I think it should be ...GetOpenFileNameA(
i)...
deguix
1st March 2004 22:03 UTC
Nope, it continues not working...
eccles
3rd March 2004 23:21 UTC
I've managed to get a working test version.
I think the problem might be that "t" paramaters are only meant for function parameters directly, not structure members. All structure members that point to strings have to be allocated separately.
It's only the most basic example, but hopefully you get the idea.
Name "GetOpenFileName Test"
OutFile GetOpenFileName.exe
Section
SetPluginUnload alwaysoff
System::Alloc ${NSIS_MAX_STRLEN}
Pop $1
System::Call "*(&l4, i$HWNDPARENT, i, i, i, i, i, \
ir1, i${NSIS_MAX_STRLEN}, i, i, i, i, \
i, &i2, &i2, i, i, i, i) i.r0"
System::Call "comdlg32::GetOpenFileNameA(ir0) i.r9"
IntCmp $9 0 failed
System::Call "*$1(&t${NSIS_MAX_STRLEN}.r9)"
MessageBox MB_OK $9
failed:
System::Free $0
SetPluginUnload manual
System::Free $1
SectionEnd
deguix
4th March 2004 03:08 UTC
Great! Thanks eccles!