简单的消息发送小程序
生活随笔
收集整理的這篇文章主要介紹了
简单的消息发送小程序
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
借用命令行發送消息機制實現,十分簡單,廢話不說,貼代碼吧
public?int?SendMessage(string?sFrom,string?sTo,string?sMessage)
{
?byte[]?bBuffer?=?System.Text.Encoding.Unicode.GetBytes(sMessage);
?int?nRet?=?NetMessageBufferSend(null,sTo,sFrom,sMessage,sMessage.Length*2+2);
????????????return?nRet;
????????}
[DllImport?("Netapi32",?CharSet=CharSet.Unicode)]?
public?static?extern?int?NetMessageBufferSend(?string?servername,?string?msgname,?string?fromname,?string?buf,?int?buflen);
//調用舉例
int?a?=?SendMessage(Request.UserHostName.ToString(),tbx_sendto.Text.Trim(),tbx_message.Value.ToString());
轉載于:https://www.cnblogs.com/applegreen/archive/2005/12/09/293744.html
總結
以上是生活随笔為你收集整理的简单的消息发送小程序的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Dotnet 2.0配置系统
- 下一篇: 系统学习Linux11点建议