Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

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.
#ifndef REMOTEADMINDOC_H
#define REMOTEADMINDOC_H

#if _MSC_VER > 1000
#pragma once 
#endif // _MSC_VER > 1000

#include "RemoteAdministrator.h"
#include "command.h"

class CMachineInfo;
class CMachineView;
class CRemoteAdminView;
class CProgressWndThread;

class CRemoteAdminDoc : public CDocument
{
	DECLARE_DYNCREATE(CRemoteAdminDoc)

public:
    void AddMachine(CMachineInfo& miMachineInfo);
	void DeleteMachine(CMachineInfo& miMachineInfo);
    BOOL CheckIfMachinePresent(CString strIP);
    
    BOOL EstablishAllConnections(CString strRemoteMachineIP, CString strPwd, BOOL bEstablish, CMachineView* pMachineView, CRemoteAdminView* pRemoteAdminView);
    BOOL CopyServiceExeToRemoteMachine(CString strRemoteMachineIP);

    HANDLE GetRemoteAdminPipe(CString strRemoteMachineIP);
    HANDLE GetRemoteAdminProcessInfoPipe(CString strRemoteMachineIP);
    HANDLE GetRemoteAdminProcessExecutePipe(CString strRemoteMachineIP);
    HANDLE GetRemoteAdminProcessKillPipe(CString strRemoteMachineIP);
    HANDLE GetRemoteAdminSysShutDownPipe(CString strRemoteMachineIP);
    int GetTotalMachinesMonitored();
	UINT GetNumberOfMachineConnectionsStillInProgress();

    HANDLE m_hUpdateProcessList;

    void RefreshProcessList(CString strRemoteMachineIP, CProcessInfoList& pilList);
    CProcessInfoList* GetProcessInfoList(CString strRemoteMachineIP);
    void DeleteAndDisconnectAllMachines();
    void DeleteAndDisconnectMachine(CString strRemoteAdminMachine);
    BOOL ConnectToRemoteService(CString strRemoteMachineIP, CString strPwd, CMachineView* pMachineView, CRemoteAdminView* pRemoteAdminView);
    void GetConnectedMachinesIP(CString** pstrConnctedMachinesIP /*out*/, int* piNumberOfConnectedMachines/*out*/);
    BOOL AddToConnectionPendingList(CString strIP);
    BOOL RemoveFromConnecionPendingList(CString strIP);
    BOOL IsConnectionPending(CString strIP);
	BOOL AreConnectionsStillPending();     // TRUE if connection process to any machine is in queue, else FALSE
	CString GetPasswordForMachine(CString strIP);
	void CreateVisualThread();
	void SetVisualProgressThread(CProgressWndThread* pThread = NULL);
	CString GetComputerNameFromIP(CString& strIP);
	CString GetComputerIPFromName(CString& strComputerName);
		
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CRemoteAdminDoc)
	public:
	virtual BOOL OnNewDocument();
	virtual void Serialize(CArchive& ar);
	virtual void OnCloseDocument();
	virtual BOOL OnSaveDocument(LPCTSTR lpszPathName);
	virtual BOOL OnOpenDocument(LPCTSTR lpszPathName);
	virtual void DeleteContents();
	virtual BOOL CanCloseFrame(CFrameWnd* pFrame);
	//}}AFX_VIRTUAL

    virtual ~CRemoteAdminDoc();
    
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif



// Generated message map functions
protected:
    CRemoteAdminDoc(); // create from serialization only

    CRemoteAdministrator m_RemoteAdministrator;
    CMachineInfoList* m_milInfoReadFromArchiveList;
	CProgressWndThread* m_pVisualProgressThread;
 
	//{{AFX_MSG(CRemoteAdminDoc)
		// NOTE - the ClassWizard will add and remove member functions here.
		//    DO NOT EDIT what you see in these blocks of generated code !
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};


inline HANDLE CRemoteAdminDoc::GetRemoteAdminPipe(CString strRemoteMachineIP)
{
    return m_RemoteAdministrator.GetRemoteAdminPipe(strRemoteMachineIP);
}

inline HANDLE CRemoteAdminDoc::GetRemoteAdminProcessInfoPipe(CString strRemoteMachineIP)
{
    return m_RemoteAdministrator.GetRemoteAdminProcessInfoPipe(strRemoteMachineIP);
}

inline HANDLE CRemoteAdminDoc::GetRemoteAdminProcessExecutePipe(CString strRemoteMachineIP)
{
    return m_RemoteAdministrator.GetRemoteAdminProcessExecutePipe(strRemoteMachineIP);
}

inline HANDLE CRemoteAdminDoc::GetRemoteAdminProcessKillPipe(CString strRemoteMachineIP)
{
    return m_RemoteAdministrator.GetRemoteAdminProcessKillPipe(strRemoteMachineIP);
}

inline HANDLE CRemoteAdminDoc::GetRemoteAdminSysShutDownPipe(CString strRemoteMachineIP)
{
    return m_RemoteAdministrator.GetRemoteAdminSysShutDownPipe(strRemoteMachineIP);
}

inline void CRemoteAdminDoc::SetVisualProgressThread(CProgressWndThread* pThread)
{
	m_pVisualProgressThread = pThread;
}
#endif // REMOTEADMINDOC_H

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)

About the Author

Prateek Kaul
Web Developer
India India
No Biography provided

| Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 1 Apr 2012
Article Copyright 2003 by Prateek Kaul
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid