|
| LSET Upgrade |
|
|
|
|
| Messages |
|
Related Types |
This message was discovered on microsoft.public.dotnet.languages.vb.upgrade.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
| Tracy Walton |
Has anyone successfully been able to replicate the LSET statement from VB into the .NET environment? I am trying to modify some legacy code that uses the statement but am having difficulty coming up with a workable replacement... Thanks
|
|
|
| |
|
| |
| |
| Herfried K. Wagner [MVP] (VIP) |
* "Tracy Walton" <Click here to reveal e-mail address> scripsit: [Original message clipped]
"Post code."
-- Herfried K. Wagner [MVP] <http://www.mvps.org/dotnet>
|
|
|
| |
|
|
| |
| |
| Tracy Walton |
'Some private types used to do bit hammering in a language 'that doesn't support bit hammering. Public Type DoubleInteger LowInt As Integer HiInt As Integer End Type
Public Type SingleLong FullLong As Long End Type
'Constant to fish out various bits. Public Const WarningMask As Integer = &H800 Public Const FacilityMask As Integer = &H7FF
Public Function IsWin32Code(ByVal ErrorNumber As Long) As Boolean
'This function tests if the error returned came originally from Win32. It returns True 'if the origin of the error was a Win32 function call.
Dim DI As DoubleInteger Dim SL As SingleLong SL.FullLong = ErrorNumber LSet DI = SL
If (DI.HiInt And FacilityMask) = FC_Win32Error Then IsWin32Code = True Else IsWin32Code = False End If
End Function
*** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
|
|
|
| |
|
|
| |
|
|
| |
| Tracy Walton |
'Some private types used to do bit hammering in a language 'that doesn't support bit hammering. Public Type DoubleInteger LowInt As Integer HiInt As Integer End Type
Public Type SingleLong FullLong As Long End Type
'Constant to fish out various bits. Public Const WarningMask As Integer = &H800 Public Const FacilityMask As Integer = &H7FF
Public Function IsWin32Code(ByVal ErrorNumber As Long) As Boolean
'This function tests if the error returned came originally from Win32. It returns True 'if the origin of the error was a Win32 function call.
Dim DI As DoubleInteger Dim SL As SingleLong SL.FullLong = ErrorNumber LSet DI = SL
If (DI.HiInt And FacilityMask) = FC_Win32Error Then IsWin32Code = True Else IsWin32Code = False End If
End Function
*** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
|
|
|
| |
|
| |
| |
| Paul Clement |
On Tue, 13 Jan 2004 04:36:58 -0800, Tracy Walton <Click here to reveal e-mail address> wrote:
¤ ¤ 'Some private types used to do bit hammering in a language ¤ 'that doesn't support bit hammering. ¤ Public Type DoubleInteger ¤ LowInt As Integer ¤ HiInt As Integer ¤ End Type ¤ ¤ Public Type SingleLong ¤ FullLong As Long ¤ End Type ¤ ¤ 'Constant to fish out various bits. ¤ Public Const WarningMask As Integer = &H800 ¤ Public Const FacilityMask As Integer = &H7FF ¤ ¤ Public Function IsWin32Code(ByVal ErrorNumber As Long) As Boolean ¤ ¤ 'This function tests if the error returned came originally from ¤ Win32. It returns True ¤ 'if the origin of the error was a Win32 function call. ¤ ¤ ¤ Dim DI As DoubleInteger ¤ Dim SL As SingleLong ¤ SL.FullLong = ErrorNumber ¤ LSet DI = SL ¤ ¤ If (DI.HiInt And FacilityMask) = FC_Win32Error Then ¤ IsWin32Code = True ¤ Else ¤ IsWin32Code = False ¤ End If ¤ ¤ End Function
Here's a function that can split the high and low values of a 32-bit integer:
Public Sub SplitInt(ByVal Int32Val As Int32)
Dim ByteBuffer(3) As Byte Dim LoWord As Int16 Dim HiWord As Int16
ByteBuffer = System.BitConverter.GetBytes(Int32Val) LoWord = System.BitConverter.ToInt16(ByteBuffer, 0) HiWord = System.BitConverter.ToInt16(ByteBuffer, 2)
End Sub
Paul ~~~ Click here to reveal e-mail address Microsoft MVP (Visual Basic)
|
|
|
| |
|
| |
|
|
| |
| Paul Clement |
On Mon, 12 Jan 2004 05:29:21 -0800, "Tracy Walton" <Click here to reveal e-mail address> wrote:
¤ Has anyone successfully been able to replicate the LSET ¤ statement from VB into the .NET environment? I am trying ¤ to modify some legacy code that uses the statement but am ¤ having difficulty coming up with a workable replacement...
Could you provide an example of your LSET code?
Paul ~~~ Click here to reveal e-mail address Microsoft MVP (Visual Basic)
|
|
|
| |
|
|
| |
|
|
|
|
|
|
|
|
BootFX
Reliable and powerful .NET application framework. |
|
|
|
|
|
|