Skip to main content

 
developerWorks
AIX and UNIX
Information Mgmt
Lotus
New to Lotus
Products
How to buy
Downloads
Live demos
Technical library
Training
Support
Forums & community
Events
Rational
Tivoli
WebSphere
Architecture
Java™ technology
Linux
Multicore acceleration
Open source
SOA and Web services
Web development
XML
My developerWorks
About dW
Submit content
Feedback


developerWorks  >  Lotus  >  Forums & community  >  Notes/Domino 4 and 5 Forum

Notes/Domino 4 and 5 Forum

developerWorks

  

Sign in to participate

RE: How to get a list of servers without accessing names.nsf?
Cath Dwyer 20.Sep.02 04:21 AM a Web browser
Lotus Tools -- C++ API All Releases All Platforms


I can't claim credit for this. I think I got it from this forum

Call it like this :-

ServerList=GetServerList()

which returns an array

Paste all below into declarations

Declare Function NSGetServerList% Lib "nnotes" (Byval dwPortName&, nRetServerTextList%)
Declare Function ListGetText% Lib "nnotes" (Byval dwList&, Byval nPrefixDataType%, Byval nEntryNumber%, dwRetTextPointer&, nRetTextLength%)
Declare Function OSTranslate% Lib "nnotes" (Byval nTranslateMode%, Byval dwIn&, Byval nLength%, Byval lpszOut$, Byval nOutLength%)
Declare Function OSLockObject& Lib "nnotes" (Byval nHandle%)
Declare Function OSUnlockObject% Lib "nnotes" (Byval nHandle%)
Declare Function OSMemFree% Lib "nnotes" (Byval nHandle%)

Const OS_TRANSLATE_LMBCS_TO_NATIVE = 1
Const MAX_SERVER_NAME = 256


Function GetServerList() As Variant
Dim lpszServer$
Dim szArray() As String
Dim hList%, nStatus%, nCount%, nLength%
Dim dwList&, dwHold&

' get a list of known servers on all ports
nStatus%=NSGetServerList(0, hList%)

' be sure our API call returned a handle to our list buffer
If nStatus%=0 And hList% <> 0 Then
' initialize our results array
Redim szArray(0)

' lock down our memory handle
dwList&=OSLockObject(hList%)

Do While nStatus%=0
' get a server in the list
nStatus%=ListGetText(dwList&, 0, nCount%, dwHold&, nLength%)

If nStatus%=0 And nLength%>0 Then
' intialize the string to pass to the API
lpszServer$=Space$(nLength%)

' translate the results to the native charset
Call OSTranslate(OS_TRANSLATE_LMBCS_TO_NATIVE, dwHold&, nLength%, lpszServer$, MAX_SERVER_NAME)

'populate an array with the results
Redim Preserve szArray(nCount)
szArray(nCount)=lpszServer$
End If

nCount=nCount+1

Loop

' free our lock on the list
Call OSUnlockObject(hList%)

' free the handle allocated by NSGetServerList
Call OSMemFree(hList%)

End If

' return results to caller
GetServerList=szArray

End Function



How to get a list of servers withou... (Mauro De 20.Sep.02)
. . RE: How to get a list of servers wi... (Cath Dwyer 20.Sep.02)



Lotus Software


  Document options
Print this pagePrint this page

 Search this forum

  Forum views and search
Date (threaded)
Date (flat)
With excerpt
Author
Category
Platform
Release
Advanced search

 Sign In or Register
Sign in
Forgot your password?
Forgot your user name?
Create new registration

 RSS feedsRSS
All forum posts RSS
All main topics RSS
More Lotus RSS feeds

 Resources
Forum use and etiquette
Native Notes Access
Sandbox
Web site Feedback

  Lotus Support
Lotus Support
Product support pages index
Search knowledge base (Technotes)
Search support downloads
Lotus Support RSS

 Wikis
IBM accelerators
IBM Composite Applications
IBM Mashup Center
Lotus Connections
Lotus Domino
Lotus Domino Designer
Lotus Expeditor
Lotus Forms
Lotus Foundations
Lotus iNotes
Lotus Mobile Connect
Lotus Notes
Lotus Notes Traveler
Lotus Quickr
Lotus Sametime
Lotus Symphony
Lotus Web Content Management
Lotus Workforce Management
WebSphere Dashboard Framework
WebSphere Portal
WebSphere Portlet Factory

 Lotus Forums
Notes/Domino 8.5
Notes/Domino 8
Notes/Domino 6 and 7
Notes/Domino 4 and 5
Lotus ActiveInsight
Lotus Component Designer
Lotus Connections
Lotus Domino Document Manager
Lotus e-learning
Lotus Enterprise Integration
Lotus Expeditor
Lotus Forms
Lotus Labs
Lotus Mobile Connect
Lotus Quickr
Lotus Sametime
Lotus Sametime Unyte Events
Lotus Sametime Unyte Meeting
Lotus Sametime Unyte Share
Lotus SmartSuite
Lotus Symphony
Lotus Web Content Management
Lotus Widget Factory
Lotus Workflow