|
Visual Basic (VB and VBA) |
|
Copyright 1999-2001 Christopher Greaves. All rights reserved. Home Page and email to [email protected] |
| If in doubt, record a macro and inspect the entrails! |
Please read the DISCLAIMER.
Here is an INDEX to all the procedures.
You will probably need one copy of my GLOBAL DECLARATIONS.
Public Function strPPA(strKeyName As String, strValue As String) As String
' Procedure : strPPA
' Description: This code sets a parameter in an INI file.
' Copyright: Chris Greaves Inc.
' Inputs: A file§ion name, a key name, a value (may be null), a file name.
' Returns: STRING value of the parameter before it was replaced.
' Assumes: Nothing
' Side Effects: None.
' Tested: By the calls shown below.
' Transient variable used by the internal function.
Dim strReturnedString As String
Dim nSize As Long
' Build a suitable file name based on the applications 5-character identifier.
Dim strFileName As String
strFileName = strGetEnvironmentFileName(strcApplication)
' Return the previous value, if it exists.
Call GetLargePrivateProfileString(strcApplication, strKeyName, "", strReturnedString, nSize, strFileName)
strPPA = strReturnedString
Call WriteLargePrivateProfileString(strcApplication, strKeyName, strValue, strFileName)
'Sub TESTstrPPA()
'MsgBox strGPA("pdf8", "")
'MsgBox strPPA("pdf8", "alpha")
'MsgBox strGPA("pdf8", "")
'MsgBox strPPA("pdf8", "beta")
'MsgBox strGPA("pdf8", "")
'MsgBox strPPA("pdf9", String$(254, "0") & "here is an appendage beyond the 254-character limit")
'MsgBox strGPA("pdf9", "")
'End Sub
'Sub TEST2strPPA()
'Dim int1 As Integer
'MsgBox strPPA("pdf1", "beta")
'' at this point the file looks OK
'int1 = FreeFile
'If int1 <> 1 Then
' MsgBox int1
'End If
'MsgBox strPPA("pdf1", "alpha")
'' at this point the file is corrupt
'int1 = FreeFile
'If int1 <> 1 Then
' MsgBox int1
'End If
'MsgBox strPPA("pdf2", "beta")
'int1 = FreeFile
'If int1 <> 1 Then
' MsgBox int1
'End If
'End Sub
End Function
| We all knew nothing when we started … |
|
Home Page and Contact Information Send email to [email protected]. This page was last updated Thursday, November 15, 2001 |