Old 21st March 2009, 07:48   #1
zhfi
Junior Member
 
Join Date: Apr 2008
Posts: 18
Smile nsWindows plugin for NSIS

this plugin is modified on nsDialogs, support for window in nsis.

Most of it's macro is the same with nsDialogs, you just need to replace ${NSD_macro} with ${NSW_macro} in your script.

note: if you want to create more than one window at the same time, you need nsWindows.nsh, copy nsWindows.dll to nsis's plugins Directory, and replace "nsWindows::function" with "${nsWindows}::function" in your script.

Attached Files
File Type: 7z nswindows.7z (12.1 KB, 1035 views)

Last edited by zhfi; 21st March 2009 at 08:33.
zhfi is offline   Reply With Quote
Old 3rd April 2009, 12:36   #2
zhfi
Junior Member
 
Join Date: Apr 2008
Posts: 18
see blow.

Last edited by zhfi; 3rd April 2009 at 12:52.
zhfi is offline   Reply With Quote
Old 3rd April 2009, 12:47   #3
zhfi
Junior Member
 
Join Date: Apr 2008
Posts: 18
Wink

this is the fixed version of nsWindows.
the plugins, nsh head files and some examples were compressed in the nsWindows.7z documents.

a simple nsWindows's page examples like this:

;handle to window 3
var hwindow3

Function nsWindowsPage3
IsWindow $hwindow3 Create_End
${NSW_CreateWindow} $hwindow3 "WND 3" 1018
;set window pos
; ${NSW_SetWindowPos} $hwindow3 0 0
;set window size
${NSW_SetWindowSize} $hwindow3 200 100

${NSW_CenterWindow} $hwindow3 $hwndparent

;call back function of window 3
${NSW_OnBack} OnBack3

${NSW_CreateButton} 50 -30 50 18u 'WND 1'
Pop $R0
${NSW_OnClick} $R0 nsWindowsPage1

${NSW_CreateButton} 100 -30 50 18u 'WND 2'
Pop $R0
${NSW_OnClick} $R0 nsWindowsPage2

${NSW_Show}
Create_End:
ShowWindow $hwindow3 ${SW_SHOW}
FunctionEnd

Function OnBack3
${NSW_DestroyWindow} $hwindow3
FunctionEnd
Attached Files
File Type: 7z nswindows.7z (14.1 KB, 520 views)
zhfi is offline   Reply With Quote
Old 17th April 2009, 14:02   #4
zhfi
Junior Member
 
Join Date: Apr 2008
Posts: 18
Some thing improved for NSIS of Ansi version.
Attached Files
File Type: 7z nswindows_v2_ansi.7z (14.1 KB, 641 views)
zhfi is offline   Reply With Quote
Old 17th April 2009, 14:03   #5
zhfi
Junior Member
 
Join Date: Apr 2008
Posts: 18
Some thing improved for NSIS of Unicode version.
Attached Files
File Type: 7z nswindows_v2_unicode.7z (14.6 KB, 791 views)
zhfi is offline   Reply With Quote
Old 23rd December 2009, 13:52   #6
zhfi
Junior Member
 
Join Date: Apr 2008
Posts: 18
source code for the plugin is here:
http://ifififi.svn.sourceforge.net/s...fifi/nsWindows
zhfi is offline   Reply With Quote
Old 27th December 2009, 11:01   #7
zhfi
Junior Member
 
Join Date: Apr 2008
Posts: 18
ifififi.svn.sourceforge.net/viewvc/ifififi/nsWindows/
zhfi is offline   Reply With Quote
Old 20th October 2010, 16:24   #8
jiake
Senior Member
 
jiake's Avatar
 
Join Date: Oct 2007
Location: Xi'an, China
Posts: 206
Veru good plugin! Picks you up!
jiake is offline   Reply With Quote
Old 12th June 2012, 05:46   #9
dipal
Junior Member
 
Join Date: Mar 2012
Posts: 12
How to remove Titlebar from nsWindows??

I used nsWindows as custom messagebox, it works perfectly.

Now i want to remove the Titlebar. but not finding a way to do it.
Can anybody suggest how to achieve this..??

Please find attachment
Attached Thumbnails
Click image for larger version

Name:	nsWindows.bmp
Views:	820
Size:	774.5 KB
ID:	49716  
dipal is offline   Reply With Quote
Old 30th May 2014, 08:25   #10
stass
Senior Member
 
Join Date: Nov 2012
Posts: 145
After compiling have a message:

Quote:
Variable "insWindows" not referenced or never set, wasting memory!
What does this mean and what can be done?
stass is offline   Reply With Quote
Old 30th May 2014, 11:16   #11
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,891
Quote:
Originally Posted by stass View Post
What does this mean and what can be done?
It means exactly what is says.

Remove "Var insWindows" from the code...

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 30th May 2014, 11:52   #12
stass
Senior Member
 
