From 4828e0d292182e2f478444c1c7d2a977ed7ab68e Mon Sep 17 00:00:00 2001 From: kichik Date: Sun, 24 Nov 2002 18:50:31 +0000 Subject: [PATCH] Banner - shows some text before installation starts git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@1830 212acab6-be3b-0410-9dea-997c60f758d6 --- Contrib/Banner/Banner.c | 41 ++++++++++++++ Contrib/Banner/Banner.dsp | 112 +++++++++++++++++++++++++++++++++++++ Contrib/Banner/Banner.dsw | 29 ++++++++++ Contrib/Banner/Example.nsi | 15 +++++ Contrib/Banner/Readme.txt | 9 +++ Examples/makensis.nsi | 26 +++++++++ 6 files changed, 232 insertions(+) create mode 100644 Contrib/Banner/Banner.c create mode 100644 Contrib/Banner/Banner.dsp create mode 100644 Contrib/Banner/Banner.dsw create mode 100644 Contrib/Banner/Example.nsi create mode 100644 Contrib/Banner/Readme.txt diff --git a/Contrib/Banner/Banner.c b/Contrib/Banner/Banner.c new file mode 100644 index 00000000..1dd4fd08 --- /dev/null +++ b/Contrib/Banner/Banner.c @@ -0,0 +1,41 @@ +#include +#include "../exdll/exdll.h" +#include "../../Source/exehead/resource.h" + +HINSTANCE hInstance; +HWND hwBanner; + +char buf[1024]; + +BOOL CALLBACK bannerProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + if (uMsg == WM_INITDIALOG) + { + popstring(buf); + SetWindowText(hwndDlg,buf); + SetDlgItemText(hwndDlg,IDC_STR,buf); + } + return 0; +} + +void __declspec(dllexport) show(HWND hwndParent, int string_size, char *variables, stack_t **stacktop) +{ + EXDLL_INIT(); + + hwBanner = CreateDialog( + GetModuleHandle(0), + MAKEINTRESOURCE(IDD_VERIFY), + hwndParent, + bannerProc + ); +} + +void __declspec(dllexport) destroy(HWND hwndParent, int string_size, char *variables, stack_t **stacktop) +{ + DestroyWindow(hwBanner); +} + +BOOL WINAPI _DllMainCRTStartup(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved) +{ + return TRUE; +} \ No newline at end of file diff --git a/Contrib/Banner/Banner.dsp b/Contrib/Banner/Banner.dsp new file mode 100644 index 00000000..182c08bb --- /dev/null +++ b/Contrib/Banner/Banner.dsp @@ -0,0 +1,112 @@ +# Microsoft Developer Studio Project File - Name="Banner" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=Banner - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "Banner.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "Banner.mak" CFG="Banner - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "Banner - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "Banner - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "Banner - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 1 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "Banner_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "Banner_EXPORTS" /FD /c +# SUBTRACT CPP /YX +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# 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 +# SUBTRACT LINK32 /pdb:none + +!ELSEIF "$(CFG)" == "Banner - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "Banner_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "Banner_EXPORTS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# 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 /debug /machine:I386 /pdbtype:sept +# 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 /dll /debug /machine:I386 /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "Banner - Win32 Release" +# Name "Banner - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\Banner.c +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=..\ExDLL\exdll.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project diff --git a/Contrib/Banner/Banner.dsw b/Contrib/Banner/Banner.dsw new file mode 100644 index 00000000..7954b9d0 --- /dev/null +++ b/Contrib/Banner/Banner.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "Banner"=.\Banner.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/Contrib/Banner/Example.nsi b/Contrib/Banner/Example.nsi new file mode 100644 index 00000000..de5bab58 --- /dev/null +++ b/Contrib/Banner/Example.nsi @@ -0,0 +1,15 @@ +Name "Banner.dll test" + +OutFile "Banner Test.exe" + +Function .onInit + Banner::show /NOUNLOAD "Calculating important stuff..." + again: + IntOp $0 $0 + 1 + Sleep 1 + StrCmp $0 2000 0 again + Banner::destroy +FunctionEnd + +Section +SectionEnd \ No newline at end of file diff --git a/Contrib/Banner/Readme.txt b/Contrib/Banner/Readme.txt new file mode 100644 index 00000000..78330e0e --- /dev/null +++ b/Contrib/Banner/Readme.txt @@ -0,0 +1,9 @@ +Banner.dll shows a banner with customizable text. + +There are only two functions, show and destory. 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. + +Look at Example.nsi for an example. + +Created by Amir Szekely (aka KiCHiK) \ No newline at end of file diff --git a/Examples/makensis.nsi b/Examples/makensis.nsi index 69379220..0facaf88 100644 --- a/Examples/makensis.nsi +++ b/Examples/makensis.nsi @@ -199,6 +199,15 @@ SectionEnd SubSection "Plugins" SecContribPlugins +Section "Banner" SecContribBanner + SectionIn 1 2 + SetOutPath $INSTDIR\Plugins + File ..\Plugins\Banner.dll + SetOutPath $INSTDIR\Contrib\Banner + File ..\Contrib\Banner\Readme.txt + File ..\Contrib\Banner\Example.nsi +SectionEnd + Section "Language DLL" SecContribLangDLL SectionIn 1 2 SetOutPath $INSTDIR\Plugins @@ -362,6 +371,14 @@ SectionEnd SubSection "Plugins" SecContribPluginsS +Section "Banner Source" SecContribBannerS + SectionIn 1 + SetOutPath $INSTDIR\Contrib\Banner + File ..\Contrib\Banner\Banner.dsw + File ..\Contrib\Banner\Banner.dsp + File ..\Contrib\Banner\Banner.c +SectionEnd + Section "Language DLL Source" SecContribLangDLLS SectionIn 1 SetOutPath $INSTDIR\Contrib\LangDLL @@ -604,6 +621,13 @@ Section -post Push BgImage Call AddWorkspaceToStartMenu + ; Banner + Push Banner + Call AddReadmeToStartMenu + + Push Banner + Call AddWorkspaceToStartMenu + ; System Push System Call AddReadmeToStartMenu @@ -644,6 +668,8 @@ SectionEnd !insertmacro MUI_DESCRIPTION_TEXT ${SecContribLang} "Language files used to support multiple languages in an installer" !insertmacro MUI_DESCRIPTION_TEXT ${SecContribPlugins} "Useful plugins that extend NSIS's functionality" !insertmacro MUI_DESCRIPTION_TEXT ${SecContribPluginsS} "Source code for plugins" + !insertmacro MUI_DESCRIPTION_TEXT ${SecContribBanner} "Plugin that letes you show a banner before installation starts" + !insertmacro MUI_DESCRIPTION_TEXT ${SecContribBannerS} "Source code to plugin that letes you show a banner before installation starts" !insertmacro MUI_DESCRIPTION_TEXT ${SecContribLangDLL} "Plugin that lets you add a language select dialog to your installer" !insertmacro MUI_DESCRIPTION_TEXT ${SecContribLangDLLS} "Source code to plugin that lets you add a language select dialog to your installer" !insertmacro MUI_DESCRIPTION_TEXT ${SecContribnsExec} "Plugin that executes console programs and prints its output in the NSIS log window or hides it"