盾怪网教程:是一个免费提供流行杀毒软件教程、在线学习分享的学习平台!

Visual C++打造Windows信使服务程序

时间:2025/3/12作者:未知来源:盾怪网教程人气:

[摘要](argc >5))   printf("Usge: %S <DestIP> <SourIP> <Message> [Count]\n"...
(argc >5))
 {
  printf("Usge: %S <DestIP> <SourIP> <Message> [Count]\n",argv[0]);
  printf("Count: Count means number of times to send message,default is 1.\n");
  return 0;
 }
 wdest = argv[1]; //目标计算机
 wfrom = argv[2]; //源计算机
 buffer = argv[3]; //发送的信息
 count = _wtoi(argv[4]); //发送次数,缺省为1次
 if(count ==0)
  count = 1;
  printf("count = %d\n",count);
 dwReturn = NetMessageBufferSend(NULL, wdest, wfrom,
    (LPBYTE)buffer, 2*lstrlen(buffer)); //因为buffer是Unicode编码,所以需要乘以2
 if(dwReturn == NERR_Success)
 {
  printf("Send OK!");
  while(count-->1)
  {
   NetMessageBufferSend(NULL, wtarget, wfrom, (LPBYTE)buffe,2*lstrlen(buffer));
  }
  return 0;
 }
 if(dwReturn == NERR_NameNotFound)
 {
  printf("The user name could not be found.\n");
  return 0;
 }
 if(dwReturn == NERR_NetworkError)
 {
  printf("A general failure occurred in the network hardware.\n");
  return 0;
 }
 if(dwReturn == ERROR_NOT_SUPPORTED)
 {
  printf("This network request is not supported.\n");
  return 0;
 }
 if(dwReturn == ERROR_INVALID_PARAMETER)
 {
  printf("The specified parameter is invalid.\n");
  return 0;
 }
 if(dwReturn == ERROR_ACCESS_DENIED)
 {
  printf("The user does not have access to the requested information.\n");
  return 0;
 }
 else
  printf("Unknown error!\n");
  return 0;
}  

  四、小结

  本实例开发一个Windows信使服务程序,以帮助读者深入了解Windows信使服务实现的内幕。


关键词:Visual C++打造Windows信使服务程序




Copyright © 2012-2018 盾怪网教程(http://www.dunguai.com) .All Rights Reserved 网站地图 友情链接

免责声明:本站资源均来自互联网收集 如有侵犯到您利益的地方请及时联系管理删除,敬请见谅!

QQ:1006262270   邮箱:kfyvi376850063@126.com   手机版