Join Date: Nov 2012
Posts: 145
In my code, these variables - no. But they are in nsWindows.nsh.
What exactly should be removed there - I do not know ... Tell me please.
Here - nsWindows.nsh three options: http://www.mediafire.com/?dp3oo7427u2gptc
stass is offline   Reply With Quote
Old 30th May 2014, 13:17   #13
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,891
Are you calling NSW_CreateWindow?

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 31st May 2014, 08:31   #14
stass
Senior Member
 
Join Date: Nov 2012
Posts: 145
Quote:
Originally Posted by Anders View Post
Are you calling NSW_CreateWindow?
Yes, for example:
Quote:
outfile "nsWindows-test.exe"
!include "nsWindows.nsh"
Section
${NSW_SetWindowSize} $HWNDPARENT 700 300
SectionEnd
stass is offline   Reply With Quote
Old 6th June 2014, 17:18   #15
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,891
Quote:
Originally Posted by stass View Post
Yes, for example:
I said NSW_CreateWindow! That size function is just a helper function and you could look at it's code and make your own version that uses SetWindowPos if that is the only thing in that nsh that you are actually using.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 17th January 2017, 10:48   #16
Kuppy
Junior Member
 
Join Date: Sep 2016
Posts: 34
Create Popup Page with nsWindows

NSIS Show custom page with nsWindows

PHP Code:
# Copyright CatsSoft

!include MUI.nsh
!include LogicLib.nsh
!include WinMessages.nsh
!include FileFunc.nsh
!include nsWindows.nsh

Name 
"nsWindows Welcome"
OutFile "nsWindows Welcome.exe"

Page custom "nsDialogsWelcome"
Page instfiles ""

!insertmacro MUI_LANGUAGE English

