Click here to Skip to main content
13,834,745 members
Click here to Skip to main content

Tagged as


102 bookmarked
Posted 31 Aug 2003
Licenced CPOL

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.

#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

    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
	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);

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

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

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

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;

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.


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

You may also be interested in...

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web03 | 2.8.190114.1 | Last Updated 1 Apr 2012
Article Copyright 2003 by Prateek Kaul
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid