www.gusucode.com > VC++利用远程线程屏蔽ctrl+alt+del组合键源码程序 > VC++利用远程线程屏蔽ctrl+alt+del组合键源码程序\code\aDlg.cpp

    // aDlg.cpp : implementation file
// Download by http://www.NewXing.com

#include "stdafx.h"
#include "a.h"
#include "aDlg.h"


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

/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About

class CAboutDlg : public CDialog
{
public:
	CAboutDlg();

// Dialog Data
	//{{AFX_DATA(CAboutDlg)
	enum { IDD = IDD_ABOUTBOX };
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CAboutDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	//{{AFX_MSG(CAboutDlg)
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
	//{{AFX_DATA_INIT(CAboutDlg)
	//}}AFX_DATA_INIT
}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CAboutDlg)
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
	//{{AFX_MSG_MAP(CAboutDlg)
		// No message handlers
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CADlg dialog

CADlg::CADlg(CWnd* pParent /*=NULL*/)
	: CDialog(CADlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CADlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
	// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CADlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CADlg)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CADlg, CDialog)
	//{{AFX_MSG_MAP(CADlg)
	ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
	ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CADlg message handlers



 

void CADlg::OnButton2() 
{
	typedef BOOL (__stdcall * _EnabledKey)(const char* sa);
	HINSTANCE hDLLInst = ::LoadLibrary("RunDLL.dll");      
    if(hDLLInst)
	{
		_EnabledKey EnabledKey=(_EnabledKey)::GetProcAddress(hDLLInst, "EnabledKey");
		if(EnabledKey)
		{
			char szPath[MAX_PATH];
			::GetCurrentDirectory(MAX_PATH,szPath);
			strcat(szPath,"\\SASHOOK.dll");
		  
			if (EnabledKey(szPath));
				MessageBox("成功屏蔽");
		}
		::FreeLibrary(hDLLInst);
	}
}

void CADlg::OnButton3() 
{
	typedef BOOL (__stdcall * _EnabledKey)(const char* sa);
	HINSTANCE hDLLInst = ::LoadLibrary("RunDLL.dll");      
    if(hDLLInst)
	{
		_EnabledKey DisabledKey=(_EnabledKey)::GetProcAddress(hDLLInst, "DisabledKey");
		if(DisabledKey)
		{
			char szPath[MAX_PATH];
			::GetCurrentDirectory(MAX_PATH,szPath);
			strcat(szPath,"\\SASHOOK.dll");
		  
			if (DisabledKey(szPath));
				MessageBox("成功解除");
		}
		::FreeLibrary(hDLLInst);
	}	
}