在pda上怎样打开网页或者调用其他可程序(主要是指可执行文件)的公共类

王朝other·作者佚名  2006-01-10
窄屏简体版  字體: |||超大  

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

}

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航