PP_NETOPEN()

Open Network Handle

Applies to:

Win32 only

Syntax-VB:

Declare Function pp_netopen(ByVal NetworkPassword as String, ByVal flags as Long, ByVal num1 as Long, ByVal string1 as String, ByRef NetHandle as Long, ByRef ErrorCode as Long) as Long

Syntax-C:

LONG pp_netopen(LPSTR NetworkPassword, LONG flags, LONG num1, LPSTR string1, LPLONG NetHandle, LPLONG ErrorCode)

Arguments:

<NetworkPassword> is a unique string to identify this particular license on a network.

<flags>

NET_SINGLE [0x0000]: Only Network Type currently supported

NET_DO_NOT_UPDATE [0x0001]: Do not update the network connected state. See Table in PP_NETTEST for expected results.

NET_ALWAYS_CONNECTED[0x0002]: See Table in PP_NETTEST for expected results.

<num1> is currently usused and should be passed in as 0.

<string1> is currently usused and should be passed in as "" or NULL.

<NetHandle> is the buffer to place the License File handle

<ErrorCode> is the buffer to place the Error code

Returns:

LONG – PP_TRUE or PP_FALSE if the Network Handle was opened properly or not.

Description:

This function opens a Network Handle to lock a given <Network Password> to that given computer, while the handle is open. Once the program is done, you should use pp_netclose to close the handle and free any memory associated to that handle.

This function is most commonly used to make sure that a license isn’t used more than once on a given network. The License should be uniquely identified by the <NetworkPassword> string.

Example:

Dim NetHandle As Long, ErrorCode As Long, Ret as Long

Dim strError as String * 50

NetHandle = Ret = ErrorCode = 0

 

Ret = PP_NETOPEN("MyUniqueString", 0,0, "",NetHandle, ErrorCode)

If (Ret <> PP_SUCCESS) Then

 

If (ErrorCode = ERR_NET_LIC_FULL) Then

MsgBox "This license is already being used" & chr(13) & "Please purchase another license" 

End 

Else 

   PP_ERRORSTR(ErrorCode,strError)

   MsgBox "An Error occurred: " & ErrorCode & chr(13) & strError

  End 

End If 

End If

 

' Run program here

' Test Network Handle to see if still valid throughout program

 Ret = PP_NETTEST(Nethandle)

If (Ret <> PP_SUCCESS) then 

If (NetHandle <> 0) Then PP_NETCLOSE(NetHandle) 

 

PP_ERRORSTR(ErrorCode,strError) 

MsgBox "An Error occurred: " & ErrorCode & chr(13) & strError 

Exit Sub 

 End If

 

' When Program exits, or you want to close the network license out

PP_NETCLOSE(NetHandle)

NetHandle = 0

See Also:

  pp_netclose(), pp_nettest(), pp_errorstr()