Category : Files from Magazines
Archive   : WDMAY92.ZIP
Filename : 3N05041A

 
Output of file : 3N05041A contained in archive : WDMAY92.ZIP
' DLL parameter test program
' Copyright (c) 1992, by Desaware
' All rights reserved
'
'
' This program is used to test the dllparam.dll dynamic
' link library.

' Passing singles by value and returning singles
Sub TestSingleByval_Click ()
f! = ReceivesSingle(1.59)
End Sub

' Passing longs by value and returning longs
Sub TestLongByval_Click ()
y& = ReceivesLong(6)
End Sub

' Passing doubles by value and returning doubles
Sub TestDoubleByval_Click ()
d# = ReceivesDouble(3.145)
End Sub

' Passing integers by reference
Sub TestIntByref_Click ()
x% = 5
Add5ToInteger x%
MsgBox Str$(x%), 0, "Add5ToInteger"
End Sub

' Passing longs by reference
Sub TestLongByref_Click ()
y& = 6
Add5ToLong y&
MsgBox Str$(y&), 0, "Add5ToLong"

End Sub

' Passing singles by reference
Sub TestSingleByref_Click ()
f! = 1.59
Add5ToSingle f!
MsgBox Str$(f!), 0, "Add5ToSingle"

End Sub

' Passing doubles by reference
Sub TestDoubleByref_Click ()

d# = 3.145
Add5ToDouble d#
MsgBox Str$(d#), 0, "Add5ToDouble"

End Sub

' Passing strings (null terminated)
' Always by reference
Sub TestString_Click ()
ReceivesString "Hello"
End Sub

' Passing and modifying strings (null terminated)
' Always by reference
Sub TestStringChange_Click ()
' Null terminated string is passed to the routine
' x$ must be preinitialized to the maximum length.
' The DLL may change the contents of the string, but
' must never go past the null terminator
x$ = "Hello"
ChangesString x$
MsgBox x$, 0, "ChangesString"
End Sub

' Passing controls and forms as parameters
Sub TestControl_Click ()
hctl% = GetControlHwnd(TestControl)
hfrm% = GetFormHwnd(dllparam)
MsgBox "This control hwnd is " + Str$(hctl%) + ", the form hwnd is " + Str$(hfrm%), 0, "Get Hwnds"
End Sub

' Passing Visual Basic strings
Sub TestVBString_Click ()
ReceivesVBString "String to DLL"
End Sub

' Passing and modifying Visual Basic strings
' Note - no length restrictions apply
Sub TestVBStringChange_Click ()
a$ = "Short"
ChangesVBString a$
MsgBox a$, 0, "ChangesVBString"
End Sub

' A DLL function returning a Visual Basic String
Sub ReturnVBString_Click ()
a$ = ReturnsVBString()
MsgBox a$, 0, "ReturnsVBString"
End Sub

' Passing user defined types
' Always by reference
Sub TestUserType_Click ()
Dim u As usertype
u.a = 1
u.b = 2
u.c = 3
u.d = 4
' Note - this is call by reference, the DLL can change
' the value of u
ReceivesUserType u
End Sub

' Passing currency by value and returning currency
Sub TestCurrencyByval_Click ()
Dim c@
c = 1.2345
c = ReceivesCurrency(c)
End Sub

' Passing currency by reference
Sub TestCurrencyByref_Click ()
Dim c@
c@ = 1.23
AddPennyToCurrency c@
MsgBox Str$(c@), 0, "AddPennyToCurrency"
End Sub

' Passing integers by value and returning integers
Sub TestIntByval_Click ()
x% = ReceivesInteger(5)
End Sub

' This is a test of passing a pointer to a numeric array
' Note the unique DLL call
'
Sub ReceivesIntArray_Click ()
ReDim x(4) As Integer
x(0) = 1
x(1) = 3
x(2) = 9
x(3) = 81
' Pass a pointer to the first element of the array.
' The DLL has no way of knowing how long the array is
' unless you define a length parameter for the function.
ReceivesIntArray x(0)
End Sub

' Show how to access strings inside user defined types
Sub TestAddUserString_Click ()
Dim u As usertype
' Note - this is call by reference, the DLL can change
' the value of u
u.s = "orignal string"
AddUserString u
MsgBox u.s, 0, "String in usertype changed"

End Sub



  3 Responses to “Category : Files from Magazines
Archive   : WDMAY92.ZIP
Filename : 3N05041A

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/