Old 8th March 2005, 13:05   #1
sjanarth
Junior Member
 
Join Date: Mar 2005
Posts: 7
Modern UI Abort

Hi,

I am trying to call abort from one of my callbacks as shown below :

!define MUI_CUSTOMFUNCTION_GUIINIT .ShowSplash
!define MUI_PAGE_CUSTOMFUNCTION_PRE CheckPrevInstall
!insertmacro MUI_PAGE_WELCOME

Function CheckPrevInstall
Push $0
ReadRegStr $0 ${REGROOT} ${REGKEY} ""
StrCmp $0 "" CheckMore
PromptUnInstall:
MessageBox MB_YESNO|MB_ICONQUESTION "A previous version of SWFAudio was found.\
$\n$\nIt is recommended that you uninstall it first.$\n$\nDo you want to do that now?" IDNO NoUnInstall IDYES UnInstall
UnInstall:
ExecWait '$0\Uninstall.exe $R0'
MessageBox MB_OK|MB_ICO
sjanarth is offline   Reply With Quote
Old 8th March 2005, 13:08   #2
sjanarth
Junior Member
 
Join Date: Mar 2005
Posts: 7
[The previous one didn't get posted properly, sending again]

Hi,

I am trying to call abort from one of my callbacks as shown below :

!define MUI_CUSTOMFUNCTION_GUIINIT .ShowSplash
!define MUI_PAGE_CUSTOMFUNCTION_PRE CheckPrevInstall
!insertmacro MUI_PAGE_WELCOME

Function CheckPrevInstall
Push $0
ReadRegStr $0 ${REGROOT} ${REGKEY} ""
StrCmp $0 "" CheckMore
PromptUnInstall:
MessageBox MB_YESNO|MB_ICONQUESTION "A previous version of SWFAudio was found.\
$\n$\nIt is recommended that you uninstall it first.$\n$\nDo you want to do that now?" IDNO NoUnInstall IDYES UnInstall
UnInstall:
ExecWait '$0\Uninstall.exe $R0'
MessageBox MB_OK|MB_ICONINFORMATION "Click OK to continue installing ${MUI_PRODUCT}."
Goto ExitFunction
NoUnInstall:
Abort
CheckMore:
ReadRegStr $0 ${REGROOT} ${ALTREGKEY} ""
StrCmp $0 "" ExitFunction
Goto PromptUnInstall
ExitFunction:
Pop $0
FunctionEnd

Basically am trying to check if a previous version of my app
is installed and if yes, prompt the user to uninstall it first.

If the user chooses not to Uninstall, i need to abort the main installation.

Please help me with this,.

Thanks,
Sathish.
sjanarth is offline   Reply With Quote
Old 8th March 2005, 13:09   #3
sjanarth
Junior Member
 
Join Date: Mar 2005
Posts: 7
Clicking "No" on the "Confirm UnInstall" message box proceeds with the main install and doesn't abort.
sjanarth is offline   Reply With Quote
Old 8th March 2005, 13:41   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Your Function needs cleaning up...
code:

Function CheckPrevInstall
Push $0

ReadRegStr $0 ${REGROOT} ${REGKEY} ""
StrCmp $0 "" 0
ReadRegStr $0 ${REGROOT} ${ALTREGKEY} ""
StrCmp $0 "" ExitFunction

PromptUnInstall:

MessageBox MB_YESNO|MB_ICONQUESTION "A previous version of SWFAudio was found.\
$\n$\nIt is recommended that you uninstall it first.$\n$\nDo you want to do that now?" IDNO ExitFunction
ExecWait '$0\Uninstall.exe $R0'

MessageBox MB_OK|MB_ICONINFORMATION "Click OK to continue installing ${MUI_PRODUCT}."

ExitFunction:
Pop $0
FunctionEnd



-Stu
Afrow UK is offline   Reply With Quote
Old 9th March 2005, 04:24   #5
sjanarth
Junior Member
 
Join Date: Mar 2005
Posts: 7
Thanks for the reply.

But am afraid that doesn't abort the installation!

My original problem still persists even if i use the code modified as below:

Function CheckPrevInstall2
Push $0
ReadRegStr $0 ${REGROOT} ${REGKEY} ""
StrCmp $0 "" 0 PromptUnInstall
ReadRegStr $0 ${REGROOT} ${ALTREGKEY} ""
StrCmp $0 "" ExitFunction
PromptUnInstall:
MessageBox MB_YESNO|MB_ICONQUESTION "A previous version of SWFAudio was found.\
$\n$\nIt is recommended that you uninstall it first.$\n$\nDo you want to do that now?" IDNO DoAbort
ExecWait '$0\Uninstall.exe $R0'
MessageBox MB_OK|MB_ICONINFORMATION "Click OK to continue installing ${MUI_PRODUCT}."
Goto ExitFunction
DoAbort:
Abort
ExitFunction:
Pop $0
FunctionEnd

Please help.
sjanarth is offline   Reply With Quote
Old 9th March 2005, 09:59   #6
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Oh I thought you wanted it to run the uninstaller and wait for it to finish, and then continue with installation?
That's what my code does.

If you want it to run the uninstaller and then quit, use Exec not ExecWait, and Quit not Abort.

-Stu
Afrow UK is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump