Platforms to show: All Mac Windows Linux Cross-Platform
Required plugins for this example: MBS Util Plugin, MBS Win Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Win/DNS Query on Windows
This example is the version from Sun, 17th Mar 2012.
Project "DNS Query on Windows.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
EventHandler Sub ExpandRow(row As Integer)
dim v as Variant = me.RowTag(row)
dim s as string
if v isa WindowsDNSRecordMBS then
dim w as WindowsDNSRecordMBS = WindowsDNSRecordMBS(v)
List.AddRow "Name: "+w.Name
List.AddRow "Type: "+str(w.type)
List.AddRow "DataLength: "+str(w.DataLength)
Select case w.Section
case WindowsDNSRecordMBS.kSectionQuestion
s = " = SectionQuestion"
case WindowsDNSRecordMBS.kSectionAnswer
s = " = SectionAnswer"
case WindowsDNSRecordMBS.kSectionAuthority
s = " = SectionAuthority"
case WindowsDNSRecordMBS.kSectionAddtional
s = " = SectionAddtional"
else
s = ""
end Select
List.AddRow "Section: "+str(w.Section)+s
Select case w.Section
case WindowsDNSRecordMBS.kCharSetUnknown
s = " = CharSetUnknown"
case WindowsDNSRecordMBS.kCharSetUnicode
s = " = CharSetUnicode"
case WindowsDNSRecordMBS.kCharSetUtf8
s = " = CharSetUtf8"
case WindowsDNSRecordMBS.kCharSetAnsi
s = " = CharSetAnsi"
else
s = ""
end Select
List.AddRow "CharSet: "+str(w.CharSet)+s
add w.A
add w.AAAA
add w.SOA
add w.NS
add w.CNAME
add w.MB
add w.MD
add w.MF
add w.MG
add w.MR
add w.MINFO
add w.RP
add w.MX
add w.AFSDB
add w.RT
add w.HINFO
add w.ISDN
add w.TXT
add w.X25
add w.Null
end if
End EventHandler
End Control
Control EditField1 Inherits TextField
ControlInstance EditField1 Inherits TextField
End Control
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action()
run
End EventHandler
End Control
Sub Add(r as WindowsDNSRecordAAAAMBS)
if r<>Nil then
List.AddRow "Address",r.Address
end if
End Sub
Sub Add(r as WindowsDNSRecordAMBS)
if r<>Nil then
List.AddRow "Address",r.Address
end if
End Sub
Sub Add(w as WindowsDNSRecordMBS)
if w<>Nil then
List.AddFolder GetTypeName(w.Type)
List.RowTag(List.LastIndex)=w
List.Expanded(List.LastIndex)=true
end if
End Sub
Sub Add(r as WindowsDNSRecordMInfoMBS)
if r<>Nil then
List.AddRow "NameMailbox",r.NameMailbox
List.AddRow "NameErrorsMailbox",r.NameErrorsMailbox
end if
End Sub
Sub Add(r as WindowsDNSRecordMXMBS)
if r<>Nil then
List.AddRow "NameExchange",r.NameExchange
List.AddRow "Preference",str(r.Preference)
end if
End Sub
Sub Add(r as WindowsDNSRecordNullMBS)
if r<>Nil then
List.AddRow "ByteCount",str(r.ByteCount)
List.AddRow "Data", ReplaceNonPrintableCharactersMBS(r.Data,asc("."))
end if
End Sub
Sub Add(r as WindowsDNSRecordPTRMBS)
if r<>Nil then
List.AddRow "NameHost",r.NameHost
end if
End Sub
Sub Add(r as WindowsDNSRecordSOAMBS)
if r<>Nil then
List.AddRow "NamePrimaryServer", r.NamePrimaryServer
List.AddRow "NameAdministrator", r.NameAdministrator
List.AddRow "SerialNo", str(r.SerialNo)
List.AddRow "Refresh", str(r.Refresh)
List.AddRow "Retry", str(r.Retry)
List.AddRow "Expire", str(r.Expire)
List.AddRow "DefaultTTL", str(r.DefaultTTL)
end if
End Sub
Sub Add(r as WindowsDNSRecordTXTMBS)
if r<>Nil then
List.AddRow "StringCount", STR(r.StringCount)
dim a() as string = r.Strings
dim c as integer = r.StringCount-1
for i as integer = 0 to c
List.AddRow "String("+str(i)+")", a(i)
next
end if
End Sub
Function GetTypeName(n as integer) As string
Select case n
case WindowsDNSRecordMBS.kDNSTypeA
return "A"
case WindowsDNSRecordMBS.kDNSTypeNS
return "NS"
case WindowsDNSRecordMBS.kDNSTypeMD
return "MD"
case WindowsDNSRecordMBS.kDNSTypeMF
return "MF"
case WindowsDNSRecordMBS.kDNSTypeCNAME
return "CNAME"
case WindowsDNSRecordMBS.kDNSTypeSOA
return "SOA"
case WindowsDNSRecordMBS.kDNSTypeMB
return "MB"
case WindowsDNSRecordMBS.kDNSTypeMG
return "MG"
case WindowsDNSRecordMBS.kDNSTypeMR
return "MR"
case WindowsDNSRecordMBS.kDNSTypeNULL
return "NULL"
case WindowsDNSRecordMBS.kDNSTypeWKS
return "WKS"
case WindowsDNSRecordMBS.kDNSTypePTR
return "PTR"
case WindowsDNSRecordMBS.kDNSTypeHINFO
return "HINFO"
case WindowsDNSRecordMBS.kDNSTypeMINFO
return "MINFO"
case WindowsDNSRecordMBS.kDNSTypeMX
return "MX"
case WindowsDNSRecordMBS.kDNSTypeTEXT
return "TEXT"
// RFC 1183
case WindowsDNSRecordMBS.kDNSTypeRP
return "RP"
case WindowsDNSRecordMBS.kDNSTypeAFSDB
return "AFSDB"
case WindowsDNSRecordMBS.kDNSTypeX25
return "X25"
case WindowsDNSRecordMBS.kDNSTypeISDN
return "ISDN"
case WindowsDNSRecordMBS.kDNSTypeRT
return "RT"
// RFC 1348
case WindowsDNSRecordMBS.kDNSTypeNSAP
return "NSAP"
case WindowsDNSRecordMBS.kDNSTypeNSAPPTR
return "NSAPPTR"
// RFC 2065 (DNS security)
case WindowsDNSRecordMBS.kDNSTypeSIG
return "SIG"
case WindowsDNSRecordMBS.kDNSTypeKEY
return "KEY"
// RFC 1664 (X.400 mail)
case WindowsDNSRecordMBS.kDNSTypePX
return "PX"
// RFC 1712 (Geographic position)
case WindowsDNSRecordMBS.kDNSTypeGPOS
return "GPOS"
// RFC 1886 (IPv6 Address)
case WindowsDNSRecordMBS.kDNSTypeAAAA
return "AAAA"
// RFC 1876 (Geographic location)
case WindowsDNSRecordMBS.kDNSTypeLOC
return "LOC"
// RFC 2065 (Secure negative response)
case WindowsDNSRecordMBS.kDNSTypeNXT
return "NXT"
// RFC 2052 (Service location)
case WindowsDNSRecordMBS.kDNSTypeSRV
return "SRV"
// ATM Standard something-or-another
case WindowsDNSRecordMBS.kDNSTypeATMA
return "ATMA"
//
// Query only types (1035, 1995)
//
case WindowsDNSRecordMBS.kDNSTypeTKEY
return "TKEY"
case WindowsDNSRecordMBS.kDNSTypeTSIG
return "TSIG"
case WindowsDNSRecordMBS.kDNSTypeIXFR
return "IXFR"
case WindowsDNSRecordMBS.kDNSTypeAXFR
return "AXFR"
case WindowsDNSRecordMBS.kDNSTypeMAILB
return "MAILB"
case WindowsDNSRecordMBS.kDNSTypeMAILA
return "MAILA"
case WindowsDNSRecordMBS.kDNSTypeALL
return "ALL"
case WindowsDNSRecordMBS.kDNSTypeANY
return "ANY"
//
// Temp Microsoft types -- use until get IANA approval for real type
//
case WindowsDNSRecordMBS.kDNSTypeWINS
return "WINS"
case WindowsDNSRecordMBS.kDNSTypeWINSR
return "WINSR"
case WindowsDNSRecordMBS.kDNSTypeNBSTAT
return "NBSTAT"
else
Return str(n)
end Select
End Function
Sub run()
List.DeleteAllRows
dim w as WindowsDNSRecordMBS = WindowsDNSRecordMBS.Query(EditField1.text, WindowsDNSRecordMBS.kDNSTypeALL, WindowsDNSRecordMBS.kDNSQueryStandard)
if w<>Nil then
Add w
while w.NextRecord<>Nil
w = w.NextRecord
add w
wend
else
beep
end if
End Sub
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
Module Util
Sub AddRow(extends l as listbox, s as string, n as string)
l.AddRow s
l.Cell(l.LastIndex,1)=n
End Sub
End Module
End Project
The items on this page are in the following plugins: MBS Win Plugin.