|
-
Apr 18th, 2010, 12:41 AM
#1
Thread Starter
Frenzied Member
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.
-
Apr 18th, 2010, 03:07 PM
#2
Re: Domain Validation function
Validate a domain name, or URL?
MS's suggestion for URL validation: http://support.microsoft.com/kb/943522
-
Apr 19th, 2010, 12:54 AM
#3
Thread Starter
Frenzied Member
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
-
Apr 19th, 2010, 01:05 AM
#4
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
-
Apr 19th, 2010, 03:14 AM
#5
Thread Starter
Frenzied Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|