diff options
| author | Kirill Volinsky <mataes2007@gmail.com> | 2013-09-23 15:13:53 +0000 | 
|---|---|---|
| committer | Kirill Volinsky <mataes2007@gmail.com> | 2013-09-23 15:13:53 +0000 | 
| commit | 4917567d0e33f20b07b004c368cd66e301115db0 (patch) | |
| tree | fa841e9647b10bb5a291196bae241974de30f060 /plugins/AutoShutdown/src | |
| parent | 83181e39a7613a9ed00c6c7ddcbea59a340d491e (diff) | |
small plugins cleanup
git-svn-id: http://svn.miranda-ng.org/main/trunk@6193 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/AutoShutdown/src')
| -rw-r--r-- | plugins/AutoShutdown/src/common.h | 1 | ||||
| -rw-r--r-- | plugins/AutoShutdown/src/utils.cpp | 12 | 
2 files changed, 4 insertions, 9 deletions
| diff --git a/plugins/AutoShutdown/src/common.h b/plugins/AutoShutdown/src/common.h index 8752f1d0aa..2eae1b9bab 100644 --- a/plugins/AutoShutdown/src/common.h +++ b/plugins/AutoShutdown/src/common.h @@ -22,6 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  #include <time.h>   /* for mktime(),time() */
  #include <windows.h>
  #include <Uxtheme.h>
 +#include <Shlwapi.h>
  /* WinXP+: shutdown reason codes */
  #if defined(EWX_RESTARTAPPS)   /* new MS Platform SDK */
 diff --git a/plugins/AutoShutdown/src/utils.cpp b/plugins/AutoShutdown/src/utils.cpp index 18c893a77d..b510fbd17c 100644 --- a/plugins/AutoShutdown/src/utils.cpp +++ b/plugins/AutoShutdown/src/utils.cpp @@ -160,15 +160,10 @@ BOOL TimeStampToSystemTime(time_t timestamp,SYSTEMTIME *st)  BOOL GetFormatedCountdown(TCHAR *pszOut,int nSize,time_t countdown)
  {
  	static BOOL fInited=FALSE;
 -	static int (WINAPI *pfnStrFromTimeInterval)(TCHAR*,UINT,DWORD,int);
  	static int (WINAPI *pfnGetDurationFormat)(LCID,DWORD,const SYSTEMTIME*,double,WCHAR*,WCHAR*,int);
  	/* Init */
 -	if(!fInited) {
 +	if(!fInited && IsWinVerVistaPlus()) {
  		*(PROC*)&pfnGetDurationFormat=GetProcAddress(GetModuleHandleA("KERNEL32"),"GetDurationFormat");
 -		if(pfnGetDurationFormat==NULL) {
 -			HMODULE hShlwDLL=LoadLibraryA("SHLWAPI"); /* all ascii */
 -			*(PROC*)&pfnStrFromTimeInterval=GetProcAddress(hShlwDLL,"StrFromTimeIntervalW");
 -		}
  		fInited=TRUE;
  	}
  	/* WinVista */
 @@ -180,10 +175,9 @@ BOOL GetFormatedCountdown(TCHAR *pszOut,int nSize,time_t countdown)  			if(pfnGetDurationFormat(locale,0,&st,0,NULL,pszOut,nSize))
  				return TRUE;
  		return FALSE;
 -	}
 +	} else
  	/* Win9x/NT/XP */
 -	if(pfnStrFromTimeInterval!=NULL)
 -		return pfnStrFromTimeInterval(pszOut,nSize,(countdown>(MAXDWORD/1000))?MAXDWORD:(countdown*1000),10)!=0;
 +		return StrFromTimeInterval(pszOut,nSize,(countdown>(MAXDWORD/1000))?MAXDWORD:(countdown*1000),10)!=0;
  	return FALSE;
  }
 | 
