Click here to Skip to main content
15,885,141 members
Articles / Programming Languages / C++

Winlogon using Mobile Disk

Rate me:
Please Sign up or sign in to vote.
4.83/5 (25 votes)
30 Nov 2007CPOL6 min read 136.3K   2.6K   89  
This is a full set of applications that can be used to logon to Windows system using mobile disk. No password typing.
// PasswordDlg.cpp : implementation file
//

#include "stdafx.h"
#include "KeyGen.h"
#include "PasswordDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CPasswordDlg dialog


CPasswordDlg::CPasswordDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CPasswordDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CPasswordDlg)
	m_szUser = _T("");
	m_szPassword = _T("");
	m_szDomain = _T("Local Machine");
	//}}AFX_DATA_INIT
}


void CPasswordDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CPasswordDlg)
	DDX_Text(pDX, IDC_USER_EDIT, m_szUser);
	DDX_Text(pDX, IDC_PASSWORD_EDIT, m_szPassword);
	DDX_CBString(pDX, IDC_DOMAIN_COMBO, m_szDomain);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CPasswordDlg, CDialog)
	//{{AFX_MSG_MAP(CPasswordDlg)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPasswordDlg message handlers

BOOL CPasswordDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	

	if(m_szUser.GetLength())
	{
		CWnd *pWnd=GetDlgItem(IDC_USER_EDIT);
		pWnd->EnableWindow(FALSE);
	}
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CPasswordDlg::OnOK() 
{
	UpdateData();

	if(m_szUser.GetLength()<2)
	{
		MessageBox("Username too small            ","",MB_OK|MB_ICONSTOP);
		CWnd *pWnd=GetDlgItem(IDC_USER_EDIT);
		pWnd->SetFocus();

		return;
	}
	
	CDialog::OnOK();
}

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
Software Developer Microsoft
United States United States
Have completed BSc in Computer Science & Engineering from Shah Jalal University of Science & Technology, Sylhet, Bangladesh (SUST).

Story books (specially Masud Rana series), tourism, songs and programming is most favorite.

Blog:
Maruf Notes
http://blog.kuashaonline.com

Comments and Discussions