Click here to Skip to main content
15,892,005 members
Articles / Programming Languages / C++

A user configurable "Idle Computer Notification" tool

Rate me:
Please Sign up or sign in to vote.
3.62/5 (7 votes)
21 Aug 2006CPOL2 min read 37K   415   15  
This tool will let you know when your computer is idle/busy.
// TKType.h - basic type
#pragma once

typedef __int64             TKLong;
typedef __int64             TKLongID;
typedef __int64             TKRefCount;
typedef unsigned __int64    TKULong;

typedef DWORD               TKDATE;

// undef const
const int   UNDEF_INT     = 0x80000000;
const DWORD UNDEF_DWORD   = 0xFFFFFFFF;


typedef struct TKuuid
{
    __int64     m_lo;
    __int64     m_hi;
}
    TKuuid;

#define /*BOOL*/ TKuuidEQ(u1,u2) (memcmp( u1, u2, sizeof(TKuuid) )==0)

struct TKTIME
{
    int     m_hour;
    int     m_minute;
    int     m_second;
    int     m_milliseconds;
};

// The TKTime structure holds an unsigned 64-bit date and time value.
// This value could represents the number of 100-nanosecond units since the beginning of January 1, 1601.
class TKTime
{
public:
    TKTime( void );
    TKTime( LPCTSTR szGetSystemTimeDummy );  // szGetSystemTimeDummy is not used it's just to Get the system time in the constructor
    TKTime( const TKTime& time );
    TKTime( const FILETIME& fileTime );
    TKTime( const SYSTEMTIME& sysTime );
    TKTime( DWORD days, DWORD hours, DWORD minutes, DWORD seconds, DWORD millisseconds );
    TKTime( WORD year, WORD month, WORD day, WORD hour, WORD minute, WORD second );
    TKTime( TKLong time );

    ~TKTime( void ) {}

    TKTime& operator =( TKLong time );
    TKTime& operator +=( TKLong time );
    TKTime& operator -=( TKLong time );
    TKTime& operator /=( TKLong time );
    TKTime& operator *=( TKLong time );

    operator FILETIME( void );
    operator SYSTEMTIME( void );
    operator TKTIME( void );
    operator TKLong( void );

    TKTime& Set( DWORD days, DWORD hours, DWORD minutes, DWORD seconds, DWORD milliseconds );
    TKTime& Set( WORD year, WORD month, WORD day, WORD hour, WORD minute, WORD second );
    TKTime& Set( DWORD milliseconds );  // becarefull you set some milliseconds
    TKTime& SetSystemTime( void );

    void LocalToUTC( void );
    void UTCToLocal( void );

private:
    TKLong m_time;
};

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
United States United States
16yrs of GUI programming experience gained at: (most recent first) BlackBall, Veritas, Seagate Software, Arcada, Stac, Mountain, and Emerald Systems.

Languages/Scripting: C, C++, JAVA, BASIC, JAVASCRIPT, HTML, XML, PHP, and SQL

Tools: MS Visual Studio, MS Visual SourceSafe, CVS, PVCS, Bounds Checker, VMWare, ToDoList, InstallShield, and Office Applications

Libraries and API: RTL, STL, WIN32, MFC, ATL, .NET, ActiveX, DirectX, COM, DCOM, Shell Extensions, and Shell Namespaces

Strengths: Honest, communicative, keen eye for usability, good at estimating workload and completion dates, ready to take on grunt work, team player, experienced working with QA, localization, Tech Pubs, Sales, and Marketing teams.

Comments and Discussions