This commit is contained in:
2024-08-07 09:16:27 -04:00
parent fdfadd5c7e
commit 5f971cf684
5200 changed files with 731717 additions and 0 deletions

14
remotepsapp/ASMUTIL.HPP Normal file
View File

@@ -0,0 +1,14 @@
#ifndef _REMOTEPSAPP_ASMUTIL_HPP_
#define _REMOTEPSAPP_ASMUTIL_HPP_
class RGB888;
class ImageInfo;
extern "C"
{
resampleClipRow(RGB888 *lpIn,RGB888 *lpOut,DWORD inLen,DWORD outLen);
resampleClipCol(RGB888 *lpIn,RGB888 *lpOut,DWORD inLen,DWORD inWidth,DWORD outLen,DWORD outWidth);
setAt(ImageInfo *pImageInfo);
copyBGRRGB(void *pRGB,void *pBGR,int items,int output_components);
}
#endif

View File

@@ -0,0 +1,87 @@
#include <remotepsapp/ConnectionThread.hpp>
ConnectionThread::ConnectionThread(void)
: mIsInConnect(false)
{
mThreadHandler.setCallback(this,&ConnectionThread::threadHandler);
insertHandler(&mThreadHandler);
}
ConnectionThread::ConnectionThread(const ConnectionThread &/*someConnectionThread*/)
{ // private implementation
}
ConnectionThread::~ConnectionThread()
{
removeHandler(&mThreadHandler);
if(mIsInConnect){mIsInConnect=false;fatalThreadExit();}
}
ConnectionThread &ConnectionThread::operator=(const ConnectionThread &someConnectionThread)
{ // private implementation
return *this;
}
void ConnectionThread::handleConnect(const String &serverName)
{
String *pComputerName=::new String(serverName);
ThreadMessage connectMessage(ThreadMessage::TM_USER,MsgConnect,(LONG)pComputerName);
mIsInConnect=true;
MessageThread::postMessage(connectMessage);
}
DWORD ConnectionThread::threadHandler(ThreadMessage &threadMessage)
{
switch(threadMessage.message())
{
case ThreadMessage::TM_CREATE :
break;
case ThreadMessage::TM_DESTROY :
break;
case ThreadMessage::TM_USER :
if(MsgConnect==threadMessage.userDataOne())
{
thConnect(*((String*)threadMessage.userDataTwo()));
mIsInConnect=false;
::delete (String*)threadMessage.userDataTwo();
}
break;
}
return FALSE;
}
void ConnectionThread::thConnect(const String &strServerName)
{
ComInitializer comInitializer;
mStrServerName=strServerName;
preConnect(strServerName);
if(!mRemoteProcessInfo.connect(strServerName))
{
mConnectionMutex.releaseMutex();
errorHandler();
return;
}
connectionHandler(mRemoteProcessInfo);
preDisconnect(strServerName);
mRemoteProcessInfo.disconnect();
mConnectionMutex.releaseMutex();
}
// ******* virtuals
void ConnectionThread::connectionHandler(RemoteProcessInfo &/*remoteProcessInfo*/)
{
}
void ConnectionThread::errorHandler(void)
{
}
void ConnectionThread::preConnect(const String &strServerName)
{
}
void ConnectionThread::preDisconnect(const String &strServerName)
{
}

View File

@@ -0,0 +1,51 @@
#ifndef _REMOTEPSAPP_CONNECTIONTHREAD_HPP_
#define _REMOTEPSAPP_CONNECTIONTHREAD_HPP_
#ifndef _REMOTEPSAPP_REMOTEPROCESSINFO_HPP_
#include <remotepsapp/remoteprocessinfo.hpp>
#endif
#ifndef _THREAD_MESSAGETHREAD_HPP_
#include <thread/mthread.hpp>
#endif
#ifndef _THREAD_MUTEX_HPP_
#include <thread/mutex.hpp>
#endif
class ConnectionThread : public MessageThread
{
public:
ConnectionThread(void);
virtual ~ConnectionThread();
void handleConnect(const String &serverName);
bool isInConnect(void)const;
const String &serverName(void)const;
protected:
virtual void connectionHandler(RemoteProcessInfo &remoteProcessInfo);
virtual void errorHandler(void);
virtual void preConnect(const String &strServerName);
virtual void preDisconnect(const String &strServerName);
private:
enum {MsgConnect};
ConnectionThread(const ConnectionThread &someConnectionThread);
ConnectionThread &operator=(const ConnectionThread &someConnectionThread);
DWORD threadHandler(ThreadMessage &threadMessage);
void thConnect(const String &strServerName);
ThreadCallback<ConnectionThread> mThreadHandler;
Mutex mConnectionMutex;
RemoteProcessInfo mRemoteProcessInfo;
String mStrServerName;
bool mIsInConnect;
};
inline
bool ConnectionThread::isInConnect(void)const
{
return mIsInConnect;
}
inline
const String &ConnectionThread::serverName(void)const
{
return mStrServerName;
}
#endif

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
remotepsapp/Debug/vc60.idb Normal file

Binary file not shown.

BIN
remotepsapp/Debug/vc60.pdb Normal file

Binary file not shown.

246
remotepsapp/Mainfrm.cpp Normal file
View File

@@ -0,0 +1,246 @@
#include <remotepsapp/mainfrm.hpp>
#include <remotepsapp/remoteps.hpp>
#include <remotepsapp/connectiondialog.hpp>
#include <remotepsapp/processview.hpp>
#include <common/puremenu.hpp>
#include <statbar/statbarx.hpp>
MainFrame::MainFrame(void)
{
mQueryEndSessionHandler.setCallback(this,&MainFrame::queryEndSessionHandler);
mCloseHandler.setCallback(this,&MainFrame::closeHandler);
mSizeHandler.setCallback(this,&MainFrame::sizeHandler);
mCommandHandler.setCallback(this,&MainFrame::commandHandler);
mCreateHandler.setCallback(this,&MainFrame::createHandler);
mDestroyHandler.setCallback(this,&MainFrame::destroyHandler);
insertHandler(VectorHandler::QueryEndSessionHandler,&mQueryEndSessionHandler);
insertHandler(VectorHandler::CloseHandler,&mCloseHandler);
insertHandler(VectorHandler::SizeHandler,&mSizeHandler);
insertHandler(VectorHandler::CommandHandler,&mCommandHandler);
insertHandler(VectorHandler::CreateHandler,&mCreateHandler);
insertHandler(VectorHandler::DestroyHandler,&mDestroyHandler);
}
MainFrame::~MainFrame()
{
removeHandler(VectorHandler::QueryEndSessionHandler,&mQueryEndSessionHandler);
removeHandler(VectorHandler::CloseHandler,&mCloseHandler);
removeHandler(VectorHandler::SizeHandler,&mSizeHandler);
removeHandler(VectorHandler::CommandHandler,&mCommandHandler);
removeHandler(VectorHandler::CreateHandler,&mCreateHandler);
removeHandler(VectorHandler::DestroyHandler,&mDestroyHandler);
}
CallbackData::ReturnType MainFrame::queryEndSessionHandler(CallbackData &someCallbackData)
{
if(getClient().hasChildren())return (CallbackData::ReturnType)FALSE;
return (CallbackData::ReturnType)FALSE;
}
CallbackData::ReturnType MainFrame::destroyHandler(CallbackData &someCallbackData)
{
postQuitMessage();
::WinHelp(*this,0,HELP_QUIT,0);
return (CallbackData::ReturnType)FALSE;
}
CallbackData::ReturnType MainFrame::closeHandler(CallbackData &someCallbackData)
{
destroy();
return (CallbackData::ReturnType)FALSE;
}
CallbackData::ReturnType MainFrame::createHandler(CallbackData &someCallbackData)
{
mStatusControl=::new StatusBarEx(*this,getClient(),StatusControlID);
mStatusControl.disposition(PointerDisposition::Delete);
setParts(SinglePart);
setText("Ready");
setCaption();
bringWindowToTop();
return (CallbackData::ReturnType)TRUE;
}
CallbackData::ReturnType MainFrame::sizeHandler(CallbackData &someCallbackData)
{
Rect statusRect;
Rect cRect;
mStatusControl->windowRect(statusRect);
cRect.right(someCallbackData.loWord());
cRect.bottom(someCallbackData.hiWord());
getClient().moveWindow(0,0,cRect.right(),cRect.bottom()-(statusRect.bottom()-statusRect.top()));
return (CallbackData::ReturnType)FALSE;
}
CallbackData::ReturnType MainFrame::commandHandler(CallbackData &someCallbackData)
{
switch(someCallbackData.wParam())
{
case IDM_CASCADE :
cascade();
break;
case IDM_TILE :
tile();
break;
case IDM_ARRANGE :
arrange();
break;
case IDM_CLOSEALL :
closeAll();
break;
case IDM_MINIMIZEALL :
minimizeAll();
break;
case IDM_RESTOREALL :
restoreAll();
break;
case PSMENU_FILEOPEN :
handleFileOpen();
break;
case PSMENU_FILECLOSE :
handleFileClose();
break;
case PSMENU_FILESAVE :
handleFileSave();
break;
case PSMENU_FILESAVEAS :
handleFileSaveAs();
break;
case PSMENU_FILEPRINT :
handleFilePrint();
break;
case PSMENU_FILEQUIT :
handleFileQuit();
break;
case PSMENU_SINGLECONNECTION :
handleFileOpenSingleConnection();
break;
case PSMENU_SELECTGROUP :
handleFileSelectGroup();
break;
}
// if(someCallbackData.wParam()>=StartDynamicID)handleFileOpenEvent(someCallbackData);
return (CallbackData::ReturnType)FALSE;
}
void MainFrame::setParts(int numParts)
{
GlobalData<int> statParts;
if(1==numParts){statParts.size(1);*((int*)&statParts[0])=FirstPartWidth;}
else {statParts.size(2);*((int*)&statParts[0])=FirstPartWidth;*((int*)&statParts[0]+1)=SecondPartWidth;}
mStatusControl->setParts(statParts);
}
void MainFrame::setText(const String &strText)
{
if(!mStatusControl.isOkay())return;
mStatusControl->setText(strText);
mStatusControl->update();
}
void MainFrame::splash(void)
{
// SplashScreen splashScreen("APISPY","",3000);
// splashScreen.perform();
}
void MainFrame::setCaption(String strText)
{
String strCaption;
windowText(strCaption);
FrameWindow::setCaption(strCaption);
}
void MainFrame::handleFileOpen(void)
{
GDIPoint cursorPos;
cursorPos.x(0);
cursorPos.y(0);
PureMenu popupMenu(PureMenu::PopupMenu);
popupMenu.insertMenu(0,PureMenu::ItemString,PSMENU_SINGLECONNECTION,"Single &Connection...");
popupMenu.insertMenu(1,PureMenu::ItemString,PSMENU_SELECTGROUP,"Select &Group...");
popupMenu.trackPopupMenu(*this,cursorPos,PureMenu::CenterAlign|PureMenu::TopAlign);
}
void MainFrame::handleFileOpenSingleConnection(void)
{
SmartPointer<MDIWindow> mdiWindow;
ProcessView *processView;
ConnectionDialog connectionDialog;
String strComputerName;
if(!connectionDialog.perform(*this,strComputerName))return;
processView=::new ProcessView;
processView->createWindow(*this,String(STRING_PROCESSVIEWCLASSNAME),"ProcessView","viewMenu","psicon");
insert(*processView);
processView->connect(strComputerName);
}
void MainFrame::handleFileSelectGroup(void)
{
}
void MainFrame::handleFileClose(void)
{
}
void MainFrame::handleFileSave(void)
{
}
void MainFrame::handleFileSaveAs(void)
{
}
void MainFrame::handleFilePrint(void)
{
}
void MainFrame::handleFileQuit(void)
{
postMessage(*this,WM_CLOSE,0,0L);
}
// *** virtuals
void MainFrame::mdiDestroy(MDIWindow &mdiWindow)
{
}
void MainFrame::mdiActivate(MDIWindow &mdiWindow)
{
#if 0
String strWindowText;
mdiWindow.windowText(strWindowText);
if(strWindowText.betweenString(0,' ')==String("Definitions"))setParts(DoublePart);
*mStatusControl=mdiWindow.getMenu();
mStatusControl->setSequentialResourceDescriptors(SPYMENU_FILEOPEN,STRING_DESCRIPTORFILEOPEN,(STRING_DESCRIPTORHELPABOUT-STRING_DESCRIPTORFILEOPEN)+1);
removeHistory(mdiWindow.getMenu());
applyHistory(mdiWindow.getMenu());
if(mAPIDebug.isOkay()&&mAPIDebug->isDebugging())
{
enableMenuItems(0,SPYMENU_FILECLOSE,PureMenu::ByCommand,PureMenu::ItemEnabled);
enableMenuItems(0,SPYMENU_FILEOPEN,PureMenu::ByCommand,PureMenu::InsertFlags(PureMenu::ItemDisabled|PureMenu::ItemGrayed));
}
else if((mAPIDebug.isOkay()&&!mAPIDebug->isDebugging())||!mAPIDebug.isOkay())
{
enableMenuItems(0,SPYMENU_FILECLOSE,PureMenu::ByCommand,PureMenu::InsertFlags(PureMenu::ItemDisabled|PureMenu::ItemGrayed));
enableMenuItems(0,SPYMENU_FILEOPEN,PureMenu::ByCommand,PureMenu::ItemEnabled);
}
#endif
}
void MainFrame::mdiDeactivate(MDIWindow &mdiWindow)
{
// String strWindowText;
// mdiWindow.windowText(strWindowText);
// if(strWindowText.betweenString(0,' ')==String("Definitions"))setParts(SinglePart);
// mStatusControl->setText(" ");
}

121
remotepsapp/Optnsreg.cpp Normal file
View File

@@ -0,0 +1,121 @@
#include <remotepsapp/optnsreg.hpp>
#include <common/stdio.hpp>
bool OptionsReg::setGroup(Group &group)
{
RegKey regKey(RegKey::CurrentUser);
String strIndex;
if(group.groupName().isNull()||!group.size())return false;
if(!regKey.openKey(mOptionsKeyName+mOptionsKeyGroupsPostfix+String("\\")+group.groupName()))
{
regKey.createKey(mOptionsKeyName+mOptionsKeyGroupsPostfix+String("\\")+group.groupName(),"");
regKey.openKey(mOptionsKeyName+mOptionsKeyGroupsPostfix+String("\\")+group.groupName());
}
for(int index=0;index<group.size();index++)
{
::sprintf(strIndex,"E%d",index);
regKey.setValue(strIndex,group[index]);
}
return true;
}
bool OptionsReg::getGroup(Group &group)
{
RegKey regKey(RegKey::CurrentUser);
DWORD index(0);
String strGroupEntry;
String strIndex;
group.remove();
if(group.groupName().isNull())return false;
if(!regKey.openKey(mOptionsKeyName+mOptionsKeyGroupsPostfix+String("\\")+group.groupName()))return false;
while(true)
{
::sprintf(strIndex,"E%d",index);
if(!regKey.enumValue(index++,strIndex,strGroupEntry))break;
group.insert(&strGroupEntry);
}
return group.size()?true:false;
}
bool OptionsReg::getGroupNames(Block<String> &groupNames)
{
RegKey regKey(RegKey::CurrentUser);
DWORD index(0);
String strGroupName;
groupNames.remove();
if(!regKey.openKey(mOptionsKeyName+mOptionsKeyGroupsPostfix))return false;
while(true)
{
if(!regKey.enumKey(index++,strGroupName))break;
groupNames.insert(&strGroupName);
}
return groupNames.size()?true:false;
}
bool OptionsReg::getConnections(Block<String> &connectionNames)
{
RegKey regKey(RegKey::CurrentUser);
String strConnectionName;
String strIndex;
DWORD index;
index=0;
connectionNames.remove();
if(!regKey.openKey(mOptionsKeyName+mOptionsKeyConnectionsPostfix))return false;
while(true)
{
::sprintf(strIndex,"C%d",index++);
if(!regKey.queryValue(strIndex,strConnectionName))break;
connectionNames.insert(&strConnectionName);
}
return connectionNames.size()?true:false;
}
void OptionsReg::setConnections(Block<String> &connectionNames)
{
RegKey regKey(RegKey::CurrentUser);
String strConnectionEntry;
String strIndex;
if(!regKey.openKey(mOptionsKeyName+mOptionsKeyConnectionsPostfix))
{
regKey.createKey(mOptionsKeyName+mOptionsKeyConnectionsPostfix,"");
regKey.openKey(mOptionsKeyName+mOptionsKeyConnectionsPostfix);
}
for(int index=0;index<connectionNames.size();index++)
{
String &strConnection=connectionNames[index];
strConnection.lower();
::sprintf(strIndex,"C%d",index);
regKey.setValue(strIndex,strConnection);
}
return;
}
void OptionsReg::insertConnection(const String &strConnection)
{
RegKey regKey(RegKey::CurrentUser);
Block<String> strConnections;
String cpyConnection;
String strIndex;
if(!regKey.openKey(mOptionsKeyName+mOptionsKeyConnectionsPostfix))
{
regKey.createKey(mOptionsKeyName+mOptionsKeyConnectionsPostfix,"");
regKey.openKey(mOptionsKeyName+mOptionsKeyConnectionsPostfix);
}
if(strConnection.isNull())return;
cpyConnection=strConnection;
cpyConnection.lower();
getConnections(strConnections);
for(int index=0;index<strConnections.size();index++)
{
String &connectionName=strConnections[index];
if(cpyConnection==connectionName)return;
}
::sprintf(strIndex,"C%d",strConnections.size());
regKey.setValue(strIndex,cpyConnection);
}

68
remotepsapp/Optnsreg.hpp Normal file
View File

