Attribute VB_Name = "API" Option Explicit '/////////////////////////////////////////////////////////////////// '################################################################### ' ³×Æ®¿öÅ©¿¡ °ü·ÃµÈ API ' ½Ã½ºÅÛ¿¡°Ô ³×Æ®¿öÅ© ÀÚ¿øÀÇ ¿¬°áÀ» ÀúÀåÇÏ°Ô ÇÏ°í, ' ½Ã½ºÅÛ Àç½ÃÀÛ ½Ã¿¡µµ À翬°áÀÌ ¼öÇàµÇµµ·Ï ÇÑ´Ù. Public Const CONNECT_UPDATE_PROFILE As Long = &H1 '/////////////////////////////////////////////////////////////////// ' WNetAddConnection2 ÇÔ¼ö¿¡¼­ ¸®ÅÏ°ªÀ¸·Î ³Ñ¾î¿À´Â »ó¼ö°ª ' ¾Æ¹«ÀÌ»óÀÌ ¾øÀ½ Public Const NO_ERROR = 0 ' dderror ' Á¢±ÙºÒ°¡ Public Const ERROR_ACCESS_DENIED = 5& ' lpNetResource ÀÇ ±â¼úÇÑ ÀåÄ¡°¡ ÀÌ¹Ì ¿¬°áµÇ¾î ÀÖÀ½. Public Const ERROR_ALREADY_ASSIGNED = 85& ' ÀåÄ¡ À¯Çü°ú ÀÚ¿ø À¯ÇüÀÌ ÀÏÄ¡ÇÏÁö ¾ÊÀ½. Public Const ERROR_BAD_DEV_TYPE = 66& ' lpLocalName¿¡ ±â¼úÇÑ °ªÀÌ À¯È¿ÇÏÁö ¾ÊÀ½. Public Const ERROR_BAD_DEVICE = 1200& ' lpRemoteName¿¡ ±â¼úÇÑ °ªÀÌ À¯È¿ÇÏÁö ¾Ê°Å³ª Á¸ÀçÇÏÁö ¾ÊÀ½. Public Const ERROR_BAD_NET_NAME = 67& ' »ç¿ëÀÚ ÇÁ·ÎÆÄÀÏÀÌ À߸ñµÈ Çü½ÄÀÓ. Public Const ERROR_BAD_PROFILE = 1206& ' ½Ã½ºÅÛ Àç½ÃÀÛ ÈÄ À翬°áÀ» ½ÃµµÇÏ´Â °úÁ¤¿¡¼­ »ç¿ëÀÚ ÇÁ·ÎÆÄÀÏÀ» ¿­ ¼ö ¾øÀ½. Public Const ERROR_CANNOT_OPEN_PROFILE = 1205& ' lpLocalName¿¡ ±â¼úÇÑ ÀåÄ¡°¡ ÀÌ¹Ì ´Ù¸¥ »ç¿ëÀÚ ÇÁ·ÎÆÄÀÏ¿¡¼­ »ç¿ëÁßÀÓ. Public Const ERROR_DEVICE_ALREADY_REMEMBERED = 1202& ' ³×Æ®¿öÅ© »ó¿¡ ¿À·ù°¡ ¹ß»ýµÊ. Public Const ERROR_EXTENDED_ERROR = 1208& ' ÁöÁ¤µÈ ¾ÏÈ£°¡ À¯È¿ÇÏÁö ¾ÊÀ½. Public Const ERROR_INVALID_PASSWORD = 86& ' ³×Æ®¿öÅ© »óÀÇ ÄÄÇ»ÅÍ°¡ ÀÛµ¿ÁßÀÌÁö ¾Ê°Å³ª »ç¿ëÇÒ ¼ö ¾øÀ½. Public Const ERROR_NO_NET_OR_BAD_PATH = 1203& ' ³×Æ®¿öÅ©°¡ Á¸ÀçÇÏÁö ¾ÊÀ½. Public Const ERROR_NO_NETWORK = 1222& '/////////////////////////////////////////////////////////////////// '/////////////////////////////////////////////////////////////////// ' ³×Æ®¿öÅ©¿¡ Á¢¼ÓÇÒ ¼ö ÀÖ°Ô ÇÏ´Â ÇÔ¼öµé '/////////////////////////////////////////////////////////////////// ' ÇÔ ¼ö ¸í : WNetAddConnection ' ¸Å°³º¯¼ö : ByVal lpszNetPath As String, ¿¬°áÇÏ°íÀÚ ÇÏ´Â ³×Æ®¿öÅ© ÀÚ¿øÀÇ À̸§ ' ByVal lpszPassword As String, ¿¬°á½Ã »ç¿ëµÇ´Â ¾ÏÈ£¸¦ ±â¼úÇÑ´Ù. ' ByVal lpszLocalName As String ¿¬°á½Ãų ÀÚ½ÅÀÇ µå¶óÀÌºê ¶Ç´Â Æ÷Æ®ÀÇ À̸§. ' ¸® ÅÏ °ª : Long ' ¼³ ¸í : ÀåÄ¡¸¦ ³×Æ®¿öÅ© ÀÚ¿ø¿¡ ¿¬°á½ÃŲ´Ù. ' ¿¬°áÀÌ ¼º°øÀûÀ¸·Î ÀÌ·ç¾îÁö¸é ½Ã½ºÅÛÀ» Àç½ÃÀÛ ÇÏ´õ¶óµµ ÇØ´ç ÀÚ¿øÀÇ ¿¬°áÀ» Áö¼ÓµÈ´Ù. Public Declare Function WNetAddConnection Lib "mpr.dll" Alias "WNetAddConnectionA" _ (ByVal lpszNetPath As String, ByVal lpszPassword As String, _ ByVal lpszLocalName As String) As Long ' ÇÔ ¼ö ¸í : WNetAddConnection2 ' ¸Å°³º¯¼ö : lpNetResource As NETRESOURCE, ¿¬°á½ÃÅ°°íÀÚ ÇÏ´Â ³×Æ®¿öÅ©ÀÇ ÀÚ¿ø ' ByVal lpPassword As String, ³×Æ®¿öÅ©ÀÇ ÀÚ¿ø¿¡ ¿¬°áÇϱâ À§ÇÑ ¾ÏÈ£ ' ByVal lpUserName As String, ³×Æ®¿öÅ© ¿¬°áÀ» À§ÇÑ »ç¿ëÀÚ À̸§ ' ByVal dwFlags As Long ¿¬°áÀ» À§ÇÑ ¿É¼ÇÀ» Ç¥½ÃÇÏ´Â Ç÷¡±× ' ¸® ÅÏ °ª : Long ' ¼³ ¸í : ÀåÄ¡¸¦ ³×Æ®¿öÅ© ÀÚ¿ø¿¡ ¸®´ÙÀÌ·ºÆ®ÇÏ°í ¿¬°á½ÃŲ´Ù. ' WNetAddConnection ÇÔ¼öÀÇ ±â´É¿¡ Ãß°¡ÀûÀ¸·Î ¿¬°áÇÑ ÈÄÀÇ Ã³¸® ¹æ¹ý µîÀ» ÁöÁ¤ÇÑ´Ù. Public Declare Function WNetAddConnection2 Lib "mpr.dll" Alias "WNetAddConnection2A" ( _ lpNetResource As NETRESOURCE, ByVal lpPassword As String, _ ByVal lpUserName As String, ByVal dwFlags As Long) As Long '/////////////////////////////////////////////////////////////////// '/////////////////////////////////////////////////////////////////// ' ³×Æ®¿öÅ© ÀÚ¿ø ±¸Á¶Ã¼ Public Type NETRESOURCE dwScope As Long ' ¹«½Ã dwType As Long ' ¿¬°áÇÒ ³×Æ®¿öÅ© ÀÚ¿øÀÇ À¯Çü dwDisplayType As Long ' ¹«½Ã dwUsage As Long ' ¹«½Ã pLocalName As String ' Áö¿ª ÀåÄ¡ÀÇ À̸§ pRemoteName As String ' ³×Æ®¿öÅ© »óÀÇ ÀÚ¿ø À̸§ pComment As String ' ¹«½Ã pProvider As String ' ¿¬°áÀ» Áö¿øÇÏ´Â ³×Æ®¿öÅ© Á¦°øÀÚÀÇ À̸§ End Type ' NETRESOURCE ±¸Á¶Ã¼ÀÇ dwType¿¡¼­ »ç¿ëÇÏ´Â »ó¼ö°ª Public Const RESOURCETYPE_ANY = &H0 Public Const RESOURCETYPE_DISK = &H1 Public Const RESOURCETYPE_PRINT = &H2 Public Const RESOURCE_GLOBALNET As Long = &H2& Public Const RESOURCEDISPLAYTYPE_SHARE = &H3 '################################################################### '/////////////////////////////////////////////////////////////////// Public Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long Public strLocalName As String Public strNetPath As String Public nResult As Boolean Public strUserName As String Public strPassword As String