Old 20th May 2004, 12:01   #1
s793016
Junior Member
 
s793016's Avatar
 
Join Date: Dec 2003
Location: Taiwan
Posts: 33
Send a message via ICQ to s793016
Could I Change "CAPTION" at run-time?

Sorry, my English is very very poor.

I want to show "current run windows version" inside "Main Install Window Title".

Unfortunally, "Caption" & "SubCaption" & "NAME" could not exist inside a function.

I do want to change Main Install Window Title at run-time phase.

Does anyone known any other way to do that?

Thank you very much.
s793016 is offline   Reply With Quote
Old 20th May 2004, 12:11   #2
Joost Verburg
NSIS MUI Dev
 
Join Date: Nov 2001
Posts: 3,717
Use the System plug-in to call this API:

http://msdn.microsoft.com/library/de...WindowText.asp
Joost Verburg is offline   Reply With Quote
Old 20th May 2004, 13:20   #3
s793016
Junior Member
 
s793016's Avatar
 
Join Date: Dec 2003
Location: Taiwan
Posts: 33
Send a message via ICQ to s793016
Thanks for replay. I tried this:
code:

OutFile "NewWinverTest.exe"
Name "NewWinverTest"
Caption "New Winver Test"
XPStyle "on"

Section "-bbo" b2
Sectionin RO
;
SectionEnd

Function ".onInit"
StrCpy $1 "$windir"
IfFileExists "$1\winver.exe" +2
StrCpy $1 "$sysdir"
GetDllVersion "$1\winver.exe" $R0 $R1
IntOp $R2 $R0 / 0x00010000
IntOp $R3 $R0 & 0x0000FFFF
IntOp $R4 $R1 / 0x00010000
IntOp $R5 $R1 & 0x0000FFFF
StrCpy $0 "Ver is $R2.$R3.$R4.$R5"
System::Call 'USER32::SetWindowTextA(i $HWNDPARENT, *t r0) i r1'
messagebox mb_ok "Ver = $R2.$R3.$R4.$R5"
Quit
FunctionEnd



And the Window Caption still not changed.

Is there something wrong from my code?
s793016 is offline   Reply With Quote
Old 22nd May 2004, 15:39   #4
s793016
Junior Member
 
s793016's Avatar
 
Join Date: Dec 2003
Location: Taiwan
Posts: 33
Send a message via ICQ to s793016
After a deep search to this forum, I got some poor idea from this article.
==
First part: Main Install Program

Thanks to "rsegal", it really worked. And you find it's limit, too.

So I must add pre_page_call to every pages.
code:

Page license ResetCaption
Page directory ResetCaption
Page components ResetCaption
Page instfiles ResetCaption
UninstPage uninstConfirm un.ResetCaption
UninstPage instfiles un.ResetCaption

!macro ResetCaption InstPhase
Function "${InstPhase}ResetCaption"
SendMessage $HWNDPARENT ${WM_SETTEXT} 0 "STR:$RunTimeCaption"
FunctionEnd
!macroend

!insertmacro ResetCaption ""
!insertmacro ResetCaption "un."


==
Second part: MessageBOX

Looks like there is no way to got a HWND with MessageBOX.

So I must use Win32API to handle all MessageBOX through SYSTEM Plug-in.
code:

!include "${NSISDIR}\Contrib\System\System.nsh"
!include "WinMessages.nsh"

Var MsgButton

!define MessageBOX "!insertmacro MessageBOX"

!macro MessageBox MyButton MyBoxIcon MyContent MyCaption
push $1
StrCpy $1 '${MyBoxIcon}'
StrCmp $1 '' 0 +2
StrCpy $1 '${MB_OK}'
IntOP $1 ${MyButton} + $1
System::Call 'user32::MessageBoxA(i $HWNDPARENT, t "${MyContent}", t "${MyCaption}", i "$1") i .s'
pop $MsgButton
pop $1
!macroend



Useage:
${MessageBOX} "Buttons" "icons" "Window Text here" "Window Title hehe"

Return (inside $MsgButton):
1 = ok
2 = cancel
3 = abort
4 = retry
5 = ignore
6 = yes
7 = no

Ex. changed from NSIS MessageBOX.
Before: MessageBox MB_OK|MB_ICONEXCLAMATION "$(MSG_POSTINST)"
After: ${MessageBox} "${MB_OK}" "${MB_ICONEXCLAMATION}" "$(MSG_POSTINST)" "Run-time Caption Here"
==
That's all poor idea from me.

If you got a better way to do it, please post it to forum, thank you.
s793016 is offline   Reply With Quote
Old 22nd May 2004, 22:11   #5
deguix
Major Dude
 
deguix's Avatar
 
Join Date: Dec 2002
Location: Everett - MA, USA
Posts: 1,354
Send a message via ICQ to deguix
Remove Icons, rename Buttons to Styles, as you can combine the styles naturally with NSIS MessageBox command, and change position of Caption with Message, as generally messages are big, and you can see where to write the caption.

I should work on doing macros for System plugin calls, but now I'm working on another very special beaulty for NSIS right now... (What's the surprise?)

My Wiki Pages

Working now on:
New projects. (language: any)
deguix 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