@@ -0,0 +1,68 @@
#ifndef _REMOTEPSAPP_OPTIONSREG_HPP_
#define _REMOTEPSAPP_OPTIONSREG_HPP_
#ifndef _COMMON_WINDOWS_HPP_
#include <common/windows.hpp>
#endif
#ifndef _COMMON_REGKEY_HPP_
#include <common/regkey.hpp>
#endif
#ifndef _COMMON_STRING_HPP_
#include <common/string.hpp>
#endif
#ifndef _REMOTEPSAPP_GROUP_HPP_
#include <remotepsapp/group.hpp>
#endif
class OptionsReg
{
public:
OptionsReg(void);
virtual ~OptionsReg();
bool setGroup(Group &group);
bool getGroup(Group &group);
bool getGroupNames(Block<String> &groupNames);
bool getConnections(Block<String> &connectionNames);
void setConnections(Block<String> &connectionNames);
void insertConnection(const String &strConnectionName);
private:
OptionsReg(const OptionsReg &someOptionsReg);
OptionsReg &operator=(const OptionsReg &someOptionsReg);
RegKey mRegKey;
String mOptionsKeyName;
String mOptionsKeyGroupsPostfix;
String mOptionsKeyConnectionsPostfix;
};
inline
OptionsReg::OptionsReg(void)
: mRegKey(RegKey::CurrentUser), mOptionsKeyName("Software\\Diversified\\RemotePS\\Options"),
mOptionsKeyGroupsPostfix("\\Groups"), mOptionsKeyConnectionsPostfix("\\Connections")
{
if(!mRegKey.openKey(mOptionsKeyName))
{
mRegKey.createKey(mOptionsKeyName,"");
mRegKey.openKey(mOptionsKeyName);
}
}
inline
OptionsReg::OptionsReg(const OptionsReg &someOptionsReg)
// private implementation
: mRegKey(RegKey::CurrentUser), mOptionsKeyName("Software\\Diversified\\RemotePS\\Options"),
mOptionsKeyGroupsPostfix("\\Groups"), mOptionsKeyConnectionsPostfix("\\Connections")
{
*this=someOptionsReg;
}
inline
OptionsReg::~OptionsReg()
{
}
inline
OptionsReg &OptionsReg::operator=(const OptionsReg &/*someOptionsReg*/)
{ // private implementation
return *this;
}
#endif

123
remotepsapp/ProcessItem.hpp Normal file
View File

@@ -0,0 +1,123 @@
#ifndef _REMOTEPSAPP_PROCESSITEM_HPP_
#define _REMOTEPSAPP_PROCESSITEM_HPP_
#ifndef _COMMON_STRING_HPP_
#include <common/string.hpp>
#endif
#ifndef _COMMON_BLOCK_HPP_
#include <common/block.hpp>
#endif
#ifndef _COMMON_SYSTEMTIME_HPP_
#include <common/systime.hpp>
#endif
typedef Block<String> ModuleList;
class ProcessItem : public ModuleList
{
public:
ProcessItem(void);
virtual ~ProcessItem();
const String &processName(void)const;
void processName(const String &processName);
DWORD processID(void)const;
void processID(DWORD processID);
const SystemTime &creationTime(void)const;
void creationTime(const SystemTime &creationTime);
const SystemTime &exitTime(void)const;
void exitTime(const SystemTime &exitTime);
const SystemTime &kernelTime(void)const;
void kernelTime(const SystemTime &kernelTime);
const SystemTime &userTime(void)const;
void userTime(const SystemTime &userTime);
private:
String mProcessName;
SystemTime mCreationTime;
SystemTime mExitTime;
SystemTime mKernelTime;
SystemTime mUserTime;
DWORD mProcessID;
};
inline
ProcessItem::ProcessItem(void)
: mProcessID(0)
{
}
inline
ProcessItem::~ProcessItem()
{
}
inline
const String &ProcessItem::processName(void)const
{
return mProcessName;
}
inline
void ProcessItem::processName(const String &processName)
{
mProcessName=processName;
}
inline
DWORD ProcessItem::processID(void)const
{
return mProcessID;
}
inline
void ProcessItem::processID(DWORD processID)
{
mProcessID=processID;
}
inline
const SystemTime &ProcessItem::creationTime(void)const
{
return mCreationTime;
}
inline
void ProcessItem::creationTime(const SystemTime &creationTime)
{
mCreationTime=creationTime;
}
inline
const SystemTime &ProcessItem::exitTime(void)const
{
return mExitTime;
}
inline
void ProcessItem::exitTime(const SystemTime &exitTime)
{
mExitTime=exitTime;
}
inline
const SystemTime &ProcessItem::kernelTime(void)const
{
return mKernelTime;
}
inline
void ProcessItem::kernelTime(const SystemTime &kernelTime)
{
mKernelTime=kernelTime;
}
inline
const SystemTime &ProcessItem::userTime(void)const
{
return mUserTime;
}
inline
void ProcessItem::userTime(const SystemTime &userTime)
{
mUserTime=userTime;
}
#endif

View File

@@ -0,0 +1,39 @@
#ifndef _REMOTEPSAPP_PROCESSLIST_HPP_
#define _REMOTEPSAPP_PROCESSLIST_HPP_
#ifndef _REMOTEPSAPP_PROCESSITEM_HPP_
#include <remotepsapp/processitem.hpp>
#endif
class ProcessList : public Block<ProcessItem>
{
public:
ProcessList(void);
virtual ~ProcessList();
const String &computerName(void)const;
void computerName(const String &strComputerName);
private:
String mStrComputerName;
};
inline
ProcessList::ProcessList(void)
{
}
inline
ProcessList::~ProcessList()
{
}
inline
const String &ProcessList::computerName(void)const
{
return mStrComputerName;
}
inline
void ProcessList::computerName(const String &strComputerName)
{
mStrComputerName=strComputerName;
}
#endif

101
remotepsapp/RGB888.HPP Normal file
View File

@@ -0,0 +1,101 @@
#ifndef _REMOTEPSAPP_RGB888_HPP_
#define _REMOTEPSAPP_RGB888_HPP_
#ifndef _COMMON_WINDOWS_HPP_
#include <common/windows.hpp>
#endif
class RGB888
{
public:
RGB888(void);
RGB888(const RGB888 &someRGB888);
RGB888(BYTE red,BYTE green,BYTE blue);
~RGB888(); // the destructor cannot be virtual
RGB888 &operator=(const RGB888 &someRGB888);
BOOL operator==(const RGB888 &someRGB888);
BYTE red(void)const;
void red(BYTE red);
BYTE green(void)const;
void green(BYTE green);
BYTE blue(void)const;
void blue(BYTE blue);
private:
BYTE mBlue;
BYTE mGreen;
BYTE mRed;
};
inline
RGB888::RGB888(void)
: mBlue(0), mGreen(0), mRed(0)
{
}
inline
RGB888::RGB888(BYTE red,BYTE green,BYTE blue)
: mBlue(blue), mGreen(green), mRed(red)
{
}
inline
RGB888::RGB888(const RGB888 &someRGB888)
{
*this=someRGB888;
}
inline
RGB888::~RGB888()
{
}
inline
RGB888 &RGB888::operator=(const RGB888 &someRGB888)
{
red(someRGB888.red());
green(someRGB888.green());
blue(someRGB888.blue());
return *this;
}
inline
BOOL RGB888::operator==(const RGB888 &someRGB888)
{
return red()==someRGB888.red()&&green()==someRGB888.green()&&blue()==someRGB888.blue();
}
inline
BYTE RGB888::red(void)const
{
return mRed;
}
inline
void RGB888::red(BYTE red)
{
mRed=red;
}
inline
BYTE RGB888::green(void)const
{
return mGreen;
}
inline
void RGB888::green(BYTE green)
{
mGreen=green;
}
inline
BYTE RGB888::blue(void)const
{
return mBlue;
}
inline
void RGB888::blue(BYTE blue)
{
mBlue=blue;
}
#endif

View File

@@ -0,0 +1,165 @@
#include <remotepsapp/RemoteProcessInfo.hpp>
#include <remotepsapp/windowview.hpp>
#include <com/bstring.hpp>
#include <com/variant.hpp>
#include <com/vtime.hpp>
#include <com/SafeArray.hpp>
#include <remoteps/remoteps_i.c>
#include <remoteps/remoteps.h>
#include <common/purehdc.hpp>
#include <common/openfile.hpp>
#include <common/pathfnd.hpp>
#include <common/errormsg.hpp>
RemoteProcessInfo::RemoteProcessInfo(void)
: mpIRemoteProcess(0)
{
}
RemoteProcessInfo::~RemoteProcessInfo()
{
disconnect();
}
bool RemoteProcessInfo::connect(const String &serverName)
{
ServerInfo serverInfo(serverName);
MultiQuery multiQuery;
ComResult comResult;
ComObj comObj;
if(isOkay())return false;
mServerName=serverName;
multiQuery.size(1);
multiQuery[0].pIID=&IID_IRemoteProcess;
comResult=comObj.createInstance(CLSID_CoRemoteProcess,0,ClassContext(RemoteServer|LocalServer),serverInfo,multiQuery);
if(!comResult.success())
{
ErrorMessage::message(comResult.error());
return false;
}
if(!ComResult(multiQuery[0].hr).success())return false;
mpIRemoteProcess=(IRemoteProcess*)multiQuery[0].pItf;
return isOkay();
}
void RemoteProcessInfo::disconnect(void)
{
if(!isOkay())return;
mpIRemoteProcess->Release();
mpIRemoteProcess=0;
}
bool RemoteProcessInfo::getListItems(void)
{
if(!isOkay())return false;
return getListItems(mpIRemoteProcess);
}
bool RemoteProcessInfo::getDesktopWindow(WindowView &windowView)
{
if(!isOkay())return false;
return getDesktopWindow(mpIRemoteProcess,windowView);
}
bool RemoteProcessInfo::getListItems(IRemoteProcess *pIRemoteProcess)
{
Variant variant;
Variant processVariant;
String ansiString;
String strParent;
DWORD processID;
int processCount;
if(!pIRemoteProcess)return false;
processCount=0;
remove();
computerName(mServerName);
try{pIRemoteProcess->Snapshot(&variant.getVARIANT());}
catch(...){return false;}
variant.getData(VTInt4,(void*)&processCount);
variant.clear();
if(!processCount)return false;
pIRemoteProcess->GetProcessFirst(&variant.getVARIANT());
variant.getData(VTInt4,&processID);
variant.clear();
for(int index=0;index<processCount;index++)
{
pIRemoteProcess->GetModuleFirst(&variant.getVARIANT());
if(VTInt4==variant.getType())variant.clear();
else
{
BString string;
variant.getData(string);
ansiString=string.toString();
ansiString.upper();
strParent=ansiString;
insert(&ProcessItem());
ProcessItem &processItem=operator[](size()-1);
processItem.processName(ansiString);
processItem.processID(processID);
variant.clear();
while(true)
{
pIRemoteProcess->GetModuleNext(&variant.getVARIANT());
if(VTInt4==variant.getType())
{
variant.clear();
break;
}
else
{
BString string;
variant.getData(string);
ansiString=string.toString();
ansiString.upper();
processItem.insert(&ansiString);
variant.clear();
}
}
}
pIRemoteProcess->GetProcessNext(&variant.getVARIANT());
variant.getData(VTInt4,&processID);
variant.clear();
}
return size()?true:false;
}
bool RemoteProcessInfo::getDesktopWindow(IRemoteProcess *pIRemoteProcess,WindowView &windowView)
{
String strFileName("image000.tmp");
String strPathFileName;
FileHandle outFile;
Variant variant;
SafeArray safeArray;
int upperBound;
BYTE *pData;
GlobalData<BYTE> imageBytes;
PathFind pathFind;
pathFind.getWindowsTempDirectory(strPathFileName);
strPathFileName+=strFileName;
pIRemoteProcess->GetDesktopWindow(&variant.getVARIANT());
if(VTArray!=variant.getType()){variant.clear();return false;}
if(!variant.getData(safeArray)){variant.clear();return false;}
upperBound=safeArray.getUpperBound();
safeArray.accessData((void**)&pData);
imageBytes.size(*((DWORD*)pData));
::memcpy(&imageBytes[0],pData+(sizeof(DWORD)),imageBytes.size());
outFile.open(strPathFileName,FileHandle::Write,FileHandle::ShareRead,FileHandle::Overwrite);
if(!outFile.isOkay())
{
safeArray.unaccessData();
safeArray.destroy();
variant.clear();
return false;
}
outFile.write(&imageBytes[0],imageBytes.size());
outFile.close();
windowView.createImage(strPathFileName);
::unlink(strPathFileName);
safeArray.unaccessData();
safeArray.destroy();
variant.clear();
return true;
}

View File

@@ -0,0 +1,49 @@
#ifndef _REMOTEPSAPP_REMOTEPROCESSINFO_HPP_
#define _REMOTEPSAPP_REMOTEPROCESSINFO_HPP_
#ifndef _COMMON_STRING_HPP_
#include <common/string.hpp>
#endif
#ifndef _NNTP_JPGIMAGE_HPP_
#include <jpgimg/jpgimg.hpp>
#endif
#ifndef _REMOTEPSAPP_PROCESSLIST_HPP_
#include <remotepsapp/processlist.hpp>
#endif
#ifndef _COM_COM_HPP_
#include <com/com.hpp>
#endif
class IRemoteProcess;
class WindowView;
class RemoteProcessInfo : public ProcessList
{
public:
RemoteProcessInfo(void);
virtual ~RemoteProcessInfo();
bool connect(const String &serverName);
void disconnect(void);
bool getListItems(void);
bool getDesktopWindow(WindowView &windowView);
const String &serverName(void)const;
bool isOkay(void)const;
private:
bool getListItems(IRemoteProcess *pIRemoteProcess);
bool getDesktopWindow(IRemoteProcess *pIRemoteProcess,WindowView &windowView);
String mServerName;
IRemoteProcess *mpIRemoteProcess;
};
inline
const String &RemoteProcessInfo::serverName(void)const
{
return mServerName;
}
inline
bool RemoteProcessInfo::isOkay(void)const
{
return mpIRemoteProcess?true:false;
}
#endif

362
remotepsapp/SCROLL.HPP Normal file
View File

@@ -0,0 +1,362 @@
#ifndef _REMOTEPSAPP_SCROLLINFO_HPP_
#define _REMOTEPSAPP_SCROLLINFO_HPP_
#ifndef _COMMON_WINDOWS_HPP_
#include <common/windows.hpp>
#endif
class ScrollInfo
{
public:
ScrollInfo(void);
ScrollInfo(const ScrollInfo &someScrollInfo);
virtual ~ScrollInfo();
ScrollInfo &operator=(const ScrollInfo &someScrollInfo);
BOOL operator==(const ScrollInfo &someScrollInfo)const;
void handleHorizontalScroll(CallbackData &someCallbackData);
void handleVerticalScroll(CallbackData &someCallbackData);
void handleSize(CallbackData &someCallbackData);
int minScrollx(void)const;
void minScrollx(int minScrollx);
int maxScrollx(void)const;
void maxScrollx(int maxScrollx);
int currScrollx(void)const;;
void currScrollx(int currScrollx);
int minScrolly(void)const;
void minScrolly(int minScrolly);
int maxScrolly(void)const;
void maxScrolly(int maxScrolly);
int currScrolly(void)const;
void currScrolly(int curScrolly);
void scrollableObjectDimensions(int width,int height);
int scrollableObjectWidth(void)const;
int scrollableObjectHeight(void)const;
BOOL scrollEvent(void)const;
void scrollEvent(BOOL scrollEvent);
BOOL sizeEvent(void)const;
void sizeEvent(BOOL sizeEvent);
HWND hwndOwner(void)const;
void hwndOwner(HWND hwndOwner);
private:
void scrollableObjectWidth(int scrollableObjectWidth);
void scrollableObjectHeight(int scrollableObjectHeight);
enum{PageIncrement=50,LineIncrement=5};
int imax(int param1,int param2);
int imin(int param1,int param2);
HWND mhWndOwner;
BOOL mSizeEvent;
BOOL mScrollEvent;
int mScrollableObjectWidth;
int mScrollableObjectHeight;
int mMinScrollx;
int mMaxScrollx;
int mCurrScrollx;
int mMinScrolly;
int mMaxScrolly;
int mCurrScrolly;
};
inline
ScrollInfo::ScrollInfo(void)
: mMinScrollx(0), mMaxScrollx(0), mCurrScrollx(0), mMinScrolly(0), mMaxScrolly(0), mCurrScrolly(0),
mScrollableObjectWidth(0), mScrollableObjectHeight(0), mSizeEvent(FALSE), mhWndOwner(0), mScrollEvent(FALSE)
{
}
inline
ScrollInfo::ScrollInfo(const ScrollInfo &someScrollInfo)
{
*this=someScrollInfo;
}
inline
ScrollInfo::~ScrollInfo()
{
}
inline
ScrollInfo &ScrollInfo::operator=(const ScrollInfo &someScrollInfo)
{
minScrollx(someScrollInfo.minScrollx());
maxScrollx(someScrollInfo.maxScrollx());
currScrollx(someScrollInfo.currScrollx());
maxScrolly(someScrollInfo.currScrolly());
minScrolly(someScrollInfo.maxScrolly());
currScrolly(someScrollInfo.minScrollx());
sizeEvent(someScrollInfo.minScrollx());
scrollEvent(someScrollInfo.scrollEvent());
scrollableObjectWidth(someScrollInfo.scrollableObjectWidth());
scrollableObjectHeight(someScrollInfo.scrollableObjectHeight());
hwndOwner(someScrollInfo.hwndOwner());
return *this;
}
inline
BOOL ScrollInfo::operator==(const ScrollInfo &someScrollInfo)const
{
return (minScrollx()==someScrollInfo.minScrollx()&&
maxScrollx()==someScrollInfo.maxScrollx()&&
currScrollx()==someScrollInfo.currScrollx()&&
minScrolly()==someScrollInfo.minScrolly()&&
maxScrolly()==someScrollInfo.maxScrolly()&&
currScrolly()==someScrollInfo.currScrolly()&&
sizeEvent()==someScrollInfo.sizeEvent()&&
scrollEvent()==someScrollInfo.scrollEvent()&&
scrollableObjectWidth()==someScrollInfo.scrollableObjectWidth()&&
scrollableObjectHeight()==someScrollInfo.scrollableObjectHeight()&&
hwndOwner()==someScrollInfo.hwndOwner());
}
inline
int ScrollInfo::minScrollx(void)const
{
return mMinScrollx;
}
inline
void ScrollInfo::minScrollx(int minScrollx)
{
mMinScrollx=minScrollx;
}
inline
int ScrollInfo::maxScrollx(void)const
{
return mMaxScrollx;
}
inline
void ScrollInfo::maxScrollx(int maxScrollx)
{
mMaxScrollx=maxScrollx;
}
inline
int ScrollInfo::currScrollx(void)const
{
return mCurrScrollx;
}
inline
void ScrollInfo::currScrollx(int currScrollx)
{
mCurrScrollx=currScrollx;
}
inline
int ScrollInfo::minScrolly(void)const
{
return mMinScrolly;
}
inline
void ScrollInfo::minScrolly(int minScrolly)
{
mMinScrolly=minScrolly;
}
inline
int ScrollInfo::maxScrolly(void)const
{
return mMaxScrolly;
}
inline
void ScrollInfo::maxScrolly(int maxScrolly)
{
mMaxScrolly=maxScrolly;
}
inline
int ScrollInfo::currScrolly(void)const
{
return mCurrScrolly;
}
inline
void ScrollInfo::currScrolly(int currScrolly)
{
mCurrScrolly=currScrolly;
}
inline
BOOL ScrollInfo::scrollEvent(void)const
{
return mScrollEvent;
}
inline
void ScrollInfo::scrollEvent(BOOL scrollEvent)
{
mScrollEvent=scrollEvent;
}
inline
BOOL ScrollInfo::sizeEvent(void)const
{
return mSizeEvent;
}
inline
void ScrollInfo::sizeEvent(BOOL sizeEvent)
{
mSizeEvent=sizeEvent;
}
inline
void ScrollInfo::scrollableObjectDimensions(int width,int height)
{
RECT clientRect;
scrollableObjectWidth(width);
scrollableObjectHeight(height);
sizeEvent(FALSE);
scrollEvent(FALSE);
::GetClientRect(hwndOwner(),&clientRect);
handleSize(CallbackData(0,MAKELPARAM(clientRect.right,clientRect.bottom)));
}
inline
int ScrollInfo::scrollableObjectWidth(void)const
{
return mScrollableObjectWidth;
}
inline
void ScrollInfo::scrollableObjectWidth(int scrollableObjectWidth)
{
mScrollableObjectWidth=scrollableObjectWidth;
}
inline
int ScrollInfo::scrollableObjectHeight(void)const
{
return mScrollableObjectHeight;
}
inline
void ScrollInfo::scrollableObjectHeight(int scrollableObjectHeight)
{
mScrollableObjectHeight=scrollableObjectHeight;
}
inline
HWND ScrollInfo::hwndOwner(void)const
{
return mhWndOwner;
}
inline
void ScrollInfo::hwndOwner(HWND hwndOwner)
{
mhWndOwner=hwndOwner;
}
inline
void ScrollInfo::handleHorizontalScroll(CallbackData &someCallbackData)
{
int xDelta;
int yDelta;
int xNew;
yDelta=0;
switch(LOWORD(someCallbackData.wParam()))
{
case SB_PAGEUP :
xNew=currScrollx()-PageIncrement;
break;
case SB_PAGEDOWN :
xNew=currScrollx()+PageIncrement;
break;
case SB_LINEUP :
xNew=currScrollx()-LineIncrement;
break;
case SB_LINEDOWN :
xNew=currScrollx()+LineIncrement;
break;
case SB_THUMBPOSITION :
xNew= HIWORD(someCallbackData.wParam());
break;
default :
xNew=currScrollx();
break;
}
xNew=imax(0,xNew);
xNew=imin(maxScrollx(),xNew);
if(xNew==currScrollx())return;
scrollEvent(TRUE);
xDelta=xNew-currScrollx();
currScrollx(xNew);
::ScrollWindow(hwndOwner(),-xDelta,-yDelta,(const RECT*)0,(const RECT*)0);
::UpdateWindow(hwndOwner());
::SetScrollPos(hwndOwner(),SB_HORZ,currScrollx(),TRUE);
}
inline
void ScrollInfo::handleVerticalScroll(CallbackData &someCallbackData)
{
int yDelta;
int yNew;
int xDelta;
xDelta=0;
switch(LOWORD(someCallbackData.wParam()))
{
case SB_PAGEUP :
yNew=currScrolly()-PageIncrement;
break;
case SB_PAGEDOWN :
yNew=currScrolly()+PageIncrement;
break;
case SB_LINEUP :
yNew=currScrolly()-LineIncrement;
break;
case SB_LINEDOWN :
yNew=currScrolly()+LineIncrement;
break;
case SB_THUMBPOSITION :
yNew=HIWORD(someCallbackData.wParam());
break;
default :
yNew=currScrolly();
break;
}
yNew=imax(0,yNew);
yNew=imin(maxScrolly(),yNew);
if(yNew==currScrolly())return;
scrollEvent(TRUE);
yDelta=yNew-currScrolly();
currScrolly(yNew);
::ScrollWindow(hwndOwner(),-xDelta,-yDelta,(const RECT*)0,(const RECT*)0);
::UpdateWindow(hwndOwner());
::SetScrollPos(hwndOwner(),SB_VERT,currScrolly(),TRUE);
}
inline
void ScrollInfo::handleSize(CallbackData &someCallbackData)
{
int xNew(someCallbackData.loWord());
int yNew(someCallbackData.hiWord());
sizeEvent(TRUE);
maxScrollx(imax(scrollableObjectWidth()-xNew,0));
::SetScrollRange(hwndOwner(),SB_HORZ,minScrollx(),maxScrollx(),FALSE);
currScrollx(imin(currScrollx(),maxScrollx()));
::SetScrollPos(hwndOwner(),SB_HORZ,currScrollx(),TRUE);
maxScrolly(imax(scrollableObjectHeight()-yNew,0));
::SetScrollRange(hwndOwner(),SB_VERT,minScrolly(),maxScrolly(),FALSE);
currScrolly(imin(currScrolly(),maxScrolly()));
::SetScrollPos(hwndOwner(),SB_VERT,currScrolly(),TRUE);
}
inline
int ScrollInfo::imax(int param1,int param2)
{
return param1>param2?param1:param2;
}
inline
int ScrollInfo::imin(int param1,int param2)
{
return param1<param2?param1:param2;
}
#endif

