CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
英特尔®游戏设计大赛100美元现金周周送 专题改版:Java Web 专题
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  VC/MFC >  基础类

用过windows API函数WNetGetConnection(lplocal,lpremote,lplengh);请进

楼主yezi7(飘零的叶子)2003-12-03 08:48:03 在 VC/MFC / 基础类 提问

windows   API函数WNetGetConnection(lplocal,lpremote,lplengh);用于测试连接的网络资源(如己映射盘符),有用过的吗,可否举个例,我不会用,试了几种用法,都不成功,谢谢各位GGJJ 问题点数:100、回复次数:4Top

1 楼arvid_gs(west)回复于 2003-12-03 09:00:38 得分 40

To   retrieve   the   name   of   the   network   resource   associated   with   a   local   device,   an   application   can   call   the   WNetGetConnection   function,   as   shown   in   the   following   example.   The   sample   calls   an   application-defined   error   handler   to   process   errors,   and   the   TextOut   function   for   printing.    
   
  CHAR   szDeviceName[80];    
  DWORD   dwResult,   cchBuff   =   sizeof(szDeviceName);    
     
  //   Call   the   WNetGetConnection   function.  
  //  
  dwResult   =   WNetGetConnection("z:",    
          (LPSTR)   szDeviceName,    
          &cchBuff);    
     
  switch   (dwResult)    
  {    
          //  
          //   Print   the   connection   name   or   process   errors.  
          //  
          case   NO_ERROR:    
                  TextOut(hdc,   10,   10,   (LPSTR)   szDeviceName,    
                          lstrlen((LPSTR)   szDeviceName));    
                  break;    
          //  
          //   The   device   is   not   a   redirected   device.  
          //  
          case   ERROR_NOT_CONNECTED:    
                  TextOut(hdc,   10,   10,   "Device   z:   not   connected.",   24);    
          //  
          //   The   device   is   not   currently   connected,  
          //     but   it   is   a   persistent   connection.  
          //  
          case   ERROR_CONNECTION_UNAVAIL:    
                  TextOut(hdc,   10,   10,   "Connection   unavailable.",   23);    
          //  
          //   Call   an   application-defined   error   handler.  
          //  
          default:    
                  NetErrorHandler(hwnd,   dwResult,   (LPSTR)"WNetGetConnection");    
                  return   FALSE;    
  }    
  Top

2 楼yezi7(飘零的叶子)回复于 2003-12-03 09:34:17 得分 0

http://vbworld.sxnw.gov.cn/vbapi/detail/WNetGetConnection.htmTop

3 楼SmallBigCat(乱花渐欲迷人眼)回复于 2003-12-03 09:55:56 得分 60

http://codeguru.earthweb.com/network/CNetService.html  
   
  接分Top

4 楼zongzi7(我爱吃粽子)回复于 2003-12-03 12:58:54 得分 0

upTop

相关问题

关键词

  • wnetgetconnection
  • szdevicename
  • dwresult
  • textout
  • lpstr
  • device
  • error
  • call
  • function

得分解答快速导航

  • 帖主:yezi7
  • arvid_gs
  • SmallBigCat

相关链接

  • Visual C++类图书
  • Visual C++类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
世纪乐知(北京)网络技术有限公司 版权所有, 京 ICP 证 020026 号
北京创新乐知广告有限公司 提供技术支持
Copyright © 2000-2007, CSDN.NET, All Rights Reserved
GongshangLogo