From a3ff000eb0e2e29c77c38d184d65597e1ad32fcc Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Tue, 12 Feb 2013 19:10:10 +0000 Subject: fixed sound registration (fixes #233) git-svn-id: http://svn.miranda-ng.org/main/trunk@3581 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/AutoShutdown/src/main.cpp | 29 ----------------------------- plugins/AutoShutdown/src/shutdownsvc.cpp | 2 +- plugins/AutoShutdown/src/utils.cpp | 26 -------------------------- plugins/AutoShutdown/src/utils.h | 1 - 4 files changed, 1 insertion(+), 57 deletions(-) diff --git a/plugins/AutoShutdown/src/main.cpp b/plugins/AutoShutdown/src/main.cpp index daa4dbb611..b65d990d7a 100644 --- a/plugins/AutoShutdown/src/main.cpp +++ b/plugins/AutoShutdown/src/main.cpp @@ -51,35 +51,6 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, VOID *pReserved) return TRUE; } -static void InstallFile(const TCHAR *pszFileName,const TCHAR *pszDestSubDir) -{ - TCHAR szFileFrom[MAX_PATH+1],szFileTo[MAX_PATH+1],*p; - HANDLE hFile; - - if(!GetModuleFileName(hInst,szFileFrom,SIZEOF(szFileFrom)-lstrlen(pszFileName))) - return; - p=_tcsrchr(szFileFrom,_T('\\')); - if(p!=NULL) *(++p)=0; - lstrcat(szFileFrom,pszFileName); /* buffer safe */ - - hFile=CreateFile(szFileFrom,0,FILE_SHARE_READ,0,OPEN_EXISTING,0,0); - if(hFile==INVALID_HANDLE_VALUE) return; - CloseHandle(hFile); - - if(!GetModuleFileName(NULL,szFileTo,SIZEOF(szFileTo)-lstrlen(pszDestSubDir)-lstrlen(pszFileName))) - return; - p=_tcsrchr(szFileTo,_T('\\')); - if(p!=NULL) *(++p)=0; - lstrcat(szFileTo,pszDestSubDir); /* buffer safe */ - CreateDirectory(szFileTo,NULL); - lstrcat(szFileTo,pszFileName); /* buffer safe */ - - if(!MoveFile(szFileFrom,szFileTo) && GetLastError()==ERROR_ALREADY_EXISTS) { - DeleteFile(szFileTo); - MoveFile(szFileFrom,szFileTo); - } -} - static int ShutdownModulesLoaded(WPARAM wParam,LPARAM lParam) { if(ServiceExists("DBEditorpp/RegisterSingleModule")) diff --git a/plugins/AutoShutdown/src/shutdownsvc.cpp b/plugins/AutoShutdown/src/shutdownsvc.cpp index ac3efef3d7..f367b57ad2 100644 --- a/plugins/AutoShutdown/src/shutdownsvc.cpp +++ b/plugins/AutoShutdown/src/shutdownsvc.cpp @@ -554,7 +554,7 @@ void InitShutdownSvc(void) { /* Shutdown Dialog */ hwndShutdownDlg=NULL; - SkinAddNewSoundBundled("AutoShutdown_Countdown",Translate("Alerts"),Translate("Automatic Shutdown Countdown"),"Sounds\\","countdown.wav"); + SkinAddNewSoundExT("AutoShutdown_Countdown",LPGENT("Alerts"),LPGENT("Automatic Shutdown Countdown")); /* Services */ hEventOkToShutdown=CreateHookableEvent(ME_AUTOSHUTDOWN_OKTOSHUTDOWN); hEventShutdown=CreateHookableEvent(ME_AUTOSHUTDOWN_SHUTDOWN); diff --git a/plugins/AutoShutdown/src/utils.cpp b/plugins/AutoShutdown/src/utils.cpp index 21f3349b6d..35dc388557 100644 --- a/plugins/AutoShutdown/src/utils.cpp +++ b/plugins/AutoShutdown/src/utils.cpp @@ -291,32 +291,6 @@ HANDLE IcoLib_AddIconRes(const char *pszDbName,const TCHAR *pszSection,const TCH return Skin_AddIcon(&sid); } -int SkinAddNewSoundBundled(const char *pszDbName,const char *pszSection,const char *pszDesc,const char *pszSubDir,const char *pszDefaultFile) -{ - SKINSOUNDDESCEX ssd; - char szFile[MAX_PATH],*p; - HANDLE hFile; - - ssd.cbSize=sizeof(ssd); - ssd.pszName=pszDbName; - ssd.pszSection=pszSection; - ssd.pszDescription=pszDesc; - ssd.pszDefaultFile=NULL; - if(GetModuleFileNameA(NULL,szFile,SIZEOF(szFile)-lstrlenA(pszSubDir)-lstrlenA(pszDefaultFile))) { - p=strrchr(szFile,'\\'); - if(p!=NULL) *(++p)=0; - lstrcatA(lstrcatA(szFile,pszSubDir),pszDefaultFile); /* buffer safe */ - /* check if sound file exist */ - hFile=CreateFileA(szFile,0,FILE_SHARE_READ,NULL,OPEN_EXISTING,0,NULL); - if(hFile!=INVALID_HANDLE_VALUE) { - ssd.pszDefaultFile=szFile; /* MS_UTILS_PATHTORELATIVET called automatically */ - CloseHandle(hFile); - } - } - Skin_AddSound(&ssd); - return 0; -} - void AddHotkey() { HOTKEYDESC hkd = {0}; diff --git a/plugins/AutoShutdown/src/utils.h b/plugins/AutoShutdown/src/utils.h index 189906e57a..be5a8dfd6c 100644 --- a/plugins/AutoShutdown/src/utils.h +++ b/plugins/AutoShutdown/src/utils.h @@ -42,5 +42,4 @@ int FontService_GetColor(const TCHAR *pszSection,const TCHAR *pszDescription,COL /* Skin */ HANDLE IcoLib_AddIconRes(const char *pszDbName,const TCHAR *pszSection,const TCHAR *pszDesc,HINSTANCE hInst,WORD idRes,BOOL fLarge); -int SkinAddNewSoundBundled(const char *pszDbName,const char *pszSection,const char *pszDesc,const char *pszSubDir,const char *pszDefaultFile); void AddHotkey(); -- cgit v1.2.3