BIN
remotepsapp/STRIP.BMP Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@@ -0,0 +1,55 @@
#ifndef _REMOTEPSAPP_WINDOWVIEW_HPP_
#define _REMOTEPSAPP_WINDOWVIEW_HPP_
#ifndef _COMMON_GUIWINDOW_HPP_
#include <common/window.hpp>
#endif
#ifndef _COMMON_ELASTICCONTROL_HPP_
#include <common/elastic.hpp>
#endif
#ifndef _JPGIMG_JPGIMAGE_HPP_
#include <jpgimg/jpgimg.hpp>
#endif
#ifndef _JPGIMG_SCROLLINFO_HPP_
#include <jpgimg/scroll.hpp>
#endif
class WindowView : public ElasticControl
{
public:
WindowView(void);
virtual ~WindowView();
bool create(GUIWindow &parentWindow,GUIWindow &conformParent,const Rect &winRect,UINT controlID);
bool createImage(const String &strPathFileName);
private:
WindowView(const WindowView &someWindowView);
WindowView &operator=(const WindowView &someWindowView);
CallbackData::ReturnType createHandler(CallbackData &someCallbackData);
CallbackData::ReturnType destroyHandler(CallbackData &someCallbackData);
CallbackData::ReturnType closeHandler(CallbackData &someCallbackData);
CallbackData::ReturnType paintHandler(CallbackData &someCallbackData);
CallbackData::ReturnType sizeHandler(CallbackData &someCallbackData);
CallbackData::ReturnType verticalScrollHandler(CallbackData &someCallbackData);
CallbackData::ReturnType horizontalScrollHandler(CallbackData &someCallbackData);
CallbackData::ReturnType eraseBackgroundHandler(CallbackData &someCallbackData);
void registerClass(void);
static const char *className(void);
Callback<WindowView> mCreateHandler;
Callback<WindowView> mDestroyHandler;
Callback<WindowView> mCloseHandler;
Callback<WindowView> mPaintHandler;
Callback<WindowView> mSizeHandler;
Callback<WindowView> mVerticalScrollHandler;
Callback<WindowView> mHorizontalScrollHandler;
Callback<WindowView> mEraseBackgroundHandler;
ScrollInfo mScrollInfo;
JPGImage mJPGImage;
static char mszClassName[];
};
inline
const char *WindowView::className(void)
{
return mszClassName;
}
#endif

242
remotepsapp/asmutil.asm Normal file
View File

@@ -0,0 +1,242 @@
INCLUDE ..\COMMON\COMMON.INC
INCLUDE ..\COMMON\MATH.INC
INCLUDE ..\NNTP\ASMUTIL.INC
SMART
LOCALS
.386
.MODEL FLAT
.DATA
sOutColIterator DD ?
JumpTable:
TrailZero DD Trail0
TrailOne DD Trail1
TrailTwo DD Trail2
TrailThree DD Trail3
SIZE_RGB888 EQU 3
.CODE
_resampleClipRow proc near ; short resampleClip(char *lpIn,char *lpOut,DWORD inLen,DWORD outLen)
LOCAL sampleFactor:DWORD,runningFactor:DWORD=LocalLength
push ebp ; save stack frame
mov ebp,esp ; create new stack frame
sub esp,LocalLength ; adjust stack for local
push esi ; save source index register
push edi ; save destination
push ebx ; save ebx register
mov eax,[ebp+10h] ; move inLen to eax register
cmp eax,0000h ; compare inLen to zero
jle @@errorExit ; if it's less or equal then exit
mov ebx,[ebp+14h] ; move outLen to ebx register
cmp ebx,0000h ; compare outLen to zero
jle @@errorExit ; if it's less or equal then exit
dec eax ; decrement inLen
shl eax,10h ; multiply inLen by 65536L
divide eax,ebx ; divide ((inLen-1L)*65536L)/outLen
mov sampleFactor,eax ; store the factor
dec ebx ; ebx has (outLen-1)
mov ecx,ebx ; copy (outLen-1) to ecx
mov edi,[ebp+0Ch] ; move lpOut to destination index register
mov eax,size RGB888 ; move sizeof(RGB888) to eax register
multiply eax,ecx ; multiply (outLen-1)*sizeof(RGB888)
add edi,eax ; edi=lpOut+(outLen-1L)
mov esi,[ebp+08h] ; move lpIn to source index register
multiply ecx,sampleFactor ; multiply (outLen-1)*sampleFactor
mov runningFactor,eax ; save this into runningFactor
@@loopControl: ; loop control sync address
cmp ecx,0000h ; make sure we're within boundary
jl @@exit ; if not then we exit
mov eax,runningFactor ; move last running factor into eax
round ; round it off
mov ebx,size RGB888 ; get size of RGB888 to ebx register
multiply eax,ebx ; multiply running factor by sizeof(RGB888)
mov dl,byte ptr[esi+eax] ; copy blue into dl
mov byte ptr[edi],dl ; copy blue into target
mov dl,byte ptr[esi+eax+1] ; copy green into dl
mov byte ptr[edi+1],dl ; copy green into target
mov dl,byte ptr[esi+eax+2] ; copy red into dl
mov byte ptr[edi+2],dl ; copy red into target
mov eax,sampleFactor ; move sampleFactor into eax register
sub runningFactor,eax ; subtract from running factor
dec ecx ; decrement counter
sub edi,size RGB888 ; advance (backwards) along lpOut array
jmp @@loopControl ; continue processing
@@errorExit: ; error exit return sync address
xor ax,ax ; clear ax register on error
jmp @@endProcedure ; jump to end procedure
@@exit: ; exit sync address
mov ax,01h ; set ax register on success
@@endProcedure: ; end procedure sync address
pop ebx ; restore ebx register
pop edi ; restore destination index register
pop esi ; restore source index register
add esp,LocalLength ; remove locals off stack
pop ebp ; restore previous stack frame
retn ; return near to caller
_resampleClipRow endp
_resampleClipCol proc near ; short resampleClip(char *lpIn,char *lpOut,DWORD inLen,DWORD inWidth,DWORD outLen,DWORD outWidth)
LOCAL sampleFactor:DWORD,runningFactor:DWORD=LocalLength
push ebp ; save stack frame
mov ebp,esp ; create new stack frame
sub esp,LocalLength ; adjust stack for local
push esi ; save source index register
push edi ; save destination
push ebx ; save ebx register
mov edx,[ebp+1Ch] ; move outWidth to edx register
mov eax,size RGB888 ; move sizeof(RGB888) to eax register
multiply eax,edx ; eax=outWidth*sizeof(RGB888)
mov sOutColIterator,eax ; save column iterator
mov eax,[ebp+10h] ; move inLen to eax register
cmp eax,0000h ; compare inLen to zero
jle @@errorExit ; if it's less or equal then exit
mov ebx,[ebp+18h] ; move outLen to ebx register
cmp ebx,0000h ; compare outLen to zero
jle @@errorExit ; if it's less or equal then exit
dec eax ; decrement inLen
shl eax,10h ; multiply inLen by 65536L
divide eax,ebx ; divide ((inLen-1L)*65536L)/outLen
mov sampleFactor,eax ; store the factor
dec ebx ; ebx has (outLen-1)
mov ecx,ebx ; copy (outLen-1) to ecx
mov edi,[ebp+0Ch] ; move lpOut to destination index register
mov eax,[ebp+1Ch] ; move outWidth to eax register
multiply eax,ecx ; multiply (outLen-1)*width
mov edx,size RGB888 ; move sizeof(RGB888) to edx
multiply eax,edx ; eax has ((outLen-1)*outWidth)*sizeof(RGB888)
add edi,eax ; edi=lpOut+((outLen-1)*outWidth)*sizeof(RGB888), points to end of array
mov esi,[ebp+08h] ; move lpIn to source index register
multiply ecx,sampleFactor ; multiply (outLen-1)*sampleFactor
mov runningFactor,eax ; save this into runningFactor
@@loopControl: ; loop control sync address
cmp ecx,0000h ; make sure we're within boundary
jl @@exit ; if not then we exit
mov eax,runningFactor ; move last running factor into eax
round ; round it off
mov edx,[ebp+14h] ; move inWidth to edx register
multiply eax,edx ; eax=inWidth*runningFactor
mov edx,size RGB888 ; move sizeof(RGB888) to edx register
multiply eax,edx ; eax=(inWidth*runningFactor)*sizeof(RGB888)
mov dl,byte ptr[esi+eax] ; copy blue into dl
mov byte ptr[edi],dl ; copy blue into target
mov dl,byte ptr[esi+eax+1] ; copy green into dl
mov byte ptr[edi+1],dl ; copy green into target
mov dl,byte ptr[esi+eax+2] ; copy red into dl
mov byte ptr[edi+2],dl ; copy red into target
mov eax,sampleFactor ; move sampleFactor into eax register
sub runningFactor,eax ; subtract from running factor
dec ecx ; decrement counter
sub edi,sOutColIterator ; advance backwards along lpOutArray
jmp @@loopControl ; continue processing
@@errorExit: ; error exit return sync address
xor ax,ax ; clear ax register on error
jmp @@endProcedure ; jump to end procedure
@@exit: ; exit sync address
mov ax,01h ; set ax register on success
@@endProcedure: ; end procedure sync address
pop ebx ; restore ebx register
pop edi ; restore destination index register
pop esi ; restore source index register
add esp,LocalLength ; remove locals off stack
pop ebp ; restore previous stack frame
retn ; return near to caller
_resampleClipCol endp
copy MACRO
mov ecx,[ebx].ImageInfo@@mSrcWidthFactor ; move count of bytes into ecx register
mov edx,ecx ; move count of bytes into edx register
shr ecx,0002h ; divide count of bytes by sizeof(dword)
and edx,00003h ; get remainder into edx register
repnz movsd ; copy the column (esi->edi)
jmp dword ptr[edx*4+JumpTable] ; finish off the remaining bytes
Trail0: ; zero trailing bytes sync address
jmp @@endCopy ; we're all done
Trail1: ; 1 trailing byte sync address
mov al,byte ptr[esi] ; move source byte into al register
mov byte ptr [edi],al ; ... and copy it over to destination
inc esi ; increment source index
inc edi ; increment destination
jmp @@endCopy ; we're all done
Trail2: ; 2 trailing bytes sync address
mov ax,word ptr[esi] ; move a word value from source
mov word ptr[edi],ax ; move word value into destination
add esi,2 ; increment source index
add edi,2 ; increment destination index
jmp @@endCopy ; we're all done here
Trail3: ; 3 trailing bytes sync address
mov ax,word ptr[esi] ; move a word value from source
mov word ptr[edi],ax ; copy word value to destination
mov al,byte ptr[edi+2] ; move next byte to al
mov byte ptr[edi+2],al ; copy to destination
add esi,3 ; increment source index register
add edi,3 ; increment destination index register
@@endCopy: ; we're all done here
ENDM
_setAt proc near ; int setAt(ImageInfo *pImageInfo,DWORD row,DWORD col)
push ebp ; save previous stack frame
mov ebp,esp ; create new frame
push esi ; save source index register
push edi ; save destination index register
push ebx ; save ebx register
mov ebx,[ebp+08h] ; move (ImageInfo*) to ebx register
cld ; clear the direction flag
mov eax,[ebx].ImageInfo@@mSrcWidth ; move source image width into eax register
multiply eax,SIZE_RGB888 ; multiply width by sizeof(RGB888)
mov [ebx].ImageInfo@@mSrcWidthFactor,eax ; replace factor into structure
mov eax,[ebx].ImageInfo@@mDstWidth ; move destination image width into eax register
multiply eax,SIZE_RGB888 ; multiply width by sizeof(RGB888)
mov [ebx].ImageInfo@@mDstWidthFactor,eax ; replace factor into structure
mov esi,[ebx].ImageInfo@@mSrcRGB888 ; move source RGB888* to source index
multiply [ebx].ImageInfo@@mDstRow,[ebx].ImageInfo@@mDstWidth ; multiply source width by source row->eax
add eax,[ebx].ImageInfo@@mDstCol ; add in the destination column
multiply eax,SIZE_RGB888 ; multiply result by sizeof(RGB888)
mov edi,[ebx].ImageInfo@@mDstRGB888 ; move RGB888* to esi
add edi,eax ; add in the offset, result to esi
@@rowLoop: ; row loop sync address
copy ; copy the column
mov eax,[ebx].ImageInfo@@mDstWidthFactor ; move destination width factor to eax
sub eax,[ebx].ImageInfo@@mSrcWidthFactor ; get difference between source and destination
add edi,eax ; add to destination so it sits at next row
inc [ebx].ImageInfo@@mSrcRow ; increment source row
mov eax,[ebx].ImageInfo@@mSrcRow ; replace row counter
cmp eax,[ebx].ImageInfo@@mSrcHeight ; cmp row to image height
jl @@rowLoop ; if less then keep going
@@imageDone: ; done processing sync address
pop ebx ; restore ebx register
pop edi ; restore destination index register
pop esi ; restore source index register
pop ebp ; restore previous stack frame
retn ; return near to caller
_setAt endp
_copyBGRRGB proc near ; void copyBGRRGB(RGB *pRGB,BGR *pBGR,int count,int output_components)
push ebp ; save frame
mov ebp,esp ; create new frame
push ebx ; save ebx register
push ecx ; save ecx register
push esi ; save source index register
push edi ; save destination index register
mov ebx,[ebp+14h] ; move output_components to ebx register
mov ecx,[ebp+10h] ; move item count to ecx, one item is a single XXX component
mov edi,[ebp+08h] ; move pRGB to edi register
mov esi,[ebp+0Ch] ; move pBGR to esi register
add esi,ebx ; add (output_components) to esi
dec esi ; subtract one to get index
@@copyLoop: ; copyLoop sync address
mov ax,word ptr[esi-1] ; get a word value from source into ax register
rol ax,08h ; swap the bytes in this word
mov word ptr[edi],ax ; write the word value out to destination
mov al,byte ptr[esi-2] ; move source blue component into al
mov byte ptr[edi+2],al ; move blue component into destination blue
add esi,ebx ; add output_components to esi
add edi,SIZE_RGB888 ; increment destination index to next component
loopnz @@copyLoop ; continue through count items
pop edi ; restore destination index register
pop esi ; restore source index register
pop ecx ; restore ecx register
pop ebx ; restore ebx register
pop ebp ; restore previous frame
retn ; return near to caller
_copyBGRRGB endp
public _resampleClipRow
public _resampleClipCol
public _copyBGRRGB
public _setAt
END

