|
-
Feb 8th, 2002, 11:55 AM
#1
Thread Starter
Lively Member
how to make a change in a dll?
I don't know how to explain this well so I'll state the situation.
I want a variable that's changeable within a dll from another program. Meaning say their is a variable called LIVESERVER*string, how can I set (in any way) what populates that variable? The reason is I want a fail safe on the dll that if one server doesn't work, it access the other server, however I won't always know that other server name. I tried using registry changes or simple ascii files but I might have soomething wrong but nothing works.
Basically from a DLL if I could access a resgitry key for a server name to access that could work because a 'monitor' program will set that value depending on what is the better server.
got I hope that makes sense
-
Feb 8th, 2002, 12:22 PM
#2
you could make a property or public variable in the class that you can change. Problem is..will this dll be accessed my more than one exe? If so, only the exe that set that new value can read that new value from the instance it creates. The others would only see the default value since you generally cannot use GetObject with VB dll's. There is a workaround, but it may just be easier to set a registry entry, ini file entry, or xml file entry with the active server name that can them be read from the file by the dll.
-
Feb 8th, 2002, 12:56 PM
#3
Thread Starter
Lively Member
Well it gets better.. the dll will be access by IIS5 on 2000AdvServ
I tried getting something from the registry and it didn't work. When I try opening a ini file that does work but I was cheap and used open .. should I try the FileScript Obj?
-
Feb 8th, 2002, 01:10 PM
#4
i would suggest xml
make a file called server.xml..put this in it
Code:
<active>
<servername>Put servername here</servername>
</active>
access it is VB like this
this is assuming the msxml component is on ther server..Add a reference to Microsoft XML
this to get the value
Code:
Dim xmlDoc As MSXML.DOMDocument
Dim xmlRoot As MSXML.IXMLDOMNode
Dim strServer As String
' Populate General Tab from XML
Set xmlDoc = New MSXML.DOMDocument
xmlDoc.async = False
xmlDoc.Load App.Path & "\server.xml"
Set xmlRoot = xmlDoc.selectSingleNode("active")
strServer= xmlRoot.selectSingleNode("serverName").Text
now to change that value
Code:
Dim xmlDoc As MSXML.DOMDocument
Dim xmlRoot As MSXML.IXMLDOMNode
Dim strServer As String
' Populate General Tab from XML
Set xmlDoc = New MSXML.DOMDocument
xmlDoc.async = False
xmlDoc.Load App.Path & "\server.xml"
Set xmlRoot = xmlDoc.selectSingleNode("active")
xmlRoot.selectSingleNode("serverName").Text = "whatever"
xmlDoc.save app.path & "\server.xml"
that is how i would do it.
-
Feb 8th, 2002, 01:12 PM
#5
Thread Starter
Lively Member
what would the app path be for a iisdll? the diretory it's registerd?
-
Feb 8th, 2002, 01:13 PM
#6
it should be wherever to dll is located, so keep the xml file in the same directory...
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
|