在pda上怎样打开网页或者调用其他可程序(主要是指可执行文件)的公共类
在pda上怎样打开网页或者调用其他可程序(主要是指可执行文件)的公共类 using System;
using System.Runtime.InteropServices;
namespace BaseStationPDA
{
/// <summary>
/// Summary description for Invoke.
/// </summary>
public class Invoke
{
public Invoke()
{
//
// TODO: Add constructor logic here
//
}
[DllImport('coredll.Dll')]
private static extern int CreateProcess(string strImageName, string strCmdLine, IntPtr pProcessAttributes, IntPtr pThreadAttributes , int bInheritsHandle, int dwCreationFlags, IntPtr pEnvironment, IntPtr pCurrentDir, Byte[] bArray, ProcessInfo oProc);
public void ShowWebSite(string path)
{
ProcessInfo pi = new ProcessInfo();
CreateProcess('iexplore.exe', path, IntPtr.Zero, IntPtr.Zero, 0, 0, IntPtr.Zero, IntPtr.Zero, new Byte[128], pi);
}
public void StartIE( )
{
ProcessInfo pi = new ProcessInfo();
CreateProcess('iexplore.exe', '', IntPtr.Zero, IntPtr.Zero, 0, 0, IntPtr.Zero, IntPtr.Zero, new Byte[128], pi);
}
public void StartPrograme(string name)
{
ProcessInfo pi = new ProcessInfo();
CreateProcess(name, '', IntPtr.Zero, IntPtr.Zero, 0, 0, IntPtr.Zero, IntPtr.Zero, new Byte[128], pi);
}
}
public class ProcessInfo
{
public int Process;
public int Thread;
public int ProcessID;
public int ThreadID;
}
}
在调用时EXample:
(1)调用可执行文件
private void DataCall()
{
string path='\\DataCall.exe';
FileInfo fileexis=new FileInfo(path);
if(fileexis.Exists)
{
Invoke invoke=new Invoke();
invoke.StartPrograme(path);
}
}
(2)打开网页
private void openid()
{
if(GetParam.SelBSId=='')
{
MessageBox.Show('未发现附近维护点,请点击上面[获取]按钮获取维护点!','系统提示',MessageBoxButtons.OK,MessageBoxIcon.Exclamation,MessageBoxDefaultButton.Button1);
return;
}
if(GetParam.webhost=='')
{
MessageBox.Show('请在设置页面设置WEB服务器地址!','系统提示',MessageBoxButtons.OK,MessageBoxIcon.Exclamation,MessageBoxDefaultButton.Button1);
return;
}
string path='http://'+GetParam.webhost+'/BaseStation/MobilePages/FCheckTempBSEq.aspx?userId='+GetParam.UserID
+'&password='+GetParam.password+'&BSId='+GetParam.SelBSId+'&companyId='+GetParam.companyId+'&device=pda'
+'&user='+GetParam.UserID+'&url=FCheckTempBSEq.aspx';
Invoke invoke=new Invoke();
invoke.ShowWebSite(path);
}