View File

@@ -0,0 +1,89 @@
#include <remotepsapp/connectiondialog.hpp>
#include <remotepsapp/remoteps.hpp>
#include <remotepsapp/optnsreg.hpp>
ConnectionDialog::ConnectionDialog(void)
{
mInitHandler.setCallback(this,&ConnectionDialog::initHandler);
mDestroyHandler.setCallback(this,&ConnectionDialog::destroyHandler);
mCommandHandler.setCallback(this,&ConnectionDialog::commandHandler);
mCloseHandler.setCallback(this,&ConnectionDialog::closeHandler);
mDlgCodeHandler.setCallback(this,&ConnectionDialog::dlgCodeHandler);
DWindow::insertHandler(VectorHandler::InitDialogHandler,&mInitHandler);
DWindow::insertHandler(VectorHandler::DestroyHandler,&mDestroyHandler);
DWindow::insertHandler(VectorHandler::CommandHandler,&mCommandHandler);
DWindow::insertHandler(VectorHandler::CloseHandler,&mCloseHandler);
DWindow::insertHandler(VectorHandler::DialogCodeHandler,&mDlgCodeHandler);
}
ConnectionDialog::~ConnectionDialog()
{
DWindow::removeHandler(VectorHandler::InitDialogHandler,&mInitHandler);
DWindow::removeHandler(VectorHandler::DestroyHandler,&mDestroyHandler);
DWindow::removeHandler(VectorHandler::CommandHandler,&mCommandHandler);
DWindow::removeHandler(VectorHandler::CloseHandler,&mCloseHandler);
DWindow::removeHandler(VectorHandler::DialogCodeHandler,&mDlgCodeHandler);
}
ConnectionDialog &ConnectionDialog::operator=(const ConnectionDialog &/*someConnectionDialog*/)
{ // private implementation
return *this;
}
bool ConnectionDialog::perform(GUIWindow &parentWindow,String &strComputerName)
{
if(!::DialogBoxParam(processInstance(),(LPSTR)"CONNECT",(HWND)parentWindow,DWindow::DlgProc,(LPARAM)(DWindow*)this))return false;
strComputerName=mStrComputerName;
return true;
}
CallbackData::ReturnType ConnectionDialog::initHandler(CallbackData &/*someCallbackData*/)
{
OptionsReg optionsReg;
Block<String> strConnectionNames;
mComputerNameCombo.assumeControl(getItem(CONNECT_COMPUTERNAME),CONNECT_COMPUTERNAME,false);
optionsReg.getConnections(strConnectionNames);
for(int index=0;index<strConnectionNames.size();index++)mComputerNameCombo.sendMessage(CB_INSERTSTRING,-1,(LPARAM)(LPSTR)strConnectionNames[index]);
mComputerNameCombo.sendMessage(CB_SETCURSEL,0,0L);
return (CallbackData::ReturnType)FALSE;
}
CallbackData::ReturnType ConnectionDialog::destroyHandler(CallbackData &/*someCallbackData*/)
{
return (CallbackData::ReturnType)FALSE;
}
CallbackData::ReturnType ConnectionDialog::dlgCodeHandler(CallbackData &/*someCallbackData*/)
{
return (CallbackData::ReturnType)DLGC_WANTARROWS|DLGC_WANTCHARS;
}
CallbackData::ReturnType ConnectionDialog::commandHandler(CallbackData &someCallbackData)
{
switch(someCallbackData.wmCommandID())
{
case IDOK :
handleOk();
break;
case IDCANCEL :
endDialog(FALSE);
break;
}
return (CallbackData::ReturnType)FALSE;
}
CallbackData::ReturnType ConnectionDialog::closeHandler(CallbackData &/*someCallbackData*/)
{
return (CallbackData::ReturnType)FALSE;
}
void ConnectionDialog::handleOk(void)
{
OptionsReg optionsReg;
getText(CONNECT_COMPUTERNAME,mStrComputerName);
if(mStrComputerName.isNull()){endDialog(false);return;}
optionsReg.insertConnection(mStrComputerName);
endDialog(true);
}

View File

@@ -0,0 +1,46 @@
#ifndef _REMOTEPSAPP_CONNECTIONDIALOG_HPP_
#define _REMOTEPSAPP_CONNECTIONDIALOG_HPP_
#ifndef _COMMON_WINDOWS_HPP_
#include <common/windows.hpp>
#endif
#ifndef _COMMON_DWINDOW_HPP_
#include <common/dwindow.hpp>
#endif
#ifndef _COMMON_CONTROL_HPP_
#include <common/control.hpp>
#endif
#ifndef _COMMON_STRING_HPP_
#include <common/string.hpp>
#endif
class ConnectionDialog : public DWindow
{
public:
ConnectionDialog(void);
virtual ~ConnectionDialog();
bool perform(GUIWindow &parentWindow,String &strComputerName);
private:
ConnectionDialog(const ConnectionDialog &someConnectionDialog);
ConnectionDialog &operator=(const ConnectionDialog &someConnectionDialog);
CallbackData::ReturnType initHandler(CallbackData &someCallbackData);
CallbackData::ReturnType destroyHandler(CallbackData &someCallbackData);
CallbackData::ReturnType commandHandler(CallbackData &someCallbackData);
CallbackData::ReturnType closeHandler(CallbackData &someCallbackData);
CallbackData::ReturnType dlgCodeHandler(CallbackData &someCallbackData);
void ConnectionDialog::handleOk(void);
Callback<ConnectionDialog> mInitHandler;
Callback<ConnectionDialog> mDestroyHandler;
Callback<ConnectionDialog> mCommandHandler;
Callback<ConnectionDialog> mCloseHandler;
Callback<ConnectionDialog> mDlgCodeHandler;
String mStrComputerName;
Control mComputerNameCombo;
};
inline
ConnectionDialog::ConnectionDialog(const ConnectionDialog &/*someConnectionDialog*/)
{
}
#endif

58
remotepsapp/group.hpp Normal file
View File

@@ -0,0 +1,58 @@
#ifndef _REMOTEPSAPP_GROUP_HPP_
#define _REMOTEPSAPP_GROUP_HPP_
#ifndef _COMMON_STRING_HPP_
#include <common/string.hpp>
#endif
#ifndef _COMMON_BLOCK_HPP_
#include <common/block.hpp>
#endif
class Group : public Block<String>
{
public:
Group(void);
Group(const Group &someGroup);
virtual ~Group();
Group &operator=(const Group &someGroup);
const String &groupName(void)const;
void groupName(const String &strGroupName);
private:
String mStrGroupName;
};
inline
Group::Group(void)
{
}
inline
Group::Group(const Group &someGroup)
{
*this=someGroup;
}
inline
Group::~Group()
{
}
inline
Group &Group::operator=(const Group &someGroup)
{
groupName(someGroup.groupName());
(Block<String> &)*this=(Block<String>&)someGroup;
return *this;
}
inline
const String &Group::groupName(void)const
{
return mStrGroupName;
}
inline
void Group::groupName(const String &strGroupName)
{
mStrGroupName=strGroupName;
}
#endif

BIN
remotepsapp/image000.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 469 KiB

BIN
remotepsapp/image000.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

10
remotepsapp/main.cpp Normal file
View File

@@ -0,0 +1,10 @@
#include <remotepsapp/mainfrm.hpp>
#include <remotepsapp/remoteps.hpp>
int PASCAL WinMain(HINSTANCE /*hInstance*/,HINSTANCE /*hPrevInstance*/,LPSTR /*lpszCmdLine*/,int /*nCmdShow*/)
{
MainFrame frameWindow;
frameWindow.splash();
frameWindow.createWindow("REMOTE-PS",String(STRING_REMOTEPS)+String(" ")+String(STRING_VERSION),"mainMenu","psicon");
return frameWindow.messageLoop();
}

51
remotepsapp/mainfrm.hpp Normal file
View File

@@ -0,0 +1,51 @@
#ifndef _REMOTEPSAPP_MAINFRAME_HPP_
#define _REMOTEPSAPP_MAINFRAME_HPP_
#ifndef _COMMON_MDIFRM_HPP_
#include <common/mdifrm.hpp>
#endif
#ifndef _COMMON_SMARTPOINTER_HPP_
#include <common/pointer.hpp>
#endif
class StatusBarEx;
class MainFrame : public FrameWindow
{
public:
MainFrame(void);
virtual ~MainFrame();
void splash(void);
protected:
virtual void mdiDestroy(MDIWindow &mdiWindow);
virtual void mdiActivate(MDIWindow &mdiWindow);
virtual void mdiDeactivate(MDIWindow &mdiWindow);
private:
enum {StatusControlID=200,StartDynamicID=30000,FirstPartWidth=300,SecondPartWidth=390,SinglePart=1,DoublePart=2};
CallbackData::ReturnType queryEndSessionHandler(CallbackData &someCallbackData);
CallbackData::ReturnType closeHandler(CallbackData &someCallbackData);
CallbackData::ReturnType sizeHandler(CallbackData &someCallbackData);
CallbackData::ReturnType createHandler(CallbackData &someCallbackData);
CallbackData::ReturnType commandHandler(CallbackData &someCallbackData);
CallbackData::ReturnType destroyHandler(CallbackData &someCallbackData);
void handleFileOpenSingleConnection(void);
void handleFileSelectGroup(void);
void setCaption(String strText=String());
void setParts(int numParts);
void setText(const String &strText);
void handleFileOpen(void);
void handleFileClose(void);
void handleFileSave(void);
void handleFileSaveAs(void);
void handleFilePrint(void);
void handleFileQuit(void);
Callback<MainFrame> mQueryEndSessionHandler;
Callback<MainFrame> mCloseHandler;
Callback<MainFrame> mSizeHandler;
Callback<MainFrame> mCommandHandler;
Callback<MainFrame> mCreateHandler;
Callback<MainFrame> mDestroyHandler;
SmartPointer<StatusBarEx> mStatusControl;
};
#endif

View File

@@ -0,0 +1,70 @@
#include <remotepsapp/processview.hpp>
#include <statbar/statbarx.hpp>
#include <common/windows.hpp>
#include <common/mdifrm.hpp>
#include <imagelst/ftree.hpp>
#include <com/cominit.hpp>
ProcessView::ProcessView(void)
{
mCreateHandler.setCallback(this,&ProcessView::createHandler);
mSizeHandler.setCallback(this,&ProcessView::sizeHandler);
insertHandler(VectorHandler::CreateHandler,&mCreateHandler);
insertHandler(VectorHandler::SizeHandler,&mSizeHandler);
}
ProcessView::~ProcessView()
{
removeHandler(VectorHandler::CreateHandler,&mCreateHandler);
removeHandler(VectorHandler::SizeHandler,&mSizeHandler);
}
void ProcessView::connect(const String &serverName)
{
setCaption(serverName);
mViewDialog.handleConnect(serverName);
}
CallbackData::ReturnType ProcessView::createHandler(CallbackData &someCallbackData)
{
Rect winRect;
Rect statRect;
clientRect(winRect);
mStatusBar=::new StatusBarEx(*this,StatusBarID);
mStatusBar.disposition(PointerDisposition::Delete);
mStatusBar->clientRect(statRect);
mViewDialog.perform(*this,mStatusBar);
// moveWindow(0,0,mViewDialog.width(),mViewDialog.height());
return FALSE;
}
CallbackData::ReturnType ProcessView::sizeHandler(CallbackData &someCallbackData)
{
Rect winRect;
Rect statRect;
// setWindowPos(InitialWidth,InitialHeight);
clientRect(winRect);
mStatusBar->clientRect(statRect);
mViewDialog.setWindowPos(width(),height()-mStatusBar->height());
return FALSE;
}
void ProcessView::setCaption(String strText)
{
MDIWindow::setCaption(String("\\")+strText);
}
// *** virtuals
void ProcessView::preRegister(WNDCLASS &wndClass)
{
wndClass.hbrBackground=(HBRUSH)COLOR_APPWORKSPACE;
}
void ProcessView::preCreate(MDICREATESTRUCT &createStruct)
{
// createStruct.cx=InitialWidth;
// createStruct.cy=InitialHeight;
}

View File

@@ -0,0 +1,37 @@
#ifndef _REMOTEPSAPP_PROCESSVIEW_HPP_
#define _REMOTEPSAPP_PROCESSVIEW_HPP_
#ifndef _COMMON_MDIWIN_HPP_
#include <common/mdiwin.hpp>
#endif
#ifndef _COMMON_SMARTPOINTER_HPP_
#include <common/pointer.hpp>
#endif
#ifndef _REMOTEPSAPP_VIEWDIALOG_HPP_
#include <remotepsapp/viewdialog.hpp>
#endif
class StatusBarEx;
class IRemoteProcess;
class ProcessView : public MDIWindow
{
public:
ProcessView(void);
virtual ~ProcessView();
void connect(const String &serverName);
protected:
virtual void preRegister(WNDCLASS &wndClass);
virtual void preCreate(MDICREATESTRUCT &createStruct);
private:
enum {StatusBarID=101,InitialWidth=640,InitialHeight=540};
CallbackData::ReturnType createHandler(CallbackData &someCallbackData);
CallbackData::ReturnType sizeHandler(CallbackData &someCallbackData);
void setCaption(String strText);
void handleConnect(String *pServerName);
Callback<ProcessView> mCreateHandler;
Callback<ProcessView> mSizeHandler;
SmartPointer<StatusBarEx> mStatusBar;
ViewDialog mViewDialog;
};
#endif

BIN
remotepsapp/psicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

151
remotepsapp/pureimg.cpp Normal file
View File

@@ -0,0 +1,151 @@
#include <remotepsapp/pureimg.hpp>
#include <remotepsapp/rgb888.hpp>
#include <common/purehdc.hpp>
#include <remotepsapp/asmutil.hpp>
bool PureImage::draw(PureDevice &pureDevice)
{
PureDevice compatibleDevice;
if(!isOkay())return FALSE;
compatibleDevice.compatibleDevice(pureDevice);
compatibleDevice.select((GDIObj)mhBitmap,TRUE);
pureDevice.bitBlt(Rect(0,0,width(),height()),compatibleDevice,Point(0,0));
compatibleDevice.select((GDIObj)mhBitmap,FALSE);
return TRUE;
}
bool PureImage::draw(PureDevice &pureDevice,int xSrc,int ySrc)
{
PureDevice compatibleDevice;
if(!isOkay())return FALSE;
compatibleDevice.compatibleDevice(pureDevice);
compatibleDevice.select((GDIObj)mhBitmap,TRUE);
pureDevice.bitBlt(Rect(xSrc,ySrc,width(),height()),compatibleDevice,Point(0,0));
compatibleDevice.select((GDIObj)mhBitmap,FALSE);
return TRUE;
}
bool PureImage::draw(PureDevice &pureDevice,const Rect &dstRect,const Point &srcPoint)
{
PureDevice compatibleDevice;
if(!isOkay())return FALSE;
compatibleDevice.compatibleDevice(pureDevice);
compatibleDevice.select((GDIObj)mhBitmap,TRUE);
pureDevice.bitBlt(dstRect,compatibleDevice,srcPoint);
compatibleDevice.select((GDIObj)mhBitmap,FALSE);
return TRUE;
}
bool PureImage::stretch(PureDevice &pureDevice,const Point &xyPoint,int strwidth,int strheight)
{
PureDevice compatibleDevice;
if(!isOkay())return FALSE;
compatibleDevice.compatibleDevice(pureDevice);
compatibleDevice.select((GDIObj)mhBitmap,TRUE);
pureDevice.stretchBlt(Rect(xyPoint.x(),xyPoint.y(),strwidth,strheight),compatibleDevice,Rect(0,0,width(),height()));
compatibleDevice.select((GDIObj)mhBitmap,FALSE);
return FALSE;
}
bool PureImage::resample(PureDevice &pureDevice,int newWidth)
{
Array<RGB888> rgbArray;
Array<RGB888> tmpArray;
BitmapInfo bitmapInfo;
float heightFactor;
float aspectRatio;
int newHeight;
newWidth-=(newWidth%4); // align the width on DWORD boundary
if(!isOkay())return false;
aspectRatio=(float)width()/(float)height();
newHeight=(float)newWidth/aspectRatio;
heightFactor=(float)newHeight/height();
bitmapInfo.rgbColors(0);
bitmapInfo.bitCount(BitmapInfo::Bit24);
bitmapInfo.width(newWidth);
bitmapInfo.height(int((float)getBitmapInfo().height()*heightFactor));
bitmapInfo.planes(1);
bitmapInfo.compression(BI_RGB);
bitmapInfo.sizeImage(0);
bitmapInfo.colorUsed(0);
bitmapInfo.colorImportant(0);
tmpArray.size(bitmapInfo.width()*height());
for(int row=0;row<height();row++)::resampleClipRow(&getRGBArray()[(row*width())],&tmpArray[(row*newWidth)],width(),newWidth);
rgbArray.size(bitmapInfo.width()*(bitmapInfo.height()<0?-bitmapInfo.height():bitmapInfo.height()));
for(int col=0;col<bitmapInfo.width();col++)::resampleClipCol(&tmpArray[col],&rgbArray[col],height(),bitmapInfo.width(),bitmapInfo.height()<0?-bitmapInfo.height():bitmapInfo.height(),bitmapInfo.width());
destroy();
getBitmapInfo()=bitmapInfo;
getRGBArray()=rgbArray;
mhBitmap=::CreateDIBitmap((HDC)pureDevice,(BITMAPINFOHEADER*)getBitmapInfo(),CBM_INIT,&getRGBArray()[0],(BITMAPINFO*)getBitmapInfo(),DIB_RGB_COLORS);
return true;
}
bool PureImage::resample(PureDevice &pureDevice,int newWidth,int newHeight)
{
Array<RGB888> rgbArray;
Array<RGB888> tmpArray;
BitmapInfo bitmapInfo;
if(!isOkay())return false;
bitmapInfo.rgbColors(0);
bitmapInfo.bitCount(BitmapInfo::Bit24);
bitmapInfo.width(newWidth);
bitmapInfo.height(-newHeight);
bitmapInfo.planes(1);
bitmapInfo.compression(BI_RGB);
bitmapInfo.sizeImage(0);
bitmapInfo.colorUsed(0);
bitmapInfo.colorImportant(0);
bitmapInfo.verifyDimensions();
tmpArray.size(bitmapInfo.width()*(height()<0?-height():height()));
for(int row=0;row<height();row++)::resampleClipRow(&getRGBArray()[(row*width())],&tmpArray[(row*newWidth)],width()+1,newWidth);
rgbArray.size(bitmapInfo.width()*(bitmapInfo.height()<0?-bitmapInfo.height():bitmapInfo.height()));
for(int col=0;col<bitmapInfo.width();col++)::resampleClipCol(&tmpArray[col],&rgbArray[col],height(),bitmapInfo.width(),bitmapInfo.height()<0?-bitmapInfo.height():bitmapInfo.height(),bitmapInfo.width());
destroy();
getBitmapInfo()=bitmapInfo;
getRGBArray()=rgbArray;
mhBitmap=::CreateDIBitmap((HDC)pureDevice,(BITMAPINFOHEADER*)getBitmapInfo(),CBM_INIT,&getRGBArray()[0],(BITMAPINFO*)getBitmapInfo(),DIB_RGB_COLORS);
return true;
}
bool PureImage::resample(int newWidth,int newHeight)
{
Array<RGB888> rgbArray;
Array<RGB888> tmpArray;
BitmapInfo bitmapInfo;
if(!getRGBArray().size())return false;
bitmapInfo.rgbColors(0);
bitmapInfo.bitCount(BitmapInfo::Bit24);
bitmapInfo.width(newWidth);
bitmapInfo.height(-newHeight);
bitmapInfo.planes(1);
bitmapInfo.compression(BI_RGB);
bitmapInfo.sizeImage(0);
bitmapInfo.colorUsed(0);
bitmapInfo.colorImportant(0);
bitmapInfo.verifyDimensions();
tmpArray.size(bitmapInfo.width()*(height()<0?-height():height()));
for(int row=0;row<height();row++)::resampleClipRow(&getRGBArray()[(row*width())],&tmpArray[(row*newWidth)],width()+1,newWidth);
rgbArray.size(bitmapInfo.width()*(bitmapInfo.height()<0?-bitmapInfo.height():bitmapInfo.height()));
for(int col=0;col<bitmapInfo.width();col++)::resampleClipCol(&tmpArray[col],&rgbArray[col],height(),bitmapInfo.width(),bitmapInfo.height()<0?-bitmapInfo.height():bitmapInfo.height(),bitmapInfo.width());
destroy();
getBitmapInfo()=bitmapInfo;
getRGBArray()=rgbArray;
return true;
}
bool PureImage::getRawData(GlobalData<BYTE> &rawData)
{
return RawImage::getRawData(rawData);
}
bool PureImage::setRawData(GlobalData<BYTE> &rawData,PureDevice &pureDevice)
{
destroy();
if(!RawImage::setRawData(rawData))return false;
mhBitmap=::CreateDIBitmap((HDC)pureDevice,(BITMAPINFOHEADER*)getBitmapInfo(),CBM_INIT,&getRGBArray()[0],(BITMAPINFO*)getBitmapInfo(),DIB_RGB_COLORS);
return true;
}

