119 lines
3.4 KiB
Java
119 lines
3.4 KiB
Java
import java.awt.*;
|
|
import java.applet.*;
|
|
import java.net.*;
|
|
import java.io.*;
|
|
import java.awt.event.*;
|
|
import java.lang.reflect.*;
|
|
import com.ms.security.*;
|
|
import com.ms.com.*;
|
|
|
|
public class RemoteProcess extends Applet
|
|
{
|
|
private TextField mTextSymbol;
|
|
public List mProcessList;
|
|
private ListListener mListListener;
|
|
|
|
|
|
public void init()
|
|
{
|
|
setFont(new Font("Courier New",Font.BOLD,12));
|
|
setBackground(Color.lightGray);
|
|
try{if(Class.forName("com.ms.security.PolicyEngine") != null)PolicyEngine.assertPermission(PermissionID.NETIO);}
|
|
catch(Throwable cnfe){;}
|
|
mListListener=new ListListener(this);
|
|
performLayout();
|
|
getProcessList();
|
|
|
|
}
|
|
public void stop()
|
|
{
|
|
}
|
|
public void destroy()
|
|
{
|
|
}
|
|
public void paint(Graphics graphics)
|
|
{
|
|
}
|
|
public boolean action(Event event,Object object)
|
|
{
|
|
return true;
|
|
}
|
|
public void performLayout()
|
|
{
|
|
GridBagLayout layout=new GridBagLayout();
|
|
GridBagConstraints constraints=new GridBagConstraints();
|
|
setFont(new Font("Fixed",Font.BOLD,12));
|
|
setLayout(layout);
|
|
|
|
constraints.gridwidth=1;
|
|
constraints.fill=GridBagConstraints.BOTH;
|
|
constraints.weightx=0.25;
|
|
|
|
|
|
mProcessList=new List(20,false);
|
|
mProcessList.addActionListener(mListListener);
|
|
constraints.gridwidth=GridBagConstraints.RELATIVE;
|
|
layout.setConstraints(mProcessList,constraints);
|
|
add(mProcessList);
|
|
|
|
|
|
// Label symLabel=new Label("Symbol/Name",Label.LEFT);
|
|
// layout.setConstraints(symLabel,constraints);
|
|
// add(symLabel);
|
|
// mTextSymbol=new TextField("");
|
|
// constraints.gridwidth=GridBagConstraints.RELATIVE;
|
|
// layout.setConstraints(mTextSymbol,constraints);
|
|
// add(mTextSymbol);
|
|
// mButtonGetPrices=new Button("Get Prices");
|
|
// constraints.gridwidth=GridBagConstraints.REMAINDER;
|
|
// layout.setConstraints(mButtonGetPrices,constraints);
|
|
// add(mButtonGetPrices);
|
|
|
|
// Label nameLabel=new Label("Matching Funds",Label.LEFT);
|
|
// constraints.gridwidth=1;
|
|
// layout.setConstraints(nameLabel,constraints);
|
|
// add(nameLabel);
|
|
|
|
// mFundList=new List(7,false);
|
|
// mFundList.addActionListener(mListListener);
|
|
// constraints.gridwidth=GridBagConstraints.RELATIVE;
|
|
// layout.setConstraints(mFundList,constraints);
|
|
// add(mFundList);
|
|
// mButtonLookupByName=new Button("Lookup By Name");
|
|
// constraints.gridwidth=GridBagConstraints.REMAINDER;
|
|
// layout.setConstraints(mButtonLookupByName,constraints);
|
|
// add(mButtonLookupByName);
|
|
|
|
// mLabelMessage=new Label("Ready.",Label.LEFT);
|
|
// constraints.gridwidth=GridBagConstraints.REMAINDER;
|
|
// layout.setConstraints(mLabelMessage,constraints);
|
|
// add(mLabelMessage);
|
|
|
|
// mLabelMessage.setText("Service located at "+mStrServerIP);
|
|
}
|
|
|
|
private void getProcessList()
|
|
{
|
|
IRemoteProcess remoteProcess=(IRemoteProcess)new CoRemoteProcess();
|
|
int moduleCount=0;
|
|
remoteProcess.Snapshot();
|
|
Variant processID=new Variant();
|
|
processID=remoteProcess.GetProcessFirst();
|
|
mProcessList.removeAll();
|
|
while(-1!=processID.toInt())
|
|
{
|
|
String strString=new String(remoteProcess.GetModuleFirst().toString());
|
|
while(0!=strString.compareTo("-1"))
|
|
{
|
|
if(0!=moduleCount)mProcessList.addItem(new String(" ")+strString);
|
|
else mProcessList.addItem(strString);
|
|
moduleCount++;
|
|
strString=new String(remoteProcess.GetModuleNext().toString());
|
|
}
|
|
processID=remoteProcess.GetProcessNext();
|
|
moduleCount=0;
|
|
}
|
|
}
|
|
}
|
|
|