summaryrefslogtreecommitdiff
path: root/plugins/TooltipNotify/src/Utils.cpp
blob: ce73dbc59b95147a54a2e896c91494e560b8aab3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
//
// Utils.cpp
//

#include "stdafx.h"
#include "Utils.h"

BOOL IsNt50()
{
	WORD wOsVersion = LOWORD(GetVersion());
	BYTE bMajorVer = LOBYTE(wOsVersion);
	BYTE bMinorVer = HIBYTE(wOsVersion);

	return (bMajorVer>=5 && bMinorVer>=0);
}

void TruncateWithDots(TCHAR* szString, int iNewLen)
{
	assert(iNewLen >= 0);

	int iOrigLen = _tcslen(szString);
	if (iNewLen < iOrigLen)
	{
		TCHAR* p = szString+iNewLen;
		*p = _T('\0');
		for(int i=0; --p>=szString && i<3; i++)
		{
			*p = _T('.');
		}
	}
}