121
remotepsapp/pureimg.hpp Normal file
View File

@@ -0,0 +1,121 @@
#ifndef _REMOTEPSAPP_JPGIMAGE_HPP_
#define _REMOTEPSAPP_JPGIMAGE_HPP_
#ifndef _COMMON_WINDOWS_HPP_
#include <common/windows.hpp>
#endif
#ifndef _COMMON_DIBITMAP_HPP_
#include <common/dib.hpp>
#endif
#ifndef _COMMON_BITMAPINFO_HPP_
#include <common/bminfo.hpp>
#endif
#ifndef _REMOTEPSAPP_RGB888_HPP_
#include <remotepsapp/rgb888.hpp>
#endif
#ifndef _REMOTEPSAPP_RAWIMAGE_HPP_
#include <remotepsapp/rawimg.hpp>
#endif
class String;
class PureDevice;
class RGB888;
class PureImage : public RawImage
{
public:
PureImage(void);
virtual ~PureImage();
bool draw(PureDevice &pureDevice);
bool draw(PureDevice &pureDevice,int xSrc,int ySrc);
bool draw(PureDevice &pureDevice,const Rect &dstRect,const Point &srcPoint);
bool stretch(PureDevice &pureDevice,const Point &xyPoint,int strwidth,int strheight);
bool resample(PureDevice &pureDevice,int width);
bool resample(PureDevice &pureDevice,int newWidth,int newHeight);
bool resample(int newWidth,int newHeight);
DWORD memoryUsage(void)const;
bool isOkay(void)const;
int width(void)const;
int height(void)const;
bool getRawData(GlobalData<BYTE> &rawData);
bool setRawData(GlobalData<BYTE> &rawData,PureDevice &pureDevice);
bool setRawData(GlobalData<BYTE> &rawData);
bool getAt(DWORD row,DWORD col,RGB888 &rgb888)const;
private:
PureImage(const PureImage &somePureImage);
PureImage &operator=(const PureImage &somePureImage);
void destroy(void);
HBITMAP mhBitmap;
};
inline
PureImage::PureImage(void)
: mhBitmap(0)
{
}
inline
PureImage::PureImage(const PureImage &somePureImage)
: mhBitmap(0)
{ // private implementation
*this=somePureImage;
}
inline
PureImage &PureImage::operator=(const PureImage &somePureImage)
{ // private implementation
return *this;
}
inline
PureImage::~PureImage()
{
destroy();
}
inline
int PureImage::width(void)const
{
return getBitmapInfo().width();
}
inline
int PureImage::height(void)const
{
if(getBitmapInfo().height()<0)return -getBitmapInfo().height();
return getBitmapInfo().height();
}
inline
bool PureImage::getAt(DWORD row,DWORD col,RGB888 &rgb888)const
{
return RawImage::getAt(row,col,rgb888);
}
inline
bool PureImage::isOkay(void)const
{
return mhBitmap?TRUE:FALSE;
}
inline
void PureImage::destroy(void)
{
if(!mhBitmap)return;
::DeleteObject(mhBitmap);
mhBitmap=0;
}
inline
DWORD PureImage::memoryUsage(void)const
{
return RawImage::memoryUsage();
}
inline
bool PureImage::setRawData(GlobalData<BYTE> &rawData)
{
destroy();
return RawImage::setRawData(rawData);
}
#endif

66
remotepsapp/rawimg.cpp Normal file
View File

@@ -0,0 +1,66 @@
#include <remotepsapp/rawimg.hpp>
RawImage &RawImage::operator=(const RawImage &/*rawImage*/)
{ // private implementation
return *this;
}
bool RawImage::draw(PureDevice &pureDevice)
{
PureDevice compatibleDevice;
if(!isOkay())return FALSE;
compatibleDevice.compatibleDevice(pureDevice);
compatibleDevice.select((GDIObj)mhBitmap,TRUE);
pureDevice.bitBlt(Rect(0,0,width(),height()),compatibleDevice,Point(0,0));
compatibleDevice.select((GDIObj)mhBitmap,FALSE);
return TRUE;
}
bool RawImage::draw(PureDevice &pureDevice,int xSrc,int ySrc)
{
PureDevice compatibleDevice;
if(!isOkay())return FALSE;
compatibleDevice.compatibleDevice(pureDevice);
compatibleDevice.select((GDIObj)mhBitmap,TRUE);
pureDevice.bitBlt(Rect(xSrc,ySrc,width(),height()),compatibleDevice,Point(0,0));
compatibleDevice.select((GDIObj)mhBitmap,FALSE);
return TRUE;
}
bool RawImage::draw(PureDevice &pureDevice,const Rect &dstRect,const Point &srcPoint)
{
PureDevice compatibleDevice;
if(!isOkay())return FALSE;
compatibleDevice.compatibleDevice(pureDevice);
compatibleDevice.select((GDIObj)mhBitmap,TRUE);
pureDevice.bitBlt(dstRect,compatibleDevice,srcPoint);
compatibleDevice.select((GDIObj)mhBitmap,FALSE);
return TRUE;
}
bool RawImage::stretch(PureDevice &pureDevice,const Point &xyPoint,int strwidth,int strheight)
{
PureDevice compatibleDevice;
if(!isOkay())return FALSE;
compatibleDevice.compatibleDevice(pureDevice);
compatibleDevice.select((GDIObj)mhBitmap,TRUE);
pureDevice.stretchBlt(Rect(xyPoint.x(),xyPoint.y(),strwidth,strheight),compatibleDevice,Rect(0,0,width(),height()));
compatibleDevice.select((GDIObj)mhBitmap,FALSE);
return FALSE;
}
bool RawImage::createImage(PureDevice &pureDevice,int width,int height,GlobalData<BYTE> &rawData)
{
destroy();
mBitmapInfo.width(width);
mBitmapInfo.height(height);
mhBitmap=::CreateCompatibleBitmap(pureDevice,width,height);
if(!mhBitmap)return false;
::SetDIBits(pureDevice,mhBitmap,0,height,&rawData[0],(BITMAPINFO*)mBitmapInfo,DIB_RGB_COLORS);
return isOkay();
}

89
remotepsapp/rawimg.hpp Normal file
View File

@@ -0,0 +1,89 @@
#ifndef _REMOTEPSAPP_RAWIMAGE_HPP_
#define _REMOTEPSAPP_RAWIMAGE_HPP_
#ifndef _COMMON_WINDOWS_HPP_
#include <common/windows.hpp>
#endif
#ifndef _COMMON_SMARTPOINTER_HPP_
#include <common/pointer.hpp>
#endif
#ifndef _COMMON_RGBCOLOR_HPP_
#include <common/rgbcolor.hpp>
#endif
#ifndef _COMMON_DIBITMAP_HPP_
#include <common/dib.hpp>
#endif
#ifndef _COMMON_BITMAPINFO_HPP_
#include <common/bminfo.hpp>
#endif
class RawImage
{
public:
class RawImageInvalidImage{};
RawImage(void);
virtual ~RawImage();
int width(void)const;
int height(void)const;
bool draw(PureDevice &pureDevice);
bool draw(PureDevice &pureDevice,int xSrc,int ySrc);
bool draw(PureDevice &pureDevice,const Rect &dstRect,const Point &srcPoint);
bool stretch(PureDevice &pureDevice,const Point &xyPoint,int strwidth,int strheight);
bool createImage(PureDevice &pureDevice,int width,int height,GlobalData<BYTE> &rawData);
bool isOkay(void)const;
private:
RawImage(const RawImage &someRawImage);
RawImage &operator=(const RawImage &rawImage);
void destroy(void);
BitmapInfo mBitmapInfo;
HBITMAP mhBitmap;
};
inline
RawImage::RawImage(void)
: mhBitmap(0)
{
mBitmapInfo.bitCount(BitmapInfo::Bit24);
mBitmapInfo.colorUsed(0);
mBitmapInfo.colorImportant(0);
mBitmapInfo.compression(BI_RGB);
}
inline
RawImage::RawImage(const RawImage &/*someRawImage*/)
{ // private implementation
}
inline
RawImage::~RawImage()
{
destroy();
}
inline
int RawImage::height(void)const
{
if(mBitmapInfo.height()<0)return -mBitmapInfo.height();
return mBitmapInfo.height();
}
inline
int RawImage::width(void)const
{
return mBitmapInfo.width();
}
inline
bool RawImage::isOkay(void)const
{
return mhBitmap?true:false;
}
inline
void RawImage::destroy(void)
{
if(!isOkay())return;
::DeleteObject(mhBitmap);
mhBitmap=0;
}
#endif

BIN
remotepsapp/remoteps.aps Normal file

Binary file not shown.

41
remotepsapp/remoteps.h Normal file
View File

@@ -0,0 +1,41 @@
#ifndef _REMOTEPSAPP_REMOTEPS_H_
#define _REMOTEPSAPP_REMOTEPS_H_
// VIEWDIALOG
#define VIEWDIALOG_REFRESHNOW 1003
#define VIEWDIALOG_PROCESSLIST 1001
#define CONNECT_COMPUTERNAME 1000
#define IDM_CASCADE 10014
#define IDM_TILE 10015
#define IDM_ARRANGE 10016
#define IDM_CLOSEALL 10017
#define IDM_MINIMIZEALL 10018
#define IDM_RESTOREALL 10019
#define PSMENU 10000
#define PSMENU_FILEOPEN 10001
#define PSMENU_FILECLOSE 10002
#define PSMENU_FILESAVE 10003
#define PSMENU_FILESAVEAS 10004
#define PSMENU_FILEPRINT 10005
#define PSMENU_FILEQUIT 10006
#define PSMENU_OPTIONSGROUPS 10007
#define PSMENU_HELPCONTENTS 10008
#define PSMENU_HELPSEARCH 10009
#define PSMENU_REGISTRATION 10010
#define PSMENU_HELPABOUT 10011
#define PSMENU_SINGLECONNECTION 20000
#define PSMENU_SELECTGROUP 20001
#define STRING_REMOTEPS 100
#define STRING_VERSION 101
#define STRING_PROCESSVIEWCLASSNAME 102
#endif

6
remotepsapp/remoteps.hpp Normal file
View File

@@ -0,0 +1,6 @@
#ifndef _REMOTEPSAPP_REMOTEPS_HPP_
#define _REMOTEPSAPP_REMOTEPS_HPP_
#ifndef _REMOTEPSAPP_REMOTEPS_H_
#include <remotepsapp/remoteps.h>
#endif
#endif

225
remotepsapp/remoteps.rc Normal file
View File

@@ -0,0 +1,225 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include <remotepsapp\remoteps.h>
#define APSTUDIO_HIDDEN_SYMBOLS
#include "windows.h"
#undef APSTUDIO_HIDDEN_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
PSICON ICON DISCARDABLE "PSICON.ICO"
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
LIST BITMAP DISCARDABLE "STRIP.BMP"
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
MAINMENU MENU DISCARDABLE
BEGIN
POPUP "&File"
BEGIN
MENUITEM "&Open...", PSMENU_FILEOPEN
MENUITEM "&Close", PSMENU_FILECLOSE
MENUITEM SEPARATOR
MENUITEM "&Save", PSMENU_FILESAVE, GRAYED
MENUITEM "Save &As...", PSMENU_FILESAVEAS, GRAYED
MENUITEM SEPARATOR
MENUITEM "&Print...", PSMENU_FILEPRINT, GRAYED
MENUITEM SEPARATOR
MENUITEM "E&xit", PSMENU_FILEQUIT
END
POPUP "&Options"
BEGIN
MENUITEM "&Groups...", PSMENU_OPTIONSGROUPS
END
POPUP "&Help"
BEGIN
MENUITEM "&Contents", PSMENU_HELPCONTENTS
MENUITEM "&Search", PSMENU_HELPSEARCH
MENUITEM SEPARATOR
MENUITEM "&Registration...", PSMENU_REGISTRATION
MENUITEM SEPARATOR
MENUITEM "&About RemotePS...", PSMENU_HELPABOUT
END
END
VIEWMENU MENU DISCARDABLE
BEGIN
POPUP "&File"
BEGIN
MENUITEM "&Open...", PSMENU_FILEOPEN
MENUITEM "&Close", PSMENU_FILECLOSE
MENUITEM SEPARATOR
MENUITEM "&Save", PSMENU_FILESAVE, GRAYED
MENUITEM "Save &As...", PSMENU_FILESAVEAS, GRAYED
MENUITEM SEPARATOR
MENUITEM "&Print...", PSMENU_FILEPRINT, GRAYED
MENUITEM SEPARATOR
MENUITEM "E&xit", PSMENU_FILEQUIT
END
POPUP "&Options"
BEGIN
MENUITEM "&Groups...", PSMENU_OPTIONSGROUPS
END
POPUP "&Window"
BEGIN
MENUITEM "&Cascade\tShift+F5", IDM_CASCADE
MENUITEM "&Tile\tShift+F4", IDM_TILE
MENUITEM "&Arrange &icons", IDM_ARRANGE
MENUITEM SEPARATOR
MENUITEM "Close &all", IDM_CLOSEALL
MENUITEM "Mi&nimize all", IDM_MINIMIZEALL
MENUITEM "&Restore all", IDM_RESTOREALL
END
POPUP "&Help"
BEGIN
MENUITEM "&Contents", PSMENU_HELPCONTENTS
MENUITEM "&Search", PSMENU_HELPSEARCH
MENUITEM SEPARATOR
MENUITEM "&Registration...", PSMENU_REGISTRATION
MENUITEM SEPARATOR
MENUITEM "&About RemotePS...", PSMENU_HELPABOUT
END
END
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""remotepsapp\\remoteps.h""\r\n"
"#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
"#include ""windows.h""\r\n"
"#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
CONNECT DIALOGEX 0, 0, 201, 69
STYLE DS_MODALFRAME | WS_POPUP | WS_CLIPSIBLINGS | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_STATICEDGE
CAPTION "Connect Network"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,144,7,50,14
PUSHBUTTON "Cancel",IDCANCEL,144,24,50,14
LTEXT "Computer Name",-1,13,26,52,8
COMBOBOX CONNECT_COMPUTERNAME,13,41,136,58,CBS_DROPDOWN |
CBS_SORT | WS_VSCROLL | WS_TABSTOP,WS_EX_CLIENTEDGE
END
VIEWDIALOG DIALOG DISCARDABLE 0, 0, 355, 291
STYLE WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_SYSMENU
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "Close",IDOK,291,4,50,14
PUSHBUTTON "Refresh Now",VIEWDIALOG_REFRESHNOW,291,19,50,14
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
"CONNECT", DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 194
TOPMARGIN, 7
BOTTOMMARGIN, 62
END
"VIEWDIALOG", DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 348
BOTTOMMARGIN, 284
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
STRING_REMOTEPS "RemotePS"
STRING_VERSION "v1.00"
STRING_PROCESSVIEWCLASSNAME "ProcessView"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

172
remotepsapp/remotepsapp.001 Normal file
View File

@@ -0,0 +1,172 @@
# Microsoft Developer Studio Project File - Name="remotepsapp" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=remotepsapp - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "remotepsapp.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "remotepsapp.mak" CFG="remotepsapp - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "remotepsapp - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "remotepsapp - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "remotepsapp - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
!ELSEIF "$(CFG)" == "remotepsapp - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /Zp1 /MTd /Gm /GX /Zi /Od /I "\work" /I "\parts" /I "\parts\sgi_stl" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "STRICT" /D "__FLAT__" /YX /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comctl32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "remotepsapp - Win32 Release"
# Name "remotepsapp - Win32 Debug"
# Begin Source File
SOURCE=..\Exe\com.lib
# End Source File
# Begin Source File
SOURCE=.\connectiondialog.cpp
# End Source File
# Begin Source File
SOURCE=.\ConnectionThread.cpp
# End Source File
# Begin Source File
SOURCE=..\EXE\imagelst.lib
# End Source File
# Begin Source File
SOURCE=..\Exe\jpeg6b.lib
# End Source File
# Begin Source File
SOURCE=..\Exe\jpgimg.lib
# End Source File
# Begin Source File
SOURCE=.\main.cpp
# End Source File
# Begin Source File
SOURCE=.\Mainfrm.cpp
# End Source File
# Begin Source File
SOURCE=..\EXE\mscommon.lib
# End Source File
# Begin Source File
SOURCE=..\Exe\msthread.lib
# End Source File
# Begin Source File
SOURCE=.\Optnsreg.cpp
# End Source File
# Begin Source File
SOURCE=.\processview.cpp
# End Source File
# Begin Source File
SOURCE=.\psicon.ico
# End Source File
# Begin Source File
SOURCE=.\RemoteProcessInfo.cpp
# End Source File
# Begin Source File
SOURCE=.\remoteps.rc
!IF "$(CFG)" == "remotepsapp - Win32 Release"
!ELSEIF "$(CFG)" == "remotepsapp - Win32 Debug"
!ENDIF
# End Source File
# Begin Source File
SOURCE=..\EXE\statbar.lib
# End Source File
# Begin Source File
SOURCE=.\viewdialog.cpp
# End Source File
# Begin Source File
SOURCE=..\EXE\widget.lib
# End Source File
# Begin Source File
SOURCE=.\windowview.cpp
# End Source File
# End Target
# End Project

135
remotepsapp/remotepsapp.dsp Normal file
View File

@@ -0,0 +1,135 @@
# Microsoft Developer Studio Project File - Name="remotepsapp" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=remotepsapp - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "remotepsapp.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "remotepsapp.mak" CFG="remotepsapp - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "remotepsapp - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "remotepsapp - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "remotepsapp - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
!ELSEIF "$(CFG)" == "remotepsapp - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /Gz /MTd /Gm /GX /ZI /Od /I "\work" /I "\parts" /I "\parts\sgi_stl" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "STRICT" /D "__FLAT__" /D "_COMMON_USENLS_" /YX /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /i "\work" /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comctl32.lib /nologo /subsystem:windows /machine:I386 /pdbtype:sept
# SUBTRACT LINK32 /pdb:none
!ENDIF
# Begin Target
# Name "remotepsapp - Win32 Release"
# Name "remotepsapp - Win32 Debug"
# Begin Source File
SOURCE=.\connectiondialog.cpp
# End Source File
# Begin Source File
SOURCE=.\ConnectionThread.cpp
# End Source File
# Begin Source File
SOURCE=.\main.cpp
# End Source File
# Begin Source File
SOURCE=.\Mainfrm.cpp
# End Source File
# Begin Source File
SOURCE=.\Optnsreg.cpp
# End Source File
# Begin Source File
SOURCE=.\processview.cpp
# End Source File
# Begin Source File
SOURCE=.\psicon.ico
# End Source File
# Begin Source File
SOURCE=.\RemoteProcessInfo.cpp
# End Source File
# Begin Source File
SOURCE=.\remoteps.rc
# End Source File
# Begin Source File
SOURCE=.\viewdialog.cpp
# End Source File
# Begin Source File
SOURCE=.\windowview.cpp
# End Source File
# End Target
# End Project

164
remotepsapp/remotepsapp.dsw Normal file
View File

@@ -0,0 +1,164 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "bsptree"=..\BSPTREE\bsptree.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "com"=..\com\com.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "common"=..\COMMON\common.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "imagelst"=..\IMAGELST\imagelst.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "jpeg6b"="..\..\parts\jpeg-6b\jpeg6b.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "jpgimg"=..\jpgimg\jpgimg.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "remotepsapp"=.\remotepsapp.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name com
End Project Dependency
Begin Project Dependency
Project_Dep_Name common
End Project Dependency
Begin Project Dependency
Project_Dep_Name imagelst
End Project Dependency
Begin Project Dependency
Project_Dep_Name jpeg6b
End Project Dependency
Begin Project Dependency
Project_Dep_Name jpgimg
End Project Dependency
Begin Project Dependency
Project_Dep_Name statbar
End Project Dependency
Begin Project Dependency
Project_Dep_Name thread
End Project Dependency
Begin Project Dependency
Project_Dep_Name widget
End Project Dependency
Begin Project Dependency
Project_Dep_Name bsptree
End Project Dependency
}}}
###############################################################################
Project: "statbar"=..\STATBAR\Statbar.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "thread"=..\THREAD\thread.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "widget"=..\widget\widget.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

1364
remotepsapp/remotepsapp.mak Normal file

File diff suppressed because it is too large Load Diff

BIN
remotepsapp/remotepsapp.opt Normal file

Binary file not shown.

View File

@@ -0,0 +1,66 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: remotepsapp - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "C:\WINNT\Profiles\sean\LOCALS~1\Temp\RSPC2.tmp" with contents
[
/nologo /Gz /MTd /Gm /GX /ZI /Od /I "\work" /I "\parts" /I "\parts\sgi_stl" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "STRICT" /D "__FLAT__" /D "_COMMON_USENLS_" /Fp"Debug/remotepsapp.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /c
"D:\work\remotepsapp\connectiondialog.cpp"
"D:\work\remotepsapp\ConnectionThread.cpp"
"D:\work\remotepsapp\main.cpp"
"D:\work\remotepsapp\Mainfrm.cpp"
"D:\work\remotepsapp\Optnsreg.cpp"
"D:\work\remotepsapp\processview.cpp"
"D:\work\remotepsapp\RemoteProcessInfo.cpp"
"D:\work\remotepsapp\viewdialog.cpp"
"D:\work\remotepsapp\windowview.cpp"
]
Creating command line "cl.exe @C:\WINNT\Profiles\sean\LOCALS~1\Temp\RSPC2.tmp"
Creating temporary file "C:\WINNT\Profiles\sean\LOCALS~1\Temp\RSPC3.tmp" with contents
[
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comctl32.lib /nologo /subsystem:windows /incremental:yes /pdb:"Debug/remotepsapp.pdb" /machine:I386 /out:"Debug/remotepsapp.exe" /pdbtype:sept
.\Debug\connectiondialog.obj
.\Debug\ConnectionThread.obj
.\Debug\main.obj
.\Debug\Mainfrm.obj
.\Debug\Optnsreg.obj
.\Debug\processview.obj
.\Debug\RemoteProcessInfo.obj
.\Debug\viewdialog.obj
.\Debug\windowview.obj
.\Debug\remoteps.res
\work\exe\com.lib
\work\exe\mscommon.lib
\work\exe\imagelst.lib
"\parts\jpeg-6b\lib\jpeg6b.lib"
\work\exe\jpgimg.lib
\work\exe\statbar.lib
\work\exe\msthread.lib
\work\exe\msbsp.lib
]
Creating command line "link.exe @C:\WINNT\Profiles\sean\LOCALS~1\Temp\RSPC3.tmp"
<h3>Output Window</h3>
Compiling...
connectiondialog.cpp
ConnectionThread.cpp
main.cpp
Mainfrm.cpp
Optnsreg.cpp
processview.cpp
RemoteProcessInfo.cpp
viewdialog.cpp
windowview.cpp
Linking...
Creating library Debug/remotepsapp.lib and object Debug/remotepsapp.exp
<h3>Results</h3>
remotepsapp.exe - 0 error(s), 0 warning(s)
</pre>
</body>
</html>

16
remotepsapp/resource.h Normal file
View File

@@ -0,0 +1,16 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by remoteps.rc
//
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NO_MFC 1
#define _APS_NEXT_RESOURCE_VALUE 104
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1009
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

807
remotepsapp/scraps.txt Normal file
View File

