日期:2014-05-18  浏览次数:20923 次

利用短信远程关闭计算机
请问:
GMS.GSMModemGetDevice();的命名空间是什么?
如何实现用短信远程关闭计算机?

------解决方案--------------------
(2)GSMModemGetDevice函数

该函数获取当前的通讯端口,代码如下:

[DllImport("dllforvc.dll",

EntryPoint = "GSMModemGetDevice",

CharSet = CharSet.Ansi,

CallingConvention = CallingConvention.StdCall)]

public static extern string GSMModemGetDevice();


------解决方案--------------------
如何实现用短信远程关闭计算机?

判断短信里的关键字来调用 progress shut down命令来关机
------解决方案--------------------
class GMS 

[DllImport("dllforvc.dll", 
EntryPoint = "GSMModemInitNew", 
CharSet = CharSet.Ansi, 
CallingConvention = CallingConvention.StdCall)] 
public static extern bool GSMModemInitNew( 
string device, 
string baudrate, 
string initstring, 
string charset, 
bool swHandshake, 
string sn); 

[DllImport("dllforvc.dll", 
EntryPoint = "GSMModemGetSnInfoNew", 
CharSet = CharSet.Ansi, 
CallingConvention = CallingConvention.StdCall)] 
public static extern string GSMModemGetSnInfoNew(string device, string baudrate); 

[DllImport("dllforvc.dll", 
EntryPoint = "GSMModemGetDevice", 
CharSet = CharSet.Ansi, 
CallingConvention = CallingConvention.StdCall)] 
public static extern string GSMModemGetDevice(); 

[DllImport("dllforvc.dll", 
EntryPoint = "GSMModemGetBaudrate", 
CharSet = CharSet.Ansi, 
CallingConvention = CallingConvention.StdCall)] 
public static extern string GSMModemGetBaudrate(); 

[DllImport("dllforvc.dll", 
EntryPoint = "GSMModemRelease", 
CharSet = CharSet.Ansi, 
CallingConvention = CallingConvention.StdCall)] 
public static extern void GSMModemRelease(); 

[DllImport("dllforvc.dll", 
EntryPoint = "GSMModemGetErrorMsg", 
CharSet = CharSet.Ansi, 
CallingConvention = CallingConvention.StdCall)] 
public static extern string GSMModemGetErrorMsg(); 
[DllImport("dllforvc.dll", 
EntryPoint = "GSMModemSMSsend", 
CharSet = CharSet.Ansi, 
CallingConvention = CallingConvention.StdCall)] 
public static extern bool GSMModemSMSsend( 
string serviceCenterAddress, 
int encodeval, 
string text, 
int textlen, 
string phonenumber, 
bool requestStatusReport); 
[DllImport("dllforvc.dll", 
EntryPoint = "GSMModemSMSReadAll", 
CharSet = CharSet.Ansi, 
CallingConvention = CallingConvention.StdCall)] 
public static extern string GSMModemSMSReadAll(int RD_opt); 

参考