|
-
Dec 5th, 1999, 07:09 AM
#1
Thread Starter
Junior Member
I have a resource file that contains two files, but i dont know how to run them, they are both "custom" and labeled 101 and 102. Any help is appreciated.
-
Dec 5th, 1999, 08:55 AM
#2
Guru
What type of files are stored in the resource file?
-
Dec 5th, 1999, 09:04 AM
#3
If it turns out that the res file contains strings, here is a routine you can use to get at them.
Code:
Function ResolveResString(ByVal resID As Integer, ParamArray vReplacements() As Variant) As String
'-----------------------------------------------------------
' FUNCTION: ResolveResString
' Reads resource and replaces given macros with given values
'
' Example, given a resource number 14:
' "Could not read '|1' in drive |2"
' The call
' ResolveResString(14, "|1", "TXTFILE.TXT", "|2", "A:")
' would return the string
' "Could not read 'TXTFILE.TXT' in drive A:"
'
' IN: [resID] - resource identifier
' [vReplacements] - pairs of macro/replacement value
'-----------------------------------------------------------
'
Dim nMacro As Integer
Dim sResString As String
sResString = LoadResString(resID)
' For each macro/value pair passed in...
For nMacro = LBound(vReplacements) To UBound(vReplacements) Step 2
Dim sMacro As String
Dim sValue As String
sMacro = vReplacements(nMacro)
On Error GoTo MismatchedPairs
sValue = vReplacements(nMacro + 1)
On Error GoTo 0
' Replace all occurrences of sMacro with sValue
Dim nPos As Integer
Do
nPos = InStr(sResString, sMacro)
If nPos > 0 Then
sResString = Left$(sResString, nPos - 1) & sValue & Right$(sResString, Len(sResString) - Len(sMacro) - nPos + 1)
End If
Loop Until nPos = 0
Next nMacro
ResolveResString = sResString
Exit Function
MismatchedPairs:
Resume Next
End Function
It allows the strings to have replaceable parameters. The following calls the above routine with a variable named resINTEGNOTFOUND (which could have a value of 101). In this case the string has 3 replaceable parameters.
Code:
MsgBox ResolveResString(resINTEGNOTFOUND, "|1", "Desired", "|2", gsDefIntegType1, "|3", sFirstIntegType), gnStyle, gsTitle
------------------
Marty
-
Dec 5th, 1999, 09:59 AM
#4
Thread Starter
Junior Member
-
Dec 5th, 1999, 10:02 AM
#5
Thread Starter
Junior Member
I have no idea what that means Martin Liss
-
Dec 5th, 1999, 07:05 PM
#6
Check out the Previous Post
------------------
Serge
Software Developer
[email protected]
[email protected]
ICQ#: 51055819
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|