@@ -0,0 +1,807 @@
// if(getDocumentClass(String(STRING_PROCESSVIEWCLASSNAME),mdiWindow))
// {
// mdiWindow->top();
// return;
// }
// if(strText.isNull())strText="None";
// strCaption=strCaption.betweenString(0,'-');
// strCaption.trimRight();
// FrameWindow::setCaption(strCaption+String(" - [")+strText+String("]"));
// FolderTree(GUIWindow &parentWindow,const Rect &winRect=Rect(1,1,320,200),int controlID=101,RGBColor bkColor=RGBColor(::GetSysColor(COLOR_WINDOW)));
//inline
//LPARAM SectionDialog::makeItemID(NodeType nodeType,WORD itemID)const
//{
// return MAKELPARAM(itemID,nodeType);
//}
// enum {RootID=0};
// enum{EditOffsetTop=170,EditOffsetBottom=45};
// enum{FolderOffsetTop=5,FolderOffsetBottom=155};/
// enum {CodeMenuSave=101,CodeMenuDisplayHex=102,CodeMenuSearchInstruction=103,
// CodeMenuNextFrame=104,DataMenuSave=105,DataMenuDisplayCode=106,
// DataMenuSearchString=107};
// enum NodeType{NullNode=0x0000,ImportTerminalNode=0x0001,ExportTerminalNode=0x0002,
// CodeTerminalNode=0x0003,DataTerminalNode=0x0004,
// ResourceTerminalNode=0x0005};
void ProcessView::serverConnect(const String &strServerName)
{
ComObj comObj;
ComResult comResult;
ServerInfo serverInfo(strServerName);
BString string;
MultiQuery multiQuery;
Variant variant;
multiQuery.size(1);
multiQuery[0].pIID=&IID_IRemoteProcess;
mStatusBar->setText(String("Connecting to '")+strServerName+String("'"));
comResult=comObj.createInstance(CLSID_CoRemoteProcess,0,ClassContext(LocalServer|RemoteServer),serverInfo,multiQuery);
if(!comResult.success())
{
ComResult::Facility facility=comResult.facility();
WORD comError(comResult.error());
mStatusBar->setText(String("Connection to '")+strServerName+String("' failed."));
return;
}
mStatusBar->setText(String("Connected to '")+strServerName+String("'"));
if(!ComResult(multiQuery[0].hr).success())
{
mStatusBar->setText("Failed to acquire interface.");
return;
}
mStatusBar->setText("Interface acquired, retrieving process list.");
IRemoteProcess *pIRemoteProcess=(IRemoteProcess*)multiQuery[0].pItf;
getListItems(pIRemoteProcess);
mStatusBar->setText("Process list retrieved, updating display...");
showListItems();
pIRemoteProcess->Release();
mStatusBar->setText("Ready.");
}
void ProcessView::getListItems(IRemoteProcess *pIRemoteProcess)
{
Variant variant;
Variant varProcessID;
String ansiString;
String strParent;
DWORD processID;
if(!pIRemoteProcess)return;
setCaption(mServerName);
mProcessList.remove();
mProcessList.computerName(mServerName);
try{pIRemoteProcess->Snapshot(&variant.getVARIANT());}
catch(...)
{
mStatusBar->setText("Fatal error communicating with server.");
::MessageBeep(0);
return;
}
int processCount(0);
variant.getData(VTInt4,(void*)&processCount);
variant.clear();
if(!processCount)
{
mStatusBar->setText("Error retrieving remote process list.");
::MessageBeep(0);
return;
}
pIRemoteProcess->GetProcessFirst(&variant.getVARIANT());
variant.getData(VTInt4,&processID);
varProcessID.setData(processID);
// DATE kernelTime;
// SystemTime sysKernelTime;
// pIRemoteProcess->GetProcessKernelTime(&variant.getVARIANT(),&kernelTime);
// VariantTime variantTime(kernelTime);
// variantTime.getTime(sysKernelTime);
variant.clear();
for(int index=0;index<processCount;index++)
{
pIRemoteProcess->GetModuleFirst(&variant.getVARIANT());
if(VTInt4==variant.getType())variant.clear();
else
{
BString string;
variant.getData(string);
ansiString=string.toString();
ansiString.upper();
strParent=ansiString;
mProcessList.insert(&ProcessItem());
ProcessItem &processItem=mProcessList[mProcessList.size()-1];
processItem.processName(ansiString);
processItem.processID(processID);
variant.clear();
DATE kernelTime;
SystemTime sysKernelTime;
pIRemoteProcess->GetProcessKernelTime(&varProcessID.getVARIANT(),&kernelTime);
VariantTime variantTime(kernelTime);
variantTime.getTime(sysKernelTime);
::OutputDebugString(ansiString+String(" ")+sysKernelTime.toString()+String("\n"));
while(true)
{
pIRemoteProcess->GetModuleNext(&variant.getVARIANT());
if(VTInt4==variant.getType())
{
variant.clear();
break;
}
else
{
BString string;
variant.getData(string);
ansiString=string.toString();
ansiString.upper();
processItem.insert(&ansiString);
variant.clear();
}
}
}
pIRemoteProcess->GetProcessNext(&variant.getVARIANT());
variant.getData(VTInt4,&processID);
varProcessID.setData(processID);
variant.clear();
// {
// DATE kernelTime;
// SystemTime sysKernelTime;
// pIRemoteProcess->GetProcessKernelTime(&variant.getVARIANT(),&kernelTime);
// VariantTime variantTime(kernelTime);
// variantTime.getTime(sysKernelTime);
// ::OutputDebugString(ansiString+String(" ")+sysKernelTime.toString()+String("\n"));
//
//}
}
}
#if 0
VariantTime creationTime;
VariantTime exitTime;
VariantTime kernelTime;
VariantTime userTime;
SystemTime sysCreationTime;
SystemTime sysExitTime;
SystemTime sysKernelTime;
SystemTime sysUserTime;
processVariant.changeType(VTInt4);
processVariant.setData(processID);
pIRemoteProcess->GetProcessTimes(&processVariant.getVARIANT(),&creationTime.getDATE(),&exitTime.getDATE(),&kernelTime.getDATE(),&userTime.getDATE());
processVariant.clear();
creationTime.getTime(sysCreationTime);
exitTime.getTime(sysExitTime);
kernelTime.getTime(sysKernelTime);
userTime.getTime(sysUserTime);
#endif
#if 0
#include <common/windows.hpp>
#include <com/bstring.hpp>
#include <com/variant.hpp>
#include <com/sarray.hpp>
#include <com/com.hpp>
#include <remoteps/remoteps_i.c>
#include <remoteps/remoteps.h>
int PASCAL WinMain(HINSTANCE hInstance,HINSTANCE /*hPrevInstance*/,LPSTR /*lpszCmdLine*/,int /*nCmdShow*/)
{
ComObj comObj;
ComResult comResult;
ServerInfo serverInfo(String("rocinante"));
BString string;
MultiQuery multiQuery;
Variant variant;
multiQuery.size(1);
multiQuery[0].pIID=&IID_IRemoteProcess;
comResult=comObj.createInstance(CLSID_CoRemoteProcess,0,ClassContext(LocalServer|RemoteServer),serverInfo,multiQuery);
if(!comResult.success())
{
ComResult::Facility facility=comResult.facility();
WORD comError(comResult.error());
return 0;
}
if(!ComResult(multiQuery[0].hr).success())return 0;
IRemoteProcess *pIRemoteProcess=(IRemoteProcess*)multiQuery[0].pItf;
// pIRemoteProcess->GetRemoteProcesses(&variant.getVARIANT());
pIRemoteProcess->Snapshot(&variant.getVARIANT());
int processCount(0);
variant.getData(VTInt4,(void*)&processCount);
variant.clear();
pIRemoteProcess->GetProcessFirst(&variant.getVARIANT());
variant.clear();
for(int index=0;index<processCount;index++)
{
pIRemoteProcess->GetModuleFirst(&variant.getVARIANT());
if(VTInt4==variant.getType())variant.clear();
else
{
BString string;
variant.getData(string);
::OutputDebugString(string.toString()+String("\n"));
variant.clear();
while(true)
{
pIRemoteProcess->GetModuleNext(&variant.getVARIANT());
if(VTInt4==variant.getType())
{
variant.clear();
break;
}
else
{
BString string;
variant.getData(string);
::OutputDebugString(string.toString()+String("\n"));
variant.clear();
}
}
}
pIRemoteProcess->GetProcessNext(&variant.getVARIANT());
variant.clear();
}
pIRemoteProcess->Release();
// pIRemoteProcess->GetRemoteProcesses(&variant.getVARIANT());
// variant.getData(string);
// ::OutputDebugString(string.toString()+String("\n"));
return 0;
}
#endif
bool PureImage::decode(const String &strPathFileName,PureDevice &pureDevice)
{
JSAMPARRAY buffer;
int row_stride;
int row_elements;
int row(0);
jpeg_decompress_struct cinfo;
FILE *fp;
destroy();
if((fp=::fopen((char*)(String&)strPathFileName,"rb"))==NULL)return FALSE;
::jpeg_create_decompress(&cinfo);
::jpeg_stdio_src(&cinfo,fp);
try{::jpeg_read_header(&cinfo,TRUE);}
catch(JPGError){return FALSE;}
try{::jpeg_start_decompress(&cinfo);}
catch(JPGError){return FALSE;}
row_stride=cinfo.output_width*cinfo.output_components;
buffer=(*cinfo.mem->alloc_sarray)((j_common_ptr)&cinfo,JPOOL_IMAGE,row_stride,cinfo.output_height);
while(cinfo.output_scanline<cinfo.output_height)::jpeg_read_scanlines(&cinfo,&buffer[row++],1);
getBitmapInfo().rgbColors(0);
getBitmapInfo().bitCount(BitmapInfo::Bit24);
getBitmapInfo().width(cinfo.output_width);
getBitmapInfo().height(-cinfo.output_height);
getBitmapInfo().planes(1);
getBitmapInfo().compression(BI_RGB);
getBitmapInfo().sizeImage(0);
getBitmapInfo().colorUsed(0);
getBitmapInfo().colorImportant(0);
getBitmapInfo().verifyDimensions();
getRGBArray().size(getBitmapInfo().width()*(-getBitmapInfo().height()));
row_elements=row_stride/cinfo.output_components;
for(int scanline=0;scanline<cinfo.output_height;scanline++)
{
copyBGRRGB(&getRGBArray()[scanline*getBitmapInfo().width()],(char*)buffer[scanline],row_elements,cinfo.output_components);
}
mhBitmap=::CreateDIBitmap((HDC)pureDevice,(BITMAPINFOHEADER*)getBitmapInfo(),CBM_INIT,&getRGBArray()[0],(BITMAPINFO*)getBitmapInfo(),DIB_RGB_COLORS);
try{::jpeg_finish_decompress(&cinfo);}
catch(JPGError){;}
::jpeg_destroy_decompress(&cinfo);
::fclose(fp);
return TRUE;
}
bool JPGImage::decode(const String &strPathFileName)
{
JSAMPARRAY buffer;
int row_stride;
int row_elements;
int row(0);
jpeg_decompress_struct cinfo;
FILE *fp;
destroy();
if((fp=::fopen((char*)(String&)strPathFileName,"rb"))==NULL)return FALSE;
::jpeg_create_decompress(&cinfo);
::jpeg_stdio_src(&cinfo,fp);
try{::jpeg_read_header(&cinfo,TRUE);}
catch(JPGError){return FALSE;}
try{::jpeg_start_decompress(&cinfo);}
catch(JPGError){return FALSE;}
row_stride=cinfo.output_width*cinfo.output_components;
buffer=(*cinfo.mem->alloc_sarray)((j_common_ptr)&cinfo,JPOOL_IMAGE,row_stride,cinfo.output_height);
while(cinfo.output_scanline<cinfo.output_height)::jpeg_read_scanlines(&cinfo,&buffer[row++],1);
getBitmapInfo().rgbColors(0);
getBitmapInfo().bitCount(BitmapInfo::Bit24);
getBitmapInfo().width(cinfo.output_width);
getBitmapInfo().height(-cinfo.output_height);
getBitmapInfo().planes(1);
getBitmapInfo().compression(BI_RGB);
getBitmapInfo().sizeImage(0);
getBitmapInfo().colorUsed(0);
getBitmapInfo().colorImportant(0);
getBitmapInfo().verifyDimensions();
getRGBArray().size(getBitmapInfo().width()*(-getBitmapInfo().height()));
row_elements=row_stride/cinfo.output_components;
for(int scanline=0;scanline<cinfo.output_height;scanline++)
{
copyBGRRGB(&getRGBArray()[scanline*getBitmapInfo().width()],(char*)buffer[scanline],row_elements,cinfo.output_components);
}
try{::jpeg_finish_decompress(&cinfo);}
catch(JPGError){;}
::jpeg_destroy_decompress(&cinfo);
::fclose(fp);
return TRUE;
}
#if 0
CallbackData::ReturnType ImageView::paintHandler(CallbackData &someCallbackData)
{
CursorControl cursorControl;
cursorControl.waitCursor(TRUE);
mMutex.requestMutex();
if(!mJPGImage.isOkay())
{
mMutex.releaseMutex();
cursorControl.waitCursor(FALSE);
return (CallbackData::ReturnType)FALSE;
}
PaintInformation &paintInfo=*((PaintInformation*)someCallbackData.lParam());
PureDevice &paintDevice=(PureDevice&)paintInfo;
if(mScrollInfo.sizeEvent())
{
mScrollInfo.sizeEvent(FALSE);
mJPGImage.draw(paintDevice,Rect(0,0,mJPGImage.width(),mJPGImage.height()),Point(mScrollInfo.currScrollx(),mScrollInfo.currScrolly()));
}
if(mScrollInfo.scrollEvent()||(!mScrollInfo.sizeEvent()&&!mScrollInfo.scrollEvent()))
{
Rect paintRect(paintInfo.paintRect());
mScrollInfo.scrollEvent(FALSE);
paintRect.right(paintRect.right()-paintRect.left());
paintRect.bottom(paintRect.bottom()-paintRect.top());
mJPGImage.draw(paintDevice,paintRect,Point(paintRect.left()+mScrollInfo.currScrollx(),paintRect.top()+mScrollInfo.currScrolly()));
}
mMutex.releaseMutex();
cursorControl.waitCursor(FALSE);
return (CallbackData::ReturnType)FALSE;
}
#endif
#if 0
bool RemoteProcessInfo::getDesktopWindow(IRemoteProcess *pIRemoteProcess,int &width,int &height,GlobalData<BYTE> &imageBytes)
{
Variant variant;
SafeArray safeArray;
int upperBound;
BYTE *pData;
pIRemoteProcess->GetDesktopWindow(&variant.getVARIANT());
if(VTArray!=variant.getType()){variant.clear();return false;}
if(!variant.getData(safeArray)){variant.clear();return false;}
upperBound=safeArray.getUpperBound();
safeArray.accessData((void**)&pData);
width=*((int*)pData);
height=(*(((int*)pData)+1));
imageBytes.size(*(((int*)pData)+4));
::memcpy(&imageBytes[0],pData+(sizeof(DWORD)*5),imageBytes.size());
safeArray.unaccessData();
safeArray.destroy();
variant.clear();
return true;
}
#endif
#include <remotepsapp/group.hpp>
#include <remotepsapp/optnsreg.hpp>
Group group;
OptionsReg optionsReg;
Block<String> strGroupNames;
group.groupName("J&R");
optionsReg.getGroup(group);
optionsReg.getGroupNames(strGroupNames);
group.groupName("GGG");
group.insert(&String("192.168.1.1"));
group.insert(&String("192.168.1.2"));
optionsReg.setGroup(group);
optionsReg.getGroup(group);
#include <remotepsapp/viewdialog.hpp>
#include <remotepsapp/remoteps.hpp>
#include <remotepsapp/windowview.hpp>
#include <common/stdio.hpp>
#include <common/mdifrm.hpp>
#include <com/cominit.hpp>
#include <statbar/statbarx.hpp>
#include <imagelst/ftree.hpp>
//#include <widget/tabhandler.hpp>
//#include <widget/tabitem.hpp>
ViewDialog::ViewDialog(void)
: mIsInConnect(false)
{
mInitHandler.setCallback(this,&ViewDialog::initHandler);
mDestroyHandler.setCallback(this,&ViewDialog::destroyHandler);
mCommandHandler.setCallback(this,&ViewDialog::commandHandler);
mCloseHandler.setCallback(this,&ViewDialog::closeHandler);
// mSelChangedHandler.setCallback(this,&ViewDialog::tvSelChangedHandler);
// mItemExpandedHandler.setCallback(this,&ViewDialog::tvItemExpandedHandler);
// mTabSelChangeHandler.setCallback(this,&ViewDialog::tabSelChangeHandler);
mThreadHandler.setCallback(this,&ViewDialog::threadHandler);
DWindow::insertHandler(VectorHandler::InitDialogHandler,&mInitHandler);
DWindow::insertHandler(VectorHandler::DestroyHandler,&mDestroyHandler);
DWindow::insertHandler(VectorHandler::CommandHandler,&mCommandHandler);
DWindow::insertHandler(VectorHandler::CloseHandler,&mCloseHandler);
MessageThread::insertHandler(&mThreadHandler);
}
ViewDialog::ViewDialog(const ViewDialog &/*someViewDialog*/)
{ // private implementation
}
ViewDialog::~ViewDialog()
{
if(mIsInConnect){mIsInConnect=false;fatalThreadExit();}
DWindow::removeHandler(VectorHandler::InitDialogHandler,&mInitHandler);
DWindow::removeHandler(VectorHandler::DestroyHandler,&mDestroyHandler);
DWindow::removeHandler(VectorHandler::CommandHandler,&mCommandHandler);
DWindow::removeHandler(VectorHandler::CloseHandler,&mCloseHandler);
MessageThread::removeHandler(&mThreadHandler);
}
ViewDialog &ViewDialog::operator=(const ViewDialog &/*someViewDialog*/)
{ // private implementation
return *this;
}
void ViewDialog::handleConnect(const String &serverName)
{
String *pComputerName=::new String(serverName);
ThreadMessage connectMessage(ThreadMessage::TM_USER,MsgConnect,(LONG)pComputerName);
mIsInConnect=true;
MessageThread::postMessage(connectMessage);
}
bool ViewDialog::perform(MDIWindow &parentWindow,SmartPointer<StatusBarEx> &statusBar)
{
mStatusBar=statusBar;
createDialogParam(*(parentWindow.getFrame()),parentWindow,String("VIEWDIALOG"),(LPARAM)(DWindow*)this);
return isValid();
}
CallbackData::ReturnType ViewDialog::initHandler(CallbackData &someCallbackData)
{
#if 0
mTabControl=::new TabControlHandler(*this,Rect(InitTreeLeft,InitTreeTop,width(),height()-(InitTreeTop-45)),TabControlID);
mTabControl.disposition(PointerDisposition::Delete);
mTabControl->insertHandler(TabControlHandler::SelChangeHandler,&mTabSelChangeHandler);
mTabControl->insertItem(TabControl::TabIndex(0),TabItem(TabItem::TabText,0,0,String("Process List"),0,0,0L));
mTabControl->insertItem(TabControl::TabIndex(1),TabItem(TabItem::TabText,0,0,String("Desktop Window"),0,0,0L));
// mFolderTree=::new FolderTree(*this,Rect(10,30,mTabControl->width()-20,mTabControl->height()-45),TreeViewControlID);
mFolderTree=::new FolderTree(*mTabControl,Rect(10,30,mTabControl->width()-20,mTabControl->height()-45),TreeViewControlID);
mFolderTree.disposition(PointerDisposition::Delete);
mFolderTree->insertHandler(FolderTree::SelChangedHandler,&mSelChangedHandler);
mFolderTree->insertHandler(FolderTree::ItemExpandedHandler,&mItemExpandedHandler);
#endif
// mWindowView=::new WindowView(*mTabControl,Rect(10,30,mTabControl->width()-20,mTabControl->height()-45),WindowViewControlID);
mWindowView=::new WindowView(*this,Rect(10,30,width()-20,height()-45),WindowViewControlID);
mWindowView.disposition(PointerDisposition::Delete);
if(!mWindowView->isValid())return false;
mWindowView->show(SW_SHOW);
return FALSE;
}
CallbackData::ReturnType ViewDialog::commandHandler(CallbackData &someCallbackData)
{
switch(someCallbackData.wmCommandID())
{
case IDOK :
if(mIsInConnect)break;
GUIWindow::postMessage(parent(),WM_CLOSE,0,0L);
endDialog(true);
break;
case IDCANCEL :
if(mIsInConnect)break;
GUIWindow::postMessage(parent(),WM_CLOSE,0,0L);
endDialog(false);
break;
case VIEWDIALOG_REFRESHNOW :
handleRefreshNow();
break;
}
return FALSE;
}
CallbackData::ReturnType ViewDialog::closeHandler(CallbackData &someCallbackData)
{
if(mIsInConnect)return TRUE;
return FALSE;
}
CallbackData::ReturnType ViewDialog::destroyHandler(CallbackData &someCallbackData)
{
// if(mFolderTree.isOkay())mFolderTree.destroy();
// if(mTabControl.isOkay())mTabControl.destroy();
return FALSE;
}
#if 0
CallbackData::ReturnType ViewDialog::tabSelChangeHandler(CallbackData &someCallbackData)
{
TabControl::TabIndex currentSelection(mTabControl->getCurrentSelection());
if(TabControlTreeViewIndex==int(currentSelection))
{
mWindowView->show(SW_HIDE);
mWindowView->update();
mFolderTree->show(SW_SHOW);
mFolderTree->update();
}
else if(TabControlDesktopWindowIndex==int(currentSelection))
{
mFolderTree->show(SW_HIDE);
mFolderTree->update();
mWindowView->show(SW_SHOW);
mWindowView->update();
}
return FALSE;
}
#endif
#if 0
CallbackData::ReturnType ViewDialog::tvSelChangedHandler(CallbackData &someCallbackData)
{
String strString;
WORD selector(someCallbackData.loWord());
WORD index(someCallbackData.hiWord());
if(65535==selector&&65535==index)return FALSE;
if(65535==selector)
{
::sprintf(strString,"selected process:%d\n",index);
}
else
{
::sprintf(strString,"index(%d,%d)\n",selector,index);
}
::OutputDebugString(strString);
return FALSE;
}
CallbackData::ReturnType ViewDialog::tvItemExpandedHandler(CallbackData &someCallbackData)
{
String strString;
::sprintf(strString,"ViewDialog::tvItemExpandedHandler(%d,%d)\n",someCallbackData.hiWord(),someCallbackData.loWord());
::OutputDebugString(strString);
return FALSE;
}
#endif
void ViewDialog::handleRefreshNow(void)
{
handleConnect(mStrServerName);
}
DWORD ViewDialog::threadHandler(ThreadMessage &threadMessage)
{
switch(threadMessage.message())
{
case ThreadMessage::TM_CREATE :
break;
case ThreadMessage::TM_DESTROY :
break;
case ThreadMessage::TM_USER :
if(MsgConnect==threadMessage.userDataOne())
{
HANDLE hCurrentThread(::GetCurrentThread());
DWORD currPriority(::GetThreadPriority(hCurrentThread));
::SetThreadPriority(hCurrentThread,THREAD_PRIORITY_HIGHEST);
thConnect(*((String*)threadMessage.userDataTwo()));
::SetThreadPriority(hCurrentThread,currPriority);
mIsInConnect=false;
::delete (String*)threadMessage.userDataTwo();
}
break;
}
return FALSE;
}
void ViewDialog::thConnect(const String &serverName)
{
GlobalData<BYTE> imageBytes;
int width;
int height;
::OutputDebugString("ViewDialog::thConnect\n");
if(!mConnectionMutex.requestMutex(0))
{
mStatusBar->setText("Connection is already in progress.");
return;
}
ComInitializer comInitializer;
mStrServerName=serverName;
mStatusBar->setText(String("Connecting to ")+serverName+String("..."));
if(!mRemoteProcessInfo.connect(serverName))
{
mStatusBar->setText("Connection failed.");
mConnectionMutex.releaseMutex();
return;
}
// mStatusBar->setText("Retrieving list...");
// mRemoteProcessInfo.getListItems();
// mStatusBar->setText("Retrieving desktop image...");
mRemoteProcessInfo.getDesktopWindow(*mWindowView);
mRemoteProcessInfo.disconnect();
mStatusBar->setText("Updating desktop view...");
mWindowView->invalidate(false);
// mStatusBar->setText("Updating process list...");
// showListItems(mRemoteProcessInfo);
mConnectionMutex.releaseMutex();
mStatusBar->setText("Ready.");
return;
}
#if 0
void ViewDialog::showListItems(ProcessList &processList)
{
String strParent;
if(!processList.size())return;
mFolderTree->remove();
mFolderTree->addRootNode(FolderTree::FolderClosed,processList.computerName(),MAKELPARAM(-1,-1));
for(int pindex=0;pindex<processList.size();pindex++)
{
ProcessItem &processItem=processList[pindex];
String processName(processItem.processName());
TreeViewItem insertItem(0,0,0,0,(LPSTR)processName,processName.length(),FolderTree::FolderClosed,FolderTree::FolderOpen,0,MAKELPARAM(-1,pindex));
mFolderTree->addNode(TreeView::NodeChild,insertItem,processList.computerName());
strParent=processName;
for(int mindex=0;mindex<processItem.size();mindex++)
{
String &strModuleName=processItem[mindex];
if(!mindex)
{
TreeViewItem insertItem(0,0,0,0,(LPSTR)strModuleName,strModuleName.length(),FolderTree::FolderClosed,FolderTree::FolderOpen,0,MAKELPARAM(pindex,mindex));
mFolderTree->addNode(TreeView::NodeChild,insertItem,strParent,FALSE);
}
else mFolderTree->appendNode(TreeView::NodeSibling,FolderTree::FolderClosed,strModuleName,MAKELPARAM(pindex,mindex));
}
}
mFolderTree->selectRoot();
}
#endif
#ifndef _REMOTEPSAPP_VIEWDIALOG_HPP_
#define _REMOTEPSAPP_VIEWDIALOG_HPP_
#ifndef _COMMON_DWINDOW_HPP_
#include <common/dwindow.hpp>
#endif
#ifndef _COMMON_SMARTPOINTER_HPP_
#include <common/pointer.hpp>
#endif
#ifndef _COMMON_MDIWIN_HPP_
#include <common/mdiwin.hpp>
#endif
#ifndef _THREAD_MESSAGETHREAD_HPP_
#include <thread/mthread.hpp>
#endif
#ifndef _THREAD_MUTEX_HPP_
#include <thread/mutex.hpp>
#endif
//#ifndef _WIDGET_TABCONTROL_HPP
//#include <widget/tabctrl.hpp>
//#endif
#ifndef _REMOTEPSAPP_REMOTEPROCESSINFO_HPP_
#include <remotepsapp/remoteprocessinfo.hpp>
#endif
//class FolderTree;
class WindowView;
class StatusBarEx;
//class TabControlHandler;
class ViewDialog : public DWindow, public MessageThread
{
public:
ViewDialog(void);
virtual ~ViewDialog();
bool perform(MDIWindow &parentWindow,SmartPointer<StatusBarEx> &statusBar);
void handleConnect(const String &serverName);
private:
enum {MsgConnect};
enum{InitTreeLeft=5,InitTreeTop=125};
enum{TreeViewControlID=100,TabControlID=101,WindowViewControlID=102};
enum{TabControlTreeViewIndex=0,TabControlDesktopWindowIndex=1};
ViewDialog(const ViewDialog &someViewDialog);
ViewDialog &operator=(const ViewDialog &someViewDialog);
CallbackData::ReturnType initHandler(CallbackData &someCallbackData);
CallbackData::ReturnType destroyHandler(CallbackData &someCallbackData);
CallbackData::ReturnType commandHandler(CallbackData &someCallbackData);
CallbackData::ReturnType closeHandler(CallbackData &someCallbackData);
// CallbackData::ReturnType tvSelChangedHandler(CallbackData &someCallbackData);
// CallbackData::ReturnType tvItemExpandedHandler(CallbackData &someCallbackData);
// CallbackData::ReturnType tabSelChangeHandler(CallbackData &someCallbackData);
DWORD threadHandler(ThreadMessage &threadMessage);
void thConnect(const String &strServerName);
void handleRefreshNow(void);
// void showListItems(ProcessList &processList);
Callback<ViewDialog> mInitHandler;
Callback<ViewDialog> mDestroyHandler;
Callback<ViewDialog> mCommandHandler;
Callback<ViewDialog> mCloseHandler;
// Callback<ViewDialog> mSelChangedHandler;
// Callback<ViewDialog> mItemExpandedHandler;
// Callback<ViewDialog> mTabSelChangeHandler;
ThreadCallback<ViewDialog> mThreadHandler;
// SmartPointer<FolderTree> mFolderTree;
SmartPointer<WindowView> mWindowView;
// SmartPointer<TabControlHandler> mTabControl;
SmartPointer<StatusBarEx> mStatusBar;
RemoteProcessInfo mRemoteProcessInfo;
String mStrServerName;
Mutex mConnectionMutex;
bool mIsInConnect;
};
#endif
enum{InitTreeLeft=5,InitTreeTop=125};
enum{TreeViewControlID=100,TabControlID=101,WindowViewControlID=102};
enum{TabControlTreeViewIndex=0,TabControlDesktopWindowIndex=1};

115
remotepsapp/smk Normal file
View File

@@ -0,0 +1,115 @@
Comparing files mainfrm.hpp and E:mainfrm.hPP
FC: no differences encountered
Comparing files remoteps.hpp and E:remoteps.hPP
FC: no differences encountered
Comparing files processview.cpp and E:processview.cPP
***** processview.cpp
#include <common/windows.hpp>
#include <imagelst/ftree.hpp>
***** E:processview.cPP
#include <common/windows.hpp>
#include <common/mdifrm.hpp>
#include <imagelst/ftree.hpp>
*****
Comparing files processview.hpp and E:processview.hPP
FC: no differences encountered
Comparing files connectiondialog.hpp and E:connectiondialog.hPP
FC: no differences encountered
Comparing files connectiondialog.cpp and E:connectiondialog.cPP
FC: no differences encountered
Comparing files Mainfrm.cpp and E:Mainfrm.cPP
FC: no differences encountered
Comparing files main.cpp and E:main.cPP
FC: no differences encountered
Comparing files viewdialog.hpp and E:viewdialog.hPP
***** viewdialog.hpp
#endif
#ifndef _THREAD_MUTEX_HPP_
***** E:viewdialog.hPP
#endif
#ifndef _COMMON_MDIWIN_HPP_
#include <common/mdiwin.hpp>
#endif
#ifndef _THREAD_MUTEX_HPP_
*****
***** viewdialog.hpp
virtual ~ViewDialog();
bool perform(GUIWindow &parentWindow,SmartPointer<StatusBarEx> &statusBar);
bool handleConnect(const String &serverName);
***** E:viewdialog.hPP
virtual ~ViewDialog();
bool perform(MDIWindow &parentWindow,SmartPointer<StatusBarEx> &statusBar);
bool handleConnect(const String &serverName);
*****
Comparing files viewdialog.cpp and E:viewdialog.cPP
***** viewdialog.cpp
#include <common/stdio.hpp>
#include <com/cominit.hpp>
***** E:viewdialog.cPP
#include <common/stdio.hpp>
#include <common/mdifrm.hpp>
#include <com/cominit.hpp>
*****
***** viewdialog.cpp
bool ViewDialog::perform(GUIWindow &parentWindow,SmartPointer<StatusBarEx> &statusBar)
{
***** E:viewdialog.cPP
bool ViewDialog::perform(MDIWindow &parentWindow,SmartPointer<StatusBarEx> &statusBar)
{
*****
***** viewdialog.cpp
mStatusBar=statusBar;
return ::CreateDialogParam(processInstance(),(LPSTR)"VIEWDIALOG",(HWND)parentWindow,DWindow::DlgProc,(LPARAM)(DWindow*)this);
}
***** E:viewdialog.cPP
mStatusBar=statusBar;
createDialogParam(*(parentWindow.getFrame()),parentWindow,String("VIEWDIALOG"),(LPARAM)(DWindow*)this);
return isValid();
}
*****
Comparing files ProcessList.hpp and E:ProcessList.hPP
FC: no differences encountered
Comparing files ASMUTIL.HPP and E:ASMUTIL.HPP
FC: no differences encountered
Comparing files ProcessItem.hpp and E:ProcessItem.hPP
FC: no differences encountered
Comparing files RemoteProcessInfo.cpp and E:RemoteProcessInfo.cPP
FC: no differences encountered
Comparing files RGB888.HPP and E:RGB888.HPP
FC: no differences encountered
Comparing files RemoteProcessInfo.hpp and E:RemoteProcessInfo.hPP
FC: no differences encountered
Comparing files pureimg.cpp and E:pureimg.cPP
FC: no differences encountered
Comparing files rawimg.hpp and E:rawimg.hPP
FC: no differences encountered
Comparing files rawimg.cpp and E:rawimg.cPP
FC: no differences encountered
Comparing files pureimg.hpp and E:pureimg.hPP
FC: no differences encountered

133
remotepsapp/viewdialog.cpp Normal file
View File

@@ -0,0 +1,133 @@
#include <remotepsapp/viewdialog.hpp>
#include <remotepsapp/remoteps.hpp>
#include <remotepsapp/windowview.hpp>
#include <common/stdio.hpp>
#include <common/mdifrm.hpp>
#include <com/cominit.hpp>
#include <statbar/statbarx.hpp>
ViewDialog::ViewDialog(void)
{
mInitHandler.setCallback(this,&ViewDialog::initHandler);
mDestroyHandler.setCallback(this,&ViewDialog::destroyHandler);
mCommandHandler.setCallback(this,&ViewDialog::commandHandler);
mCloseHandler.setCallback(this,&ViewDialog::closeHandler);
mSizeHandler.setCallback(this,&ViewDialog::sizeHandler);
DWindow::insertHandler(VectorHandler::InitDialogHandler,&mInitHandler);
DWindow::insertHandler(VectorHandler::DestroyHandler,&mDestroyHandler);
DWindow::insertHandler(VectorHandler::CommandHandler,&mCommandHandler);
DWindow::insertHandler(VectorHandler::CloseHandler,&mCloseHandler);
DWindow::insertHandler(VectorHandler::SizeHandler,&mSizeHandler);
}
ViewDialog::ViewDialog(const ViewDialog &/*someViewDialog*/)
{ // private implementation
}
ViewDialog::~ViewDialog()
{
DWindow::removeHandler(VectorHandler::InitDialogHandler,&mInitHandler);
DWindow::removeHandler(VectorHandler::DestroyHandler,&mDestroyHandler);
DWindow::removeHandler(VectorHandler::CommandHandler,&mCommandHandler);
DWindow::removeHandler(VectorHandler::CloseHandler,&mCloseHandler);
DWindow::removeHandler(VectorHandler::SizeHandler,&mSizeHandler);
}
ViewDialog &ViewDialog::operator=(const ViewDialog &/*someViewDialog*/)
{ // private implementation
return *this;
}
void ViewDialog::connect(const String &serverName)
{
handleConnect(serverName);
}
bool ViewDialog::perform(MDIWindow &parentWindow,SmartPointer<StatusBarEx> &statusBar)
{
mStatusBar=statusBar;
mMDIParent=&parentWindow;
createDialogParam(*(parentWindow.getFrame()),parentWindow,String("VIEWDIALOG"),(LPARAM)(DWindow*)this);
return isValid();
}
CallbackData::ReturnType ViewDialog::initHandler(CallbackData &someCallbackData)
{
mCloseButton.assumeControl(getItem(IDOK),IDOK,false);
mRefreshButton.assumeControl(getItem(VIEWDIALOG_REFRESHNOW),VIEWDIALOG_REFRESHNOW,false);
mWindowView=::new WindowView;
mWindowView.disposition(PointerDisposition::Delete);
// mWindowView->create(*mMDIParent,*mMDIParent,Rect(10,height()+10,mMDIParent->width()-20,mMDIParent->height()-105),WindowViewControlID);
mWindowView->create(*this,*this,Rect(10,75,width()-20,height()-75),WindowViewControlID);
if(!mWindowView->isValid())return false;
mWindowView->show(SW_SHOW);
return FALSE;
}
CallbackData::ReturnType ViewDialog::sizeHandler(CallbackData &someCallbackData)
{
mCloseButton.move(Point(width()-mCloseButton.width(),10));
mRefreshButton.move(Point(width()-mRefreshButton.width(),35));
mWindowView->moveWindow(Rect(10,75,width(),height()));
return false;
}
CallbackData::ReturnType ViewDialog::commandHandler(CallbackData &someCallbackData)
{
switch(someCallbackData.wmCommandID())
{
case IDOK :
if(isInConnect())break;
GUIWindow::postMessage(parent(),WM_CLOSE,0,0L);
endDialog(true);
break;
case IDCANCEL :
if(isInConnect())break;
GUIWindow::postMessage(parent(),WM_CLOSE,0,0L);
endDialog(false);
break;
case VIEWDIALOG_REFRESHNOW :
handleRefreshNow();
break;
}
return FALSE;
}
CallbackData::ReturnType ViewDialog::closeHandler(CallbackData &someCallbackData)
{
if(isInConnect())return TRUE;
return FALSE;
}
CallbackData::ReturnType ViewDialog::destroyHandler(CallbackData &someCallbackData)
{
return FALSE;
}
void ViewDialog::handleRefreshNow(void)
{
handleConnect(serverName());
}
// virtuals
void ViewDialog::preConnect(const String &strServerName)
{
mStatusBar->setText(String("Connecting to '")+strServerName+String("'"));
}
void ViewDialog::connectionHandler(RemoteProcessInfo &remoteProcessInfo)
{
mStatusBar->setText("Retrieving desktop image.");
remoteProcessInfo.getDesktopWindow(*mWindowView);
}
void ViewDialog::preDisconnect(const String &strServerName)
{
mStatusBar->setText(String("Disconnected from '")+strServerName+String("'"));
}
void ViewDialog::errorHandler(void)
{
mStatusBar->setText(String("Remote activation failed '"));
}

View File

@@ -0,0 +1,66 @@
#ifndef _REMOTEPSAPP_VIEWDIALOG_HPP_
#define _REMOTEPSAPP_VIEWDIALOG_HPP_
#ifndef _COMMON_DWINDOW_HPP_
#include <common/dwindow.hpp>
#endif
#ifndef _COMMON_SMARTPOINTER_HPP_
#include <common/pointer.hpp>
#endif
#ifndef _COMMON_MDIWIN_HPP_
#include <common/mdiwin.hpp>
#endif
#ifndef _COMMON_CONTROL_HPP_
#include <common/control.hpp>
#endif
#ifndef _THREAD_MESSAGETHREAD_HPP_
#include <thread/mthread.hpp>
#endif
#ifndef _THREAD_MUTEX_HPP_
#include <thread/mutex.hpp>
#endif
#ifndef _REMOTEPSAPP_CONNECTIONTHREAD_HPP_
#include <remotepsapp/ConnectionThread.hpp>
#endif
class WindowView;
class StatusBarEx;
class ViewDialog : public DWindow, public ConnectionThread
{
public:
ViewDialog(void);
virtual ~ViewDialog();
bool perform(MDIWindow &parentWindow,SmartPointer<StatusBarEx> &statusBar);
void connect(const String &serverName);
protected:
virtual void connectionHandler(RemoteProcessInfo &remoteProcessInfo);
virtual void errorHandler(void);
virtual void preConnect(const String &strServerName);
virtual void preDisconnect(const String &strServerName);
private:
enum {WindowViewControlID=102};
ViewDialog(const ViewDialog &someViewDialog);
ViewDialog &operator=(const ViewDialog &someViewDialog);
CallbackData::ReturnType initHandler(CallbackData &someCallbackData);
CallbackData::ReturnType destroyHandler(CallbackData &someCallbackData);
CallbackData::ReturnType commandHandler(CallbackData &someCallbackData);
CallbackData::ReturnType closeHandler(CallbackData &someCallbackData);
CallbackData::ReturnType sizeHandler(CallbackData &someCallbackData);
void handleRefreshNow(void);
Callback<ViewDialog> mInitHandler;
Callback<ViewDialog> mDestroyHandler;
Callback<ViewDialog> mCommandHandler;
Callback<ViewDialog> mCloseHandler;
Callback<ViewDialog> mSizeHandler;
SmartPointer<WindowView> mWindowView;
SmartPointer<StatusBarEx> mStatusBar;
SmartPointer<MDIWindow> mMDIParent;
Control mCloseButton;
Control mRefreshButton;
};
#endif

145
remotepsapp/windowview.cpp Normal file
View File

@@ -0,0 +1,145 @@
#include <remotepsapp/windowview.hpp>
#include <common/assert.hpp>
#include <common/string.hpp>
char WindowView::mszClassName[]="WINDOWVIEW";
WindowView::WindowView(void)
{
mCreateHandler.setCallback(this,&WindowView::createHandler);
mDestroyHandler.setCallback(this,&WindowView::destroyHandler);
mCloseHandler.setCallback(this,&WindowView::closeHandler);
mPaintHandler.setCallback(this,&WindowView::paintHandler);
mSizeHandler.setCallback(this,&WindowView::sizeHandler);
mVerticalScrollHandler.setCallback(this,&WindowView::verticalScrollHandler);
mHorizontalScrollHandler.setCallback(this,&WindowView::horizontalScrollHandler);
mEraseBackgroundHandler.setCallback(this,&WindowView::eraseBackgroundHandler);
insertHandler(VectorHandler::CreateHandler,&mCreateHandler);
insertHandler(VectorHandler::DestroyHandler,&mDestroyHandler);
insertHandler(VectorHandler::CloseHandler,&mCloseHandler);
insertHandler(VectorHandler::PaintHandler,&mPaintHandler);
insertHandler(VectorHandler::SizeHandler,&mSizeHandler);
insertHandler(VectorHandler::VerticalScrollHandler,&mVerticalScrollHandler);
insertHandler(VectorHandler::HorizontalScrollHandler,&mHorizontalScrollHandler);
insertHandler(VectorHandler::EraseBackgroundHandler,&mEraseBackgroundHandler);
registerClass();
}
WindowView::WindowView(const WindowView &someWindowView)
{
}
WindowView::~WindowView()
{
removeHandler(VectorHandler::CreateHandler,&mCreateHandler);
removeHandler(VectorHandler::DestroyHandler,&mDestroyHandler);
removeHandler(VectorHandler::CloseHandler,&mCloseHandler);
removeHandler(VectorHandler::PaintHandler,&mPaintHandler);
removeHandler(VectorHandler::SizeHandler,&mSizeHandler);
removeHandler(VectorHandler::VerticalScrollHandler,&mVerticalScrollHandler);
removeHandler(VectorHandler::HorizontalScrollHandler,&mHorizontalScrollHandler);
removeHandler(VectorHandler::EraseBackgroundHandler,&mEraseBackgroundHandler);
}
WindowView &WindowView::operator=(const WindowView &/*someWindowView*/)
{ // private implemnentation
return *this;
}
bool WindowView::create(GUIWindow &parentWindow,GUIWindow &conformParent,const Rect &winRect,UINT controlID)
{
if(isValid())return false;
createWindow(WS_EX_CLIENTEDGE,className(),className(),WS_CHILD|WS_CLIPSIBLINGS|WS_CLIPCHILDREN|WS_VISIBLE,winRect,parentWindow,(HMENU)0,processInstance(),(LPSTR)this);
assumeControl(conformParent,*this,0);
update();
return isValid();
}
void WindowView::registerClass(void)
{
WNDCLASS wndClass;
if(::GetClassInfo(processInstance(),className(),(WNDCLASS FAR*)&wndClass))return;
wndClass.style =CS_HREDRAW|CS_VREDRAW|CS_OWNDC|CS_DBLCLKS;
wndClass.lpfnWndProc =(WNDPROC)Window::WndProc;
wndClass.cbClsExtra =0;
wndClass.cbWndExtra =sizeof(WindowView*);
wndClass.hInstance =processInstance();
wndClass.hIcon =::LoadIcon(NULL,IDI_APPLICATION);
wndClass.hCursor =::LoadCursor(NULL,IDC_ARROW);
wndClass.hbrBackground =(HBRUSH)::GetStockObject(WHITE_BRUSH);
wndClass.lpszMenuName =0;
wndClass.lpszClassName =className();
::RegisterClass(&wndClass);
assert(0!=::GetClassInfo(processInstance(),className(),(WNDCLASS FAR*)&wndClass));
}
CallbackData::ReturnType WindowView::createHandler(CallbackData &someCallbackData)
{
mScrollInfo.hwndOwner(*this);
return false;
}
CallbackData::ReturnType WindowView::destroyHandler(CallbackData &someCallbackData)
{
return false;
}
CallbackData::ReturnType WindowView::closeHandler(CallbackData &someCallbackData)
{
return false;
}
CallbackData::ReturnType WindowView::paintHandler(CallbackData &someCallbackData)
{
if(!mJPGImage.isOkay())return false;
PaintInformation *pPaintInfo=(PaintInformation*)someCallbackData.lParam();
PureDevice &paintDevice=(PureDevice&)*pPaintInfo;
if(mScrollInfo.sizeEvent())
{
mScrollInfo.sizeEvent(false);
mJPGImage.draw(paintDevice,Rect(0,0,mJPGImage.width(),mJPGImage.height()),Point(mScrollInfo.currScrollx(),mScrollInfo.currScrolly()));
}
if(mScrollInfo.scrollEvent()||(!mScrollInfo.sizeEvent()&&!mScrollInfo.scrollEvent()))
{
Rect paintRect(pPaintInfo->paintRect());
mScrollInfo.scrollEvent(FALSE);
paintRect.right(paintRect.right()-paintRect.left());
paintRect.bottom(paintRect.bottom()-paintRect.top());
mJPGImage.draw(paintDevice,paintRect,Point(paintRect.left()+mScrollInfo.currScrollx(),paintRect.top()+mScrollInfo.currScrolly()));
}
return false;
}
CallbackData::ReturnType WindowView::sizeHandler(CallbackData &someCallbackData)
{
mScrollInfo.handleSize(someCallbackData);
return false;
}
CallbackData::ReturnType WindowView::verticalScrollHandler(CallbackData &someCallbackData)
{
mScrollInfo.handleVerticalScroll(someCallbackData);
return (CallbackData::ReturnType)FALSE;
}
CallbackData::ReturnType WindowView::horizontalScrollHandler(CallbackData &someCallbackData)
{
mScrollInfo.handleHorizontalScroll(someCallbackData);
return (CallbackData::ReturnType)FALSE;
}
CallbackData::ReturnType WindowView::eraseBackgroundHandler(CallbackData &someCallbackData)
{
return (CallbackData::ReturnType)FALSE;
}
bool WindowView::createImage(const String &strPathFileName)
{
if(!isValid())return false;
PureDevice pureDevice(*this);
mJPGImage.decode(strPathFileName,pureDevice);
if(!mJPGImage.isOkay())return false;
mScrollInfo.scrollableObjectDimensions(mJPGImage.width(),mJPGImage.height());
invalidate();
return true;
}

0
remotepsapp/~VCDFC.tmp Normal file
View File