Blake81
Well-known member
I've tried to write a DLL with VB and now I just need to double check that it's written properly. I'd like to use this DLL in a mIRC script where I would give it a string (zip code) and it would return the weather for that zip. You don't need to check all the lines dealing with the XML. I've used those lines successfully in another Windows application I made. I just need to make sure that this is set up correctly to put that information into a variable and return a value. Here's the code
I also need to ask how to use this dll. The mIRC help says the syntax is:
$dll(filename, procname, data)
What is procname in this case or how do I find it? I tried using the GUID, but that didn't work. Thanks for any help. I tried using regsvr32 to register the dll and got a message saying that it was loaded, but "the DllRegisterServer entry point was not found. This file can not be registered."
VB.NET:
[SIZE=2][COLOR=#0000ff]Imports[/COLOR][/SIZE][SIZE=2] System.Xml
[/SIZE][SIZE=2][COLOR=#0000ff]Public[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Class[/COLOR][/SIZE][SIZE=2] Class1
[/SIZE][SIZE=2][COLOR=#0000ff]Public[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Function[/COLOR][/SIZE][SIZE=2] GetWeather([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] zip [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE][SIZE=2])
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] retzip [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE][SIZE=2] = [/SIZE][SIZE=2][COLOR=#800000]""
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] xmldocument [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] System.Xml.XmlDocument
xmldocument = [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] System.Xml.XmlDocument
xmldocument.Load([/SIZE][SIZE=2][COLOR=#800000]"http://xoap.weather.com/weather/local/"[/COLOR][/SIZE][SIZE=2] + zip + [/SIZE][SIZE=2][COLOR=#800000]"?cc=*&dayf=5&prod=xoap&par=1017300893&key=268086eb4218acff"[/COLOR][/SIZE][SIZE=2])
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] Xnodes [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.Xml.XmlNodeList
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] Xnode [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.Xml.XmlNode
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] Xname [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]String
[/COLOR][/SIZE][SIZE=2]Xname = xmldocument.SelectSingleNode([/SIZE][SIZE=2][COLOR=#800000]"/weather/loc/dnam"[/COLOR][/SIZE][SIZE=2]).InnerText
Xnode = xmldocument.SelectSingleNode([/SIZE][SIZE=2][COLOR=#800000]"/weather/cc"[/COLOR][/SIZE][SIZE=2])
Xnodes = Xnode.ChildNodes
[/SIZE][SIZE=2][COLOR=#0000ff]For[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Each[/COLOR][/SIZE][SIZE=2] Xnode [/SIZE][SIZE=2][COLOR=#0000ff]In[/COLOR][/SIZE][SIZE=2] Xnodes
[/SIZE][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=2] Xnode.Name = [/SIZE][SIZE=2][COLOR=#800000]"tmp"[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][SIZE=2]retzip = retzip + Xnode.InnerText + [/SIZE][SIZE=2][COLOR=#800000]" "
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]ElseIf[/COLOR][/SIZE][SIZE=2] Xnode.Name = [/SIZE][SIZE=2][COLOR=#800000]"flik"[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][SIZE=2]retzip = retzip + [/SIZE][SIZE=2][COLOR=#800000]"Feels Like: "[/COLOR][/SIZE][SIZE=2] + Xnode.InnerText() + [/SIZE][SIZE=2][COLOR=#800000]" "
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]ElseIf[/COLOR][/SIZE][SIZE=2] Xnode.Name = [/SIZE][SIZE=2][COLOR=#800000]"t"[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][SIZE=2]retzip = retzip + Xnode.InnerText()
[/SIZE][SIZE=2][COLOR=#0000ff]ElseIf[/COLOR][/SIZE][SIZE=2] Xnode.Name = [/SIZE][SIZE=2][COLOR=#800000]"wind"[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] XWindList [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.Xml.XmlNodeList
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] Xwind [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.Xml.XmlNode
Xwind = Xnode.SelectSingleNode([/SIZE][SIZE=2][COLOR=#800000]"/weather/cc/wind"[/COLOR][/SIZE][SIZE=2])
XWindList = Xwind.ChildNodes
[/SIZE][SIZE=2][COLOR=#008000]'Dim Windstring As String = Nothing
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] WindGust [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]String
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] WindSpeed [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]String
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]For[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Each[/COLOR][/SIZE][SIZE=2] Xwind [/SIZE][SIZE=2][COLOR=#0000ff]In[/COLOR][/SIZE][SIZE=2] XWindList
[/SIZE][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=2] Xwind.Name = [/SIZE][SIZE=2][COLOR=#800000]"t"[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] WindDir [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE][SIZE=2] = [/SIZE][SIZE=2][COLOR=#800000]"Wind: From "[/COLOR][/SIZE][SIZE=2] + Xwind.InnerText
[/SIZE][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=2] WindGust = [/SIZE][SIZE=2][COLOR=#800000]"N/A"[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][SIZE=2]retzip = retzip + WindDir + WindSpeed + [/SIZE][SIZE=2][COLOR=#800000]" "
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Else
[/COLOR][/SIZE][SIZE=2]retzip = retzip + WindDir + WindSpeed + [/SIZE][SIZE=2][COLOR=#800000]" Gusting to "[/COLOR][/SIZE][SIZE=2] + WindGust + [/SIZE][SIZE=2][COLOR=#800000]" MPH"
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]If
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]ElseIf[/COLOR][/SIZE][SIZE=2] Xwind.Name = [/SIZE][SIZE=2][COLOR=#800000]"s"[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][SIZE=2]WindSpeed = [/SIZE][SIZE=2][COLOR=#800000]" at "[/COLOR][/SIZE][SIZE=2] + Xwind.InnerText + [/SIZE][SIZE=2][COLOR=#800000]" MPH"
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]ElseIf[/COLOR][/SIZE][SIZE=2] Xwind.Name = [/SIZE][SIZE=2][COLOR=#800000]"gust"[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][SIZE=2]WindGust = Xwind.InnerText
[/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]If
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Next
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]If
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Next
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Return[/COLOR][/SIZE][SIZE=2] retzip
[/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Function
End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Class
[/COLOR][/SIZE]
I also need to ask how to use this dll. The mIRC help says the syntax is:
$dll(filename, procname, data)
What is procname in this case or how do I find it? I tried using the GUID, but that didn't work. Thanks for any help. I tried using regsvr32 to register the dll and got a message saying that it was loaded, but "the DllRegisterServer entry point was not found. This file can not be registered."
Last edited: