Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   components / image preview (http://forums.winamp.com/showthread.php?t=451577)

o_owd 31st August 2017 12:06

components / image preview
 
Hey,

At the component selection page, is it possible to show an image in a separate window based on what component is selected?
I found on Google something similar for Inno but not for NSIS - https://i.stack.imgur.com/IPKm4.jpg

Thanks.

Kuppy 4th September 2017 14:40

1 Attachment(s)
I used the nsWindows.dll plug-in, but some malfunctions I can not fix, and whoever knows better can fix the problems.
1. Move the popup window to the main window
2. Close the popup automatically when you move the mouse to another component

PHP Code:

!define APP "My Setup"
!define INIT
!define COMPONENTS

# DETAILS #

Name "${APP}"
OutFile "${APP}.exe"
InstallDir "$TEMP\${APP}"
Caption "${APP}"

# COMPRESS #

SetCompressor /SOLID /FINAL lzma

# EXEC LEVEL #

RequestExecutionLevel 'User'

# RUNTIME SWITCHES #

ShowInstDetails hide
ShowInstDetails nevershow
ShowUnInstDetails nevershow
AutoCloseWindow true 

# INCLUDE #

!include "MUI.nsh"
!include "WinCore.nsh"
!include "nsWindows.nsh"
!include "FileFunc.nsh"
!include "LogicLib.nsh"
!include "WinMessages.nsh"
!insertmacro GetOptions

# STYLE #

BrandingText /TRIMRIGHT " "

# PAGE #

!define MUI_CUSTOMFUNCTION_GUIINIT "onGuiInit"
!insertmacro MUI_PAGE_WELCOME
!ifdef OPTIONS COMPONENTS
  
!define MUI_COMPONENTSPAGE_NODESC
  
!define MUI_COMPONENTSPAGE_INTERFACE
  
!define MUI_COMPONENTSPAGE_SMALLDESC
  
!insertmacro MUI_PAGE_COMPONENTS
!endif
!
insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH

# LANGUAGE #

!insertmacro MUI_LANGUAGE "English"

# INIT #

Function ".onInit"
  
InitPluginsDir
  SetOverwrite 
try
  
AllowSkipFiles off
  File 
`/ONAME=$PLUGINSDIR\001.bmp` `Images\001.bmp`
  
File `/ONAME=$PLUGINSDIR\002.bmp` `Images\002.bmp`

  
# INIT
 
  
!ifdef INIT
    Call Init
  
!endif
FunctionEnd

Function "onGuiInit"

FunctionEnd

var /GLOBAL ERROR

Section 
"-${APP}Main
  Strcpy $insWindows 0
  Strcpy $hnsWindows 0

  SetDetailsPrint textonly
  DetailPrint 
`Installing ... Please wait ...`
  
SetDetailsPrint listonly
  SetDetailsView hide

  SectionIn RO

  CreateDirectory $INSTDIR
    SetOutPath 
"$INSTDIR"
     
File "Installer.nsi"

  
Goto +2
   StrCpy $ERROR 
"true"
  
SetAutoClose true
SectionEnd

!ifdef COMPONENTS
    SectionGroup 
"${APP} Select"

      
Section /"${APP} Free" Free

      SectionEnd

      Section 
/"${APP} Professional" Professional
        IfFileExists 
"$INSTDIR\${APP}.exe" "" +4
            SetOutPath 
"$INSTDIR"
                
;File "Professional\Register.dll"
      
SectionEnd

    SectionGroupEnd
!endif

Function .
onSelChange
    
!insertmacro StartRadioButtons $1
    
!insertmacro RadioButton "${Free}"
    
!insertmacro RadioButton "${Professional}"
    
!insertmacro EndRadioButtons
FunctionEnd

!ifdef INIT
    
Function Init
           
var /GLOBAL REQUIREDSIZE
        
; === Destroy size lol ===

        
StrCpy $0 0
        
${If} ${SectionIsSelected} $0
                SectionGetSize 
$${Main} $1
                SectionGetSize 
$${Free} $1
                SectionGetSize 
$${Professional} $1
            IntOp 
$$+ $1
        
${EndIf}    
        
InTop $$1024 KBytes -> Bytes
        IntOp 
$$1000000
        IntOp 
$$1000000
        StrCpy 
$$2 2 0
        IntOp 
$$1048576
        IntOp 
$$1048576
        StrCpy 
$$4 2 0
        SectionSetSize 
$${Main"0" ;use ($1,$2 MB) ;or ($3,$4 MB)
        
Strcpy $REQUIREDSIZE '$3,$4 MB'
        
SectionSetSize $${Main0
        SectionSetSize 
$${Free"0"
        
SectionSetSize $${Professional"0"

        
; === Other actions ===
        
StrCpy $${Free}
    
FunctionEnd
!endif

Function 
ShowPictFreeVersion
  
var /GLOBAL FREE
  
var /GLOBAL BGImage

  nsWindows
::Create /NOUNLOAD $HWNDPARENT $${ExStyle0x80000000 "" 1018
  Pop $FREE

  System
::Call user32::SetWindowPos(i$FREE,i0,i0,i0,i497,i322,i0x0002)

  
# Background

  
nsWindows::CreateControl /NOUNLOAD STATIC 0x10000000|0x40000000|0x04000000|0x0000000E 0 0 0 100100""
  
Pop $BGImage
  Push 
$0
  Push $R0
  StrCpy $R0 $BGImage
  System
::Call "user32::LoadImage(i 0, ts, i 0, i0, i0, i0x0010) i.r0" "$PLUGINSDIR\001.bmp"
  
SendMessage $R0 0x0172 0 $0
  Pop $R0
  Exch 
$0

  nsWindows
::Show

FunctionEnd

Function ShowPictProVersion
  
var /GLOBAL PRO

  nsWindows
::Create /NOUNLOAD $HWNDPARENT $${ExStyle0x80000000 "" 1018
  Pop $PRO

  System
::Call user32::SetWindowPos(i$PRO,i0,i0,i0,i497,i322,i0x0002)

  
# Background

  
nsWindows::CreateControl /NOUNLOAD STATIC 0x10000000|0x40000000|0x04000000|0x0000000E 0 0 0 100100""
  
Pop $BGImage
  Push 
$0
  Push $R0
  StrCpy $R0 $BGImage
  System
::Call "user32::LoadImage(i 0, ts, i 0, i0, i0, i0x0010) i.r0" "$PLUGINSDIR\002.bmp"
  
SendMessage $R0 0x0172 0 $0
  Pop $R0
  Exch 
$0

  nsWindows
::Show

FunctionEnd

# MOUSE

Function '.onMouseOverSection'
        
FindWindow $R0 "#32770" "" $HWNDPARENT
        GetDlgItem $R0 $R0 1043 
description item
        
${If} $== -1
              CreateFont 
$"Arial" 9 500 create the font for the default description

              SetCtlColors $R0 0x5f5f61 0xF0F0F0
              SendMessage $R0 
${WM_SETFONT} $1 0
              EnableWindow $R0 0
                  SendMessage $R0 
${WM_SETTEXT"STR:Position your mouse over a component to see its description."
           
System::Call user32::DestroyWindow(i$FREE)
           
System::Call user32::DestroyWindow(i$PRO)
        ${Else}
            
CreateFont $"Arial" 9 400 create the font for mouse over descriptions

        SetCtlColors $R0 0x5f5f61 0xF0F0F0
            SendMessage $R0 
${WM_SETFONT} $1 0
            EnableWindow $R0 1
        
${If} $== 0
              SendMessage $R0 
${WM_SETTEXT"STR:Select components for this program"

        
${ElseIf} $== 1

              SendMessage $R0 
${WM_SETTEXT"STR:Select components for this program"

        
${ElseIf} $== 2
            System
::Call user32::DestroyWindow(i$PRO)
            
Call ShowPictFreeVersion
              SendMessage $R0 
${WM_SETTEXT"STR:Install ${APP} Free Version"

        
${ElseIf} $== 3
            System
::Call user32::DestroyWindow(i$FREE)
            
Call ShowPictProVersion
              SendMessage $R0 
${WM_SETTEXT"STR:Install ${APP} Pro Version"

        
${ElseIf} $== 4

        
${EndIf}

        ${EndIf}
FunctionEnd 



All times are GMT. The time now is 17:45.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.