Click here to Skip to main content
15,892,199 members
Articles / Desktop Programming / Win32

Password Field Unhider (and some C++ utility classes)

Rate me:
Please Sign up or sign in to vote.
4.88/5 (10 votes)
9 Apr 2009CPOL13 min read 54.1K   1.5K   46  
Utility to unmask password edit controls and INPUT fields, plus some useful C++ classes used to implement it.
// By David S. Bakin (davidbak@gmail.com)
// Copyright @ 2009 David S. Bakin
// This work licensed under The Code Project Open License (CPOL) 1.02

#include "stdafx.h"
#include "Locks.h"

CLockCritSec::CLockCritSec()
{
    BOOL b = ::InitializeCriticalSectionAndSpinCount(&critsec_, 4000);
    if (b == 0)
    {
        DWORD err = ::GetLastError();
        // Error: can't initialize critical section - should never happen!
        assert(1);
    }
}

CLockCritSec::~CLockCritSec()
{
    ::DeleteCriticalSection(&critsec_);
}

void CLockCritSec::Lock()
{
    ::EnterCriticalSection(&critsec_);
}

void CLockCritSec::Unlock()
{
    ::LeaveCriticalSection(&critsec_);
}

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
Architect Bakin's Bits
United States United States
I've been programming for 35 years and I'm still learning new things. My major interests recently are programming models and methods for concurrency, applications of functional programming, and doing interesting things with Mathematica.

Comments and Discussions