Click here to Skip to main content
13,007,145 members (60,278 online)
Click here to Skip to main content

Stats

135.8K views
8.6K downloads
102 bookmarked
Posted 31 Aug 2003

Remote Processes and Machine control of Windows NT based systems (2000/XP)

, 1 Apr 2012
Control certain aspects of machines sitting remotely, without having to install and trigger an application on the remote machine.
// RemoteProcessDlg.cpp : implementation file
//

#include "stdafx.h"
#include "RemoteAdmin.h"
#include "RemoteProcessDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CRemoteProcessDlg dialog


CRemoteProcessDlg::CRemoteProcessDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CRemoteProcessDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CRemoteProcessDlg)
	m_strDomain = _T("");
	m_strPassword = _T("");
	m_strProcessPath = _T("");
	m_strUser = _T("");
	//}}AFX_DATA_INIT
}


void CRemoteProcessDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CRemoteProcessDlg)
	DDX_Text(pDX, IDC_EDIT_DOMAIN, m_strDomain);
	DDX_Text(pDX, IDC_EDIT_PASSWORD, m_strPassword);
	DDX_Text(pDX, IDC_EDIT_PROCESS_NAME, m_strProcessPath);
	DDX_Text(pDX, IDC_EDIT_USER, m_strUser);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CRemoteProcessDlg, CDialog)
	//{{AFX_MSG_MAP(CRemoteProcessDlg)
	ON_EN_CHANGE(IDC_EDIT_PROCESS_NAME, OnProcessNameChange)
    ON_EN_CHANGE(IDC_EDIT_USER, OnUserNameChange)
	ON_WM_CANCELMODE()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()


void CRemoteProcessDlg::OnProcessNameChange()
{
    CString strProcess;
    CString strUser;
    CButton* bButton = NULL;

    GetDlgItemText(IDC_EDIT_PROCESS_NAME, strProcess);
    GetDlgItemText(IDC_EDIT_USER, strUser);
    
    if (strProcess == _T("") ||  strUser == _T(""))
    {
        bButton = static_cast<CButton*>(GetDlgItem(IDOK));
        bButton->EnableWindow(FALSE);
    }
    else
    {
        bButton = static_cast<CButton*>(GetDlgItem(IDOK));
        bButton->EnableWindow(TRUE);
    }
}

void CRemoteProcessDlg::OnUserNameChange()
{
    CString strProcess;
    CString strUser;
    CButton* bButton = NULL;

    GetDlgItemText(IDC_EDIT_PROCESS_NAME, strProcess);
    GetDlgItemText(IDC_EDIT_USER, strUser);

    if (strProcess == _T("") ||  strUser == _T(""))
    {
        bButton = static_cast<CButton*>(GetDlgItem(IDOK));
        bButton->EnableWindow(FALSE);
    }
    else
    {
        bButton = static_cast<CButton*>(GetDlgItem(IDOK));
        bButton->EnableWindow(TRUE);
    }
}

BOOL CRemoteProcessDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
    CButton* bButton = static_cast<CButton*>(GetDlgItem(IDOK));
    bButton->EnableWindow(FALSE);
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CRemoteProcessDlg::OnCancelMode() 
{
	CDialog::OnCancelMode();
}

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)

Share

About the Author

Prateek Kaul
Web Developer
India India
No Biography provided

You may also be interested in...

Pro
Pro
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170628.1 | Last Updated 1 Apr 2012
Article Copyright 2003 by Prateek Kaul
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid