/Visual Studio 2008/VBRemotingSharedLibrary/ClientActivatedObject.vb
Visual Basic | 73 lines | 23 code | 11 blank | 39 comment | 0 complexity | de20d28746ff6f04ebb1b1c475d9f890 MD5 | raw file
1'****************************** Module Header ******************************' 2' Module Name: ClientActivatedObject.vb 3' Project: VBRemotingSharedLibrary 4' Copyright (c) Microsoft Corporation. 5' 6' ClientActivatedObject.vb defines a client-activated type for .NET Remoting. 7' Client-activated objects are created by the server and their lifetime is 8' managed by the client. In contrast to server-activated objects, client- 9' activated objects are created as soon as the client calls "new" or any 10' other object creation methods. Client-activated objects are specific to the 11' client, and objects are not shared among different clients; object instance 12' exists until the lease expires or the client destroys the object. 13' 14' This source is subject to the Microsoft Public License. 15' See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL. 16' All other rights reserved. 17' 18' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, 19' EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED 20' WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 21'***************************************************************************' 22 23Imports System.Runtime.InteropServices 24 25 26''' <summary> 27''' A client-activated type for .NET Remoting. 28''' </summary> 29Public Class ClientActivatedObject 30 Inherits MarshalByRefObject 31 32 ''' <summary> 33 ''' A float property. 34 ''' </summary> 35 Public Property FloatProperty() As Single 36 Get 37 Return fField 38 End Get 39 Set(ByVal value As Single) 40 fField = value 41 End Set 42 End Property 43 44 Private fField As Single 45 46 47 ''' <summary> 48 ''' Get the type of the remote object. 49 ''' </summary> 50 Public Overridable Function GetRemoteObjectType() As String 51 Return "ClientActivatedObject" 52 End Function 53 54 55 ''' <summary> 56 ''' Get the current process ID and thread ID. 57 ''' </summary> 58 ''' <param name="processId">current process ID</param> 59 ''' <param name="threadId">current thread ID</param> 60 ''' <remarks></remarks> 61 Public Sub GetProcessThreadID(<Out()> ByRef processId As UInt32, <Out()> ByRef threadId As UInt32) 62 processId = Process.GetCurrentProcess.Id 63 threadId = GetCurrentThreadId() 64 End Sub 65 66 ''' <summary> 67 ''' Get the current thread ID. 68 ''' </summary> 69 <DllImport("kernel32.dll")> _ 70 Friend Shared Function GetCurrentThreadId() As UInt32 71 End Function 72 73End Class