Alias InternetSetCookieA _
(ByVal lpszUrlName As String, _
ByVal lpszCookieName As String, _
ByVal lpszCookieData As String) As Boolean
Private Declare Function InternetGetCookie Lib ‘‘wininet.dll’‘ _
Alias ‘‘InternetGetCookieA’‘ _
(ByVal lpszUrlName As String, _
ByVal lpszCookieName As String, _
ByVal lpszCookieData As String, _
lpdwSize As Long) As Boolean
Private Sub cmdMakeCookie_Click()
Dim blnReturn As Boolean
blnReturn = InternetSetCookie(‘‘http://www.vnn.vn’‘, _
‘‘Tên cookies’‘, ‘‘Thông tin cá»§a cookies’‘)
If Not blnReturn Then MsgBox ‘‘Tác vụ sai!’‘, vbCritical
End Sub
Private Sub cmdGetCookie_Click()
Dim strCookieText As String * 256
Dim blnReturn As Boolean
blnReturn = InternetGetCookie(‘‘http://www.vnn.vn’‘, _
‘‘Tên cookies’‘, strCookieText, 255)
If Not blnReturn Then
MsgBox ‘‘Tac vụ sai’‘, vbCritical
Else
MsgBox strCookieText, vbInformation
End If
End Sub