Results 1 to 5 of 5

Thread: Domain Validation function

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2009
    Location
    Watch Window(Shift+f9)
    Posts
    1,879

    Question Domain Validation function

    can any one tell me ?.How shold i validate Domain name using Navigte function of webbrowser.let me know the idea.Any help would be highly appreciated.

  2. #2
    Fanatic Member FireXtol's Avatar
    Join Date
    Apr 2010
    Posts
    874

    Re: Domain Validation function

    Validate a domain name, or URL?

    MS's suggestion for URL validation: http://support.microsoft.com/kb/943522

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2009
    Location
    Watch Window(Shift+f9)
    Posts
    1,879

    Question Re: Domain Validation function

    i simple want to validate an address other than to pass it to the web engine and see if it returns a page.Kindly let me know the Idea.i have got the way on the web.but i don't want to use using Api.So kindly let me know the idea.
    Code:
    Private Declare Function IsValidURL Lib "urlmon" (ByVal pBC As Long, _
        url As Byte, ByVal dwReserved As Long) As Long
        
    Dim url As String
    Dim b() As Byte
    
    url = "http://www.vb2themax.com/default.asp"
    ' We need this because we're passing a Unicode string
    b = url & vbNullChar
    
    If IsValidURL(0, b(0), 0) = 0 Then    
        ' valid URL
    Else
        ' invalid URL
    End If

  4. #4
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: Domain Validation function

    Found this in my codebank,

    Code:
    Option Explicit
    Private Const S_FALSE = &H1
    Private Const S_OK = &H0
    Private Declare Function IsValidURL Lib "URLMON.DLL" (ByVal pbc As Long, ByVal szURL As String, ByVal dwReserved As Long) As Long
    
    Private Function IsGoodURL(ByVal sURL As String) As Boolean
        'The IsValidURL always expects a UNICODE string, but whenever
        'VB calls an API function, it converts the strings to ANSI strings.
        'That's why we're going to use a trick here. Before calling the function,
        'We're going to convert the unicode string to unicode so we get a double
        'unicode string.
        'Before VB calls the API function, it converts our double unicode string
        'to a normal unicode string; exactely what IsValidURL is expecting.
        sURL = StrConv(sURL, vbUnicode)
        'Now call the function
        IsGoodURL = (IsValidURL(ByVal 0&, sURL, 0) = S_OK)
    End Function
    
    
    Private Sub Form_Load()
        MsgBox "Is valid URL: " & CStr(IsGoodURL("http://www.ex-designz.net"))
    End Sub

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2009
    Location
    Watch Window(Shift+f9)
    Posts
    1,879

    Question Re: Domain Validation function

    Where this IsValidURL Declaration is available.means in which file Mapi32.txt, win32api.text or apiload.text.let me know the idea.Kindly find the attachment also.
    additional Still i am facing issue during web validation.here is the following code what i have written.
    Code:
    Private Declare Function IsValidURL Lib "URLMON.DLL" (ByVal pbc As Long, ByVal szURL As String, ByVal dwReserved As Long) As Long
    
    
    If txtWebSite.Text <> "" Then   'Test for empty Domain
       If Not PortalValidate(txtWebSite.Text) = True Then
          MsgBox ("Domain Format is InCorrect")
          CheckInput = False
          txtWebSite.SetFocus
          Exit Function
       End If
     End If
     
    
    Public Function PortalValidate(ByVal SURL As String) As Boolean
    Dim ok As Boolean
    SURL = StrConv(SURL, vbUnicode)
    ok = (IsValidURL(ByVal 0&, SURL, 0) = S_OK)
    If ok = True Then
    PortalValidate = True
    Exit Function
    End If
    PortalValidate = False
    End Function
    Last edited by firoz.raj; May 30th, 2011 at 02:09 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width