LangString 
^ShowBtn ${LANG_ENGLISH"Show ..."
LangString ^BackBtn ${LANG_ENGLISH"Back ..."

Function .onInit
FunctionEnd

Function "nsDialogsWelcome"

  
# ...:: variables ::... #
 
  
var /GLOBAL Dialog
  
var /GLOBAL HEADLINE
  
var /GLOBAL Btn_Show

  GetDlgItem 
$0 $HWNDPARENT 1
  ShowWindow 
$${SW_HIDE}
  
GetDlgItem $0 $HWNDPARENT 2
  ShowWindow 
$${SW_HIDE}
  
GetDlgItem $0 $HWNDPARENT 3
  ShowWindow 
$${SW_HIDE}
  
GetDlgItem $0 $HWNDPARENT 1990
  ShowWindow 
$${SW_HIDE}
  
GetDlgItem $0 $HWNDPARENT 1991
  ShowWindow 
$${SW_HIDE}
  
GetDlgItem $0 $HWNDPARENT 1992
  ShowWindow 
$${SW_HIDE}

  
System::Call "user32::SetWindowPos(i$HWNDPARENT,i,i,i,i 632,i 466,i 0x16)"
  
nsDialogs::Create /NOUNLOAD 1044
  Pop $Dialog
  
${If} $Dialog == error
   Abort
  
${EndIf}
  
System::Call "user32::MoveWindow(i$Dialog,i0,i0,i 632,i 466,i0)"

  
nsDialogs::CreateControl /NOUNLOAD STATIC 0x40000000|0x10000000|0x04000000|0x00000100 0x00000020 2515% -130u 20u "Welcome to nsDialogs!"
  
Pop $HEADLINE

  CreateFont 
$"$(^Font)" 20 500
  SendMessage $HEADLINE 
${WM_SETFONT} $0 0

  
# ...:: BUTTON SHOW POPUP ::... #

  
nsDialogs::CreateControl /NOUNLOAD BUTTON 0x40000000|0x10000000|0x04000000|0x00010000 0 3055150u 35u ""
  
Pop $Btn_Show
  Strcpy 
$1 $Btn_Show
  GetFunctionAddress 
$"nsWindowsWelcome"
  
nsDialogs::onClick /NOUNLOAD $$3

  SendMessage $Btn_Show 
'${WM_SETTEXT}' '0' "STR:$(^ShowBtn)"

  
CreateFont $"$(^Font)" 20 500
  SendMessage $Btn_Show 
${WM_SETFONT} $0 0

  nsDialogs
::Show

FunctionEnd

Var Dlg
Var Btn_Back

Function "nsWindowsWelcome"
  
IsWindow $Dlg Show.Warning.Page
  IsWindow $Dlg 0 Warning
.Page
  ShowWindow $Dlg 
${SW_SHOW}
  
Abort
  Warning
.Page:
  
IsWindow $3 0 List.Page
  IntOp 
$$1
  
List.Page:

  
Strcpy $insWindows 0
  Strcpy $hnsWindows 0

  nsWindows
::Create /NOUNLOAD $HWNDPARENT $${ExStyle0x80000000 "" 1018
  Pop $Dlg
  StrCpy 
$3 $Dlg

  ShowWindow $Dlg 
${SW_HIDE}

  
System::Call user32::SetWindowPos(i$Dlg,i0,i0,i0,i632,i466,i0x0002)

  
ShowWindow $HWNDPARENT ${SW_HIDE}

  
nsWindows::CreateControl /NOUNLOAD STATIC 0x40000000|0x10000000|0x04000000|0x00000100 0x00000020 2515% -130u 20u "Welcome to nsWindows!"
  
Pop $HEADLINE

  CreateFont 
$"$(^Font)" 20 500
  SendMessage $HEADLINE 
${WM_SETFONT} $0 0

  
# ...:: BACK ::... #

  
nsWindows::CreateControl /NOUNLOAD BUTTON 0x40000000|0x10000000|0x04000000|0x00010000 0 3055150u 35u ""
  
Pop $Btn_Back
  Strcpy 
$1 $Btn_Back
  GetFunctionAddress 
$"On.Click.Back"
  
nsWindows::onClick /NOUNLOAD $$3

  SendMessage $Btn_Back 
'${WM_SETTEXT}' '0' "STR:$(^BackBtn)"

  
CreateFont $"$(^Font)" 20 500
  SendMessage $Btn_Back 
${WM_SETFONT} $0 0

  Push $R0
  System
::Call /NOUNLOAD "*(i, i, i, i) i.s"
  
Pop $R0
  System
::Call /NOUNLOAD "User32::GetWindowRect(i, i) i ($Dlg, R0)"
  
System::Call /NOUNLOAD "*$R0(i .s, i .s, i .s, i .s)"
  
Pop $0
  Pop 
$1
  Pop 
$2
  Pop 
$3
  IntOp $R1 
$- $0
  IntOp $R2 
$- $1
  System
::Call /NOUNLOAD "User32::GetWindowRect(i, i) i ($HWNDPARENT, R0)"
  
System::Call /NOUNLOAD "*$R0(i .s, i .s, i .s, i .s)"
  
System::Free $R0
  Pop 
$0
  Pop 
$1
  Pop 
$2
  Pop 
$3
  IntOp $R3 
$- $0
  IntOp $R4 
$- $1
  IntOp $R3 $R3 
$R1
  IntOp $R3 $R3 
2
  IntOp $R4 $R4 
$R2
  IntOp $R4 $R4 
2
  IntOp $R3 
$$R3
  IntOp $R4 
$$R4
  System
::Call user32::SetWindowPos(i$Dlg,i0,i$R3,i$R4,i0,i0,i0x0001)
  
Pop $R0

  nsWindows
::Show

  Show
.Warning.Page:
  
ShowWindow $Dlg ${SW_SHOW}
  Return
FunctionEnd

# ...:: RETURN MAIN PAGE ::... #

Function "On.Click.Back"
  
EnableWindow $hwndparent 1
  ShowWindow $HWNDPARENT 
${SW_SHOW}
  
BringToFront
  System
::Call user32::DestroyWindow(i$Dlg)
  Return
FunctionEnd

Section
  SetAutoClose False
SectionEnd 
Kuppy is offline   Reply With Quote
Old 7th July 2018, 16:52   #17
zhfi
Junior Member
 
Join Date: Apr 2008
Posts: 18
Smile

updated on 2011/04/13
fixed some problem in nsWindows.nsh
Attached Files
File Type: 7z nsWindows_Ansi_v2.7z (25.3 KB, 61 views)
File Type: 7z nsWindows_Unicode_v2.7z (26.5 KB, 60 views)
zhfi is offline   Reply With Quote
Old 8th July 2018, 03:47   #18
zhfi
Junior Member
 
Join Date: Apr 2008
Posts: 18
all sources code here:
https://svn.code.sf.net/p/ifififi/code/ ifififi-code
zhfi is offline   Reply With Quote
Old 10th October 2018, 08:15   #19
ahmett
Junior Member
 
Join Date: Jan 2008
Posts: 8
@zhfi,
I just wondering that why you add below code into the header file?

So after I faced some plugins directory problems, I just removed the code below and replaced ${nsWindows} with NSWindows and it works fine with natural plugin directory that comes with NSIS3.0.3.

Thank you for this excellent plugin.

code:
;
!echo "Generating nsWindows temp plugins..."
!ifndef nsWindows_warning
!warning "Note: nsWindows.dll must be put in NSIS's Plugins Directory!"
!define nsWindows_warning
!endif
!system 'md "${NSISDIR}\Plugins\nsWindows.tmp\"'
!system 'copy /B /-Y "${NSISDIR}\Plugins\nsWindows.dll" "${NSISDIR}\Plugins\nsWindows.tmp\${nsWindows}.dll"'
!echo "Generating finished!"
;
!AddPluginDir "${NSISDIR}\Plugins\nsWindows.tmp\"
ReserveFile "${NSISDIR}\Plugins\nsWindows.tmp\${nsWindows}.dll"

ahmett is offline   Reply With Quote
Old 10th October 2018, 10:11   #20
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,891
I have no idea why a plug-in header would have crazy copy code like that. Header file code should not write to ${NSISDIR}, it could be read-only for non-admins!

IntOp $PostCount $PostCount + 1
Anders 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