[파워빌더 API] Network Drive Add Function 예제
Structure Name : netresource
Structure Member
Long dwscope
Long dwtype
Long dwdisplay
Long dwusage
String lplocalname
String lpremortename
String lpcomment
String lpprovider
External Function :
Function Long WNetAddConnection2(Ref netresource lpnetresource, string lpszPassword ,string lpusername, long dwflags ) Library "mpr.dll" Alias For "WNetAddConnection2A"
------------------------------------------------------
Function Name : of_netadd
Arguments : String as_userid
: String as_password
: String as_remote
: String as_local
RETURN : -
------------------------------------------------------
String ls_netname
String ls_drive
String ls_username
String ls_passwd
Long ll_rtn
NETRESOURCE lpNetResource
ls_username = as_userid
ls_passwd = as_passwd
ls_netname = as_remote
ls_drive = as_local
lpNetResource.lpRemorteName = ls_netname
lpNetResource.lpLocalName = ls_drive
ll_rtn = WNetAddConnection2(lpNetResource,ls_passwd,ls_username,1)
IF ll_rtn <> 0 THEN
RETURN -1
END IF
RETURN 1
==============
자료보고 테스트하다가 다른분들 필요할지도 몰라서 올립니다.
사용예 of_netadd("id","pw","\yyyy","H:")
네트웍 드라이브 연결 해제 Function Long WNetCancelConnection2A (String lpName ,Long dwFlags ,Long fForce ) Library "mpr.dll" ls_drive = "Y:" ll_rtn = WNetCancelConnection2A (ls_drive,1,0)
Structure Member
Long dwscope
Long dwtype
Long dwdisplay
Long dwusage
String lplocalname
String lpremortename
String lpcomment
String lpprovider
External Function :
Function Long WNetAddConnection2(Ref netresource lpnetresource, string lpszPassword ,string lpusername, long dwflags ) Library "mpr.dll" Alias For "WNetAddConnection2A"
------------------------------------------------------
Function Name : of_netadd
Arguments : String as_userid
: String as_password
: String as_remote
: String as_local
RETURN : -
------------------------------------------------------
String ls_netname
String ls_drive
String ls_username
String ls_passwd
Long ll_rtn
NETRESOURCE lpNetResource
ls_username = as_userid
ls_passwd = as_passwd
ls_netname = as_remote
ls_drive = as_local
lpNetResource.lpRemorteName = ls_netname
lpNetResource.lpLocalName = ls_drive
ll_rtn = WNetAddConnection2(lpNetResource,ls_passwd,ls_username,1)
IF ll_rtn <> 0 THEN
RETURN -1
END IF
RETURN 1
==============
자료보고 테스트하다가 다른분들 필요할지도 몰라서 올립니다.
사용예 of_netadd("id","pw","\yyyy","H:")
네트웍 드라이브 연결 해제 Function Long WNetCancelConnection2A (String lpName ,Long dwFlags ,Long fForce ) Library "mpr.dll" ls_drive = "Y:" ll_rtn = WNetCancelConnection2A (ls_drive,1,0)