diff --git a/Contrib/AdvSplash/Example.nsi b/Contrib/AdvSplash/Example.nsi index 07811157..3337ed17 100644 --- a/Contrib/AdvSplash/Example.nsi +++ b/Contrib/AdvSplash/Example.nsi @@ -5,25 +5,27 @@ OutFile "AdvSplash Test.exe" XPStyle on Function .onInit - # the plugins dir is automatically deleted when the installer exits - InitPluginsDir - File /oname=$PLUGINSDIR\splash.bmp "${NSISDIR}\Contrib\Makensisw\logo.bmp" - #optional - #File /oname=$PLUGINSDIR\splash.wav "C:\myprog\sound.wav" + # the plugins dir is automatically deleted when the installer exits + InitPluginsDir + File /oname=$PLUGINSDIR\splash.bmp "${NSISDIR}\Contrib\Makensisw\logo.bmp" + #optional + #File /oname=$PLUGINSDIR\splash.wav "C:\myprog\sound.wav" - advsplash::show 1000 600 400 -1 $PLUGINSDIR\splash + advsplash::show 1000 600 400 -1 $PLUGINSDIR\splash - Pop $0 ; $0 has '1' if the user closed the splash screen early, - ; '0' if everything closed normal, and '-1' if some error occured. + Pop $0 ; $0 has '1' if the user closed the splash screen early, + ; '0' if everything closed normal, and '-1' if some error occured. - MessageBox MB_OK "Now with transparency" + MessageBox MB_OK "Now with transparency" - File /oname=$PLUGINSDIR\splash.bmp "${NSISDIR}\Contrib\Icons\modern.bmp" + File /oname=$PLUGINSDIR\splash.bmp "${NSISDIR}\Contrib\Icons\modern.bmp" - advsplash::show 1000 600 400 0xFF00FF $PLUGINSDIR\splash + advsplash::show 1000 600 400 0xFF00FF $PLUGINSDIR\splash + + Pop $0 ; $0 has '1' if the user closed the splash screen early, + ; '0' if everything closed normal, and '-1' if some error occured. + MessageBox MB_OK "$0" - Pop $0 ; $0 has '1' if the user closed the splash screen early, - ; '0' if everything closed normal, and '-1' if some error occured. FunctionEnd Section diff --git a/Contrib/AdvSplash/advsplash.c b/Contrib/AdvSplash/advsplash.c index 45b01424..47539e12 100644 --- a/Contrib/AdvSplash/advsplash.c +++ b/Contrib/AdvSplash/advsplash.c @@ -17,12 +17,15 @@ int resolution = RESOLUTION; int sleep_val, fadein_val, fadeout_val, state, timeleft, keycolor, nt50, alphaparam; int call = -1; -BOOL (_stdcall *SetLayeredWindowAttributesProc)(HWND hwnd, // handle to the layered window +typedef BOOL (_stdcall *_tSetLayeredWindowAttributesProc)(HWND hwnd, // handle to the layered window COLORREF crKey, // specifies the color key BYTE bAlpha, // value for the blend function DWORD dwFlags // action ); + +_tSetLayeredWindowAttributesProc SetLayeredWindowAttributesProc; + static LRESULT CALLBACK WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { if (uMsg == WM_CREATE) @@ -130,9 +133,9 @@ void CALLBACK TimeProc( // FadeIN case 0: if (timeleft == 0) { - timeleft = sleep_val; + timeleft = sleep_val; state++; - if (nt50) call = 255; + if (nt50) call = 255; } else { call = ((fadein_val-timeleft)*255)/fadein_val; break; } // Sleep case 1: if (timeleft == 0) @@ -143,8 +146,8 @@ void CALLBACK TimeProc( // FadeOUT case 2: if (timeleft == 0) { - PostMessage((HWND)dwUser, WM_TIMER, 0, 0); - return; + PostMessage((HWND)dwUser, WM_TIMER, 0, 0); + return; } else { call = ((timeleft)*255)/fadeout_val; break; } } // Transparency value aquired, and could be set... @@ -152,7 +155,7 @@ void CALLBACK TimeProc( SetLayeredWindowAttributesProc((HWND)dwUser, keycolor, call, alphaparam); - call = -1; + call = -1; // Time is running out... timeleft--; } @@ -206,8 +209,6 @@ void __declspec(dllexport) show(HWND hwndParent, int string_size, char *variable HWND myWnd; UINT timerEvent; - PlaySound(fn2,NULL,SND_ASYNC|SND_FILENAME|SND_NODEFAULT); - // Get Bitmap Information GetObject(g_hbm, sizeof(bm), (LPSTR)&bm); @@ -219,7 +220,7 @@ void __declspec(dllexport) show(HWND hwndParent, int string_size, char *variable { // Get blending proc address HANDLE user32 = GetModuleHandle("user32"); - SetLayeredWindowAttributesProc = GetProcAddress(user32, "SetLayeredWindowAttributes"); + SetLayeredWindowAttributesProc = (_tSetLayeredWindowAttributesProc) GetProcAddress(user32, "SetLayeredWindowAttributes"); // Use win2k method SetLayeredWindowAttributesProc(myWnd, keycolor, (fadein_val > 0)?(0):(255), @@ -268,7 +269,7 @@ void __declspec(dllexport) show(HWND hwndParent, int string_size, char *variable wdelta = ((bm.bmWidth + 3) & 3) ^ 3; // Search for transparent pixels for (y = bm.bmHeight-1; y >= 0; y--, bmp += wdelta) - for (x = 0; x < bm.bmWidth; x++, bmp++) + for (x = 0; x < bm.bmWidth; ) if (*bmp == (BYTE) keycolor) { int j = x; @@ -278,14 +279,14 @@ void __declspec(dllexport) show(HWND hwndParent, int string_size, char *variable cutrgn = CreateRectRgn(j, y, x, y+1); CombineRgn(region, region, cutrgn, RGN_XOR); DeleteObject(cutrgn); - } + } else bmp++, x++; } else if (bm.bmBitsPixel == 24) { // Bitmap is DWORD aligned by width wdelta = ((bm.bmWidth*3 + 3 ) & 3) ^ 3; // Search for transparent pixels for (y = bm.bmHeight-1; y >= 0; y--, bmp += wdelta) - for (x = 0; x < bm.bmWidth; bmp += 3, x++) + for (x = 0; x < bm.bmWidth; ) if ((*(int*)bmp & 0xFFFFFF) == keycolor) { int j = x; @@ -295,13 +296,15 @@ void __declspec(dllexport) show(HWND hwndParent, int string_size, char *variable cutrgn = CreateRectRgn(j, y, x, y+1); CombineRgn(region, region, cutrgn, RGN_XOR); DeleteObject(cutrgn); - } + } else bmp += 3, x++; } // Set resulting region. SetWindowRgn(myWnd, region, TRUE); } + PlaySound(fn2,NULL,SND_ASYNC|SND_FILENAME|SND_NODEFAULT); + // Start up timer... state = 0; timeleft = fadein_val; timerEvent = timeSetEvent(resolution, RESOLUTION/4, TimeProc, (DWORD_PTR)myWnd, TIME_PERIODIC); @@ -319,6 +322,9 @@ void __declspec(dllexport) show(HWND hwndParent, int string_size, char *variable DeleteObject(g_hbm); } + + // We should UnRegister class, since Windows NT series never does this by itself + UnregisterClass(wc.lpszClassName, g_hInstance); } } wsprintf(temp,"%d",g_rv); diff --git a/Contrib/AdvSplash/advsplash.dsp b/Contrib/AdvSplash/advsplash.dsp index 33cd4fdc..0af2fe9e 100644 --- a/Contrib/AdvSplash/advsplash.dsp +++ b/Contrib/AdvSplash/advsplash.dsp @@ -1,114 +1,114 @@ -# Microsoft Developer Studio Project File - Name="advsplash" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Application" 0x0101 - -CFG=advsplash - 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 "advsplash.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 "advsplash.mak" CFG="advsplash - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "advsplash - Win32 Release" (based on "Win32 (x86) Application") -!MESSAGE "advsplash - Win32 Debug" (based on "Win32 (x86) Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "advsplash - 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 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /Og /Os /Oy /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FD /c -# SUBTRACT CPP /Ox /Ow /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 /subsystem:windows /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winmm.lib /nologo /entry:"_DllMainCRTStartup" /subsystem:windows /dll /machine:I386 /nodefaultlib /out:"../../Plugins/advsplash.dll" /opt:nowin98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "advsplash - 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 Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /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 /subsystem:windows /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 /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# SUBTRACT LINK32 /pdb:none - -!ENDIF - -# Begin Target - -# Name "advsplash - Win32 Release" -# Name "advsplash - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\advsplash.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 +# Microsoft Developer Studio Project File - Name="advsplash" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=advsplash - 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 "advsplash.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 "advsplash.mak" CFG="advsplash - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "advsplash - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "advsplash - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "advsplash - 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 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /Og /Os /Oy /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FD /c +# SUBTRACT CPP /Ox /Ow /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 winmm.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winmm.lib /nologo /entry:"_DllMainCRTStartup" /subsystem:windows /dll /machine:I386 /nodefaultlib /out:"../../Plugins/advsplash.dll" /opt:nowin98 +# SUBTRACT LINK32 /pdb:none + +!ELSEIF "$(CFG)" == "advsplash - 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 Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /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 /subsystem:windows /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 /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# SUBTRACT LINK32 /pdb:none + +!ENDIF + +# Begin Target + +# Name "advsplash - Win32 Release" +# Name "advsplash - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\advsplash.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/AdvSplash/advsplash.dsw b/Contrib/AdvSplash/advsplash.dsw index 6bbdc7ed..0f37b6a9 100644 --- a/Contrib/AdvSplash/advsplash.dsw +++ b/Contrib/AdvSplash/advsplash.dsw @@ -1,29 +1,29 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "advsplash"=.\advsplash.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "advsplash"=.\advsplash.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/Contrib/AdvSplash/advsplash.txt b/Contrib/AdvSplash/advsplash.txt index 6e45532d..ef0094c3 100644 --- a/Contrib/AdvSplash/advsplash.txt +++ b/Contrib/AdvSplash/advsplash.txt @@ -1,4 +1,4 @@ -AdvSplash.exe - small (5.5k), simple plugin that lets you throw +AdvSplash.exe - small (6.0k), simple plugin that lets you throw up a splash screen in NSIS installers with cool fading effects (win2k/xp) and transparency (24bit/8bit bitmaps). @@ -54,5 +54,4 @@ screen early (pop it from the stack) -Justin Converted to a plugin DLL by Amir Szekely (kichik) -Fading and transparency by Nik Medved (brainsucker) - +Fading and transparency by Nik Medved (brainsucker) \ No newline at end of file diff --git a/Plugins/advsplash.dll b/Plugins/advsplash.dll index efad34c6..bdaffb92 100644 Binary files a/Plugins/advsplash.dll and b/Plugins/advsplash.dll differ