Banner now "works" with the MUI too

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2083 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2003-01-27 15:44:13 +00:00
parent 6f3fdd6650
commit ca8fbc5bec
5 changed files with 49 additions and 2 deletions

View file

@ -2,16 +2,36 @@
#include "../exdll/exdll.h"
#include "../../Source/exehead/resource.h"
// Turn a pair of chars into a word
// Turn four chars into a dword
#ifdef __BIG_ENDIAN__ // Not very likely, but, still...
#define CHAR2_TO_WORD(a,b) (((WORD)(b))|((a)<<8))
#define CHAR4_TO_DWORD(a,b,c,d) (((DWORD)CHAR2_TO_WORD(c,d))|(CHAR2_TO_WORD(a,b)<<16))
#else
#define CHAR2_TO_WORD(a,b) (((WORD)(a))|((b)<<8))
#define CHAR4_TO_DWORD(a,b,c,d) (((DWORD)CHAR2_TO_WORD(a,b))|(CHAR2_TO_WORD(c,d)<<16))
#endif
HINSTANCE hInstance;
HWND hwBanner;
char buf[1024];
unsigned int myatoi(char *s);
BOOL CALLBACK bannerProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if (uMsg == WM_INITDIALOG)
{
popstring(buf);
while (*(int*)buf == CHAR4_TO_DWORD('/','s','e','t')) {
unsigned int id;
popstring(buf);
id = myatoi(buf);
popstring(buf);
SetDlgItemText(hwndDlg,id,buf);
popstring(buf);
}
SetWindowText(hwndDlg,buf);
SetDlgItemText(hwndDlg,IDC_STR,buf);
}
@ -38,4 +58,19 @@ void __declspec(dllexport) destroy(HWND hwndParent, int string_size, char *varia
BOOL WINAPI _DllMainCRTStartup(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
{
return TRUE;
}
unsigned int myatoi(char *s)
{
unsigned int v=0;
for (;;)
{
unsigned int c=*s++;
if (c >= '0' && c <= '9') c-='0';
else break;
v*=10;
v+=c;
}
return v;
}

View file

@ -54,7 +54,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /entry:"_DllMainCRTStartup" /dll /machine:I386 /nodefaultlib /out:"../../Plugins/Banner.dll" /opt:nowin98
# ADD LINK32 kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib /nologo /entry:"_DllMainCRTStartup" /dll /machine:I386 /nodefaultlib /out:"../../Plugins/Banner.dll" /opt:nowin98
# SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "Banner - Win32 Debug"

View file

@ -1,3 +1,5 @@
# Look at Readme.txt for usage alongside with the Modern UI
Name "Banner.dll test"
OutFile "Banner Test.exe"

View file

@ -1,9 +1,19 @@
Banner.dll shows a banner with customizable text.
There are only two functions, show and destory. Show must be called
There are only two functions, show and destroy. Show must be called
with the /NOUNLOAD flag or else it won't work. Show takes one argument
which is the text to show and destroy takes no arguments.
To use with the MUI use:
Banner::show /NOUNLOAD /set 76 "text to replace Please wait while Setup is loading..." "other text as normal"
You can use multiple /SETs to change the text of multiple labels. For example:
Banner::show /NOUNLOAD /set 76 "bah #1" /set 54 "bah #2" "other text as normal"
The second parameter for /set is the ID of the control that its text should be replaced in the dialog.
Look at Example.nsi for an example.
Created by Amir Szekely (aka KiCHiK)

Binary file not shown.