Skip to content
⌘ NSIS Forum Archive

Help on this system sintax code

4 posts

Joel#

Help on this system sintax code


!define _MB_OK 0x0
!define MB_USERICON 0x80
!define TYPES '${_MB_OK}|${MB_USERICON}'
!define MSGBOXPARAMS '(i, i, i, t, t, i, t, i, i, i) i'

System::Call 'User32::GetWindowLong(i $HWNDPARENT, i -6) i .r0'
System::Call 'Kernel32::LoadLibrary(t "moricons.dll") i .r1'
IntCmp $1 0 Err 0 0
#System::Call 'User32::LoadIcon(i r1, i 32) i .r2'
System::Call 'User32::LoadIcon(i 0, i 32514) i .r2'
System::Call '*${MSGBOXPARAMS}(40, $HWNDPARENT, r0, "A MessageBox created with system plugin", "Hi", ${TYPES}, r2, 0, 0, 0) .r3'
System::Call 'User32::MessageBoxIndirect(&i r3) v r4'
System::Call 'User32:😁estroyIcon(i r2) v r4'
System::Call 'Kernel32::FreeLibrary(i r1) v r4'
System::Free $3
Err:
The code display the messagebox, with the title, text and theh MB_OK button, but no icon 🙁
What am I missing? Thanks!
Anders#
You shouldnt call LoadIcon, MSGBOXPARAMS wants the hInst and RESOURCE ID not handle

I dont think u can OR the type flags together like that, just use 0x80

try:

!define MSGBOXPARAMS '(i, i, i, t, t, i, i, i, i, i) i'
#System::Call 'User32::GetWindowLong(i $HWNDPARENT, i -6) i .r0'
System::Call 'Kernel32::LoadLibrary(t "moricons.dll") i .r1'
IntCmp $1 0 Err 0 0
System::Call '*${MSGBOXPARAMS}(40, $HWNDPARENT, $1, "blah", "Hi", 0x80, 32, 0, 0, 0) .r3'
System::Call 'User32::MessageBoxIndirect(&i r3) v r4'
System::Call 'Kernel32::FreeLibrary(i r1) v r4'
System::Free $3
Err:
Joel#
Yay, done 😁

!define MSGBOXPARAMS '(i, i, i, t, t, i, t, i, i, i) i'

System::Call 'Kernel32::LoadLibrary(t "moricons.dll") i .r1'
IntCmp $1 0 Err Err 0
System::Call '*${MSGBOXPARAMS}(40, $HWNDPARENT, r1, "A MessageBox created with system plugin", "Hi", 0x80, i 20, 0, 0, 0) .r3'
System::Call 'User32::MessageBoxIndirect(i r3) v r4'
System::Call 'Kernel32::FreeLibrary(i r1) v r4'
System::Free $3

Err: