Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: Name of PDC in a given domain


Message #1 by "svdkooij" <svdkooij@c...> on Mon, 23 Jul 2001 12:46:17
Hi

On vb2themaxx i found a great piece of code to find out what the pdc is:

  http://www.vb2themax.com/Item.asp?PageID=CodeBank&ID=197

Since my application runs in a single master domain with a couple of 
resource domains I need 2 find out what the domain controllers are (just 
the pdc will be fine). 

In the function from vb2themaxx I altered this line:

  If NetGetDCName(vbNullString, vbNullString, lpBuffer) = 0 Then

to

  If NetGetDCName(vbNullString, "MyDomain", lpBuffer) = 0 Then

I just filled in the declaration :

  Private Declare Function NetGetDCName Lib "netapi32.dll" _
    (strServerName As Any, _
    strDomainName As Any, _
    pBuffer As Long) As Long

I think i can make strDomainName = "MyDomain". This doesn't work. Quiet 
logical because these declarations are beyond my knowledge about vb.
Would someone be so kind to tell me how to proceed ?

Thanks
Sander

  Return to Index