summaryrefslogtreecommitdiff
path: root/plugins/SplashScreen/src/splash.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/SplashScreen/src/splash.cpp')
-rw-r--r--plugins/SplashScreen/src/splash.cpp81
1 files changed, 26 insertions, 55 deletions
diff --git a/plugins/SplashScreen/src/splash.cpp b/plugins/SplashScreen/src/splash.cpp
index 05df53d142..196c4adedd 100644
--- a/plugins/SplashScreen/src/splash.cpp
+++ b/plugins/SplashScreen/src/splash.cpp
@@ -1,5 +1,5 @@
/*
-Splash Screen Plugin for Miranda-IM (www.miranda-im.org)
+Splash Screen Plugin for Miranda NG (www.miranda-ng.org)
(c) 2004-2007 nullbie, (c) 2005-2007 Thief
This program is free software; you can redistribute it and/or modify
@@ -15,12 +15,6 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-File name : $URL: http://svn.miranda.im/mainrepo/splashscreen/trunk/src/splash.cpp $
-Revision : $Rev: 1585 $
-Last change on : $Date: 2010-04-09 13:13:29 +0400 (Пт, 09 апр 2010) $
-Last change by : $Author: ghazan $
-
*/
#include "headers.h"
@@ -144,24 +138,9 @@ LRESULT CALLBACK SplashWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM
break;
}
- case WM_PAINT:
- {
- if (!MyUpdateLayeredWindow) // Win 9x
- {
- #ifdef _DEBUG
- logMessage(_T("WM_PAINT"), _T("painting.."));
- #endif
- PAINTSTRUCT ps;
- BeginPaint(hwndSplash, &ps);
- BitBlt(ps.hdc, 0, 0, SplashBmp->getWidth(), SplashBmp->getHeight(), tmpBmp->getDC(), 0, 0, SRCCOPY);
- EndPaint(hwndSplash, &ps);
- }
- break;
- }
-
- ShowWindow(hwndSplash, SW_HIDE);
- DestroyWindow(hwndSplash);
- break;
+ ShowWindow(hwndSplash, SW_HIDE);
+ DestroyWindow(hwndSplash);
+ break;
}
return DefWindowProc(hwnd, message, wParam, lParam);
@@ -169,14 +148,25 @@ LRESULT CALLBACK SplashWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM
int SplashThread(void *arg)
{
- // Old code, doesn't support mp3 files
- //if (options.playsnd) PlaySound(szSoundFile, NULL, SND_ASYNC | SND_FILENAME | SND_NOWAIT);
+ IGraphBuilder *pGraph = NULL;
+ IMediaControl *pControl = NULL;
+
if (options.playsnd)
{
- TCHAR cmd[MAX_PATH];
- mir_sntprintf(cmd, SIZEOF(cmd), _T("open \"%s\" type mpegvideo alias song1"), szSoundFile);
- mciSendString(cmd, NULL, 0, 0);
- mciSendString(_T("play song1"), NULL, 0, 0);
+ // Initialize the COM library.
+ CoInitialize(NULL);
+
+ // Create the filter graph manager and query for interfaces.
+ CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, IID_IGraphBuilder, (void **)&pGraph);
+
+ // Get MediaControl Interface
+ pGraph->QueryInterface(IID_IMediaControl, (void **)&pControl);
+
+ // Build the graph. IMPORTANT: Change this string to a file on your system.
+ pGraph->RenderFile(szSoundFile, NULL);
+
+ // Run the graph.
+ pControl->Run();
}
WNDCLASSEX wcl;
@@ -306,30 +296,7 @@ int SplashThread(void *arg)
MyUpdateLayeredWindow(hwndSplash, NULL, &ptDst, &sz, SplashBmp->getDC(), &ptSrc, 0xffffffff, &blend, LWA_ALPHA);
ShowWindow(hwndSplash, SW_SHOWNORMAL);
- }
- else // Win 9x
- {
- tmpBmp = new MyBitmap(SplashBmp->getWidth(),SplashBmp->getHeight());
- HDC dtDC = GetDC(GetDesktopWindow());
-
- BitBlt(tmpBmp->getDC(),
- 0,
- 0,
- SplashBmp->getWidth(),
- SplashBmp->getHeight(),
- dtDC,
- (DesktopRect.left + DesktopRect.right - SplashBmp->getWidth()) / 2,
- (DesktopRect.top + DesktopRect.bottom - SplashBmp->getHeight()) / 2,
- SRCCOPY);
-
- ReleaseDC(GetDesktopWindow(), dtDC);
- tmpBmp->Blend(SplashBmp, (splashWithMarkers?-1:0), (splashWithMarkers?-1:0), SplashBmp->getWidth(), SplashBmp->getHeight());
-
- }
-
- if (MyUpdateLayeredWindow) // Win 2000+
- {
if (options.fadein)
{
// Fade in
@@ -374,7 +341,11 @@ int SplashThread(void *arg)
}
if (options.playsnd)
- mciSendString(_T("close song1"), NULL, 0, 0);
+ {
+ pControl->Release();
+ pGraph->Release();
+ CoUninitialize();
+ }
ExitThread(0);
return 1;