Private Declare Function InternetSetCookie Lib "wininet.dll" _
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.pellesoft.nu/Cookie.htm", _
"CookiesNamn", "Skriv cookie här")
If Not blnReturn Then MsgBox "Kunde inte skapa cookie!", vbCritical
End Sub
Private Sub cmdGetCookie_Click()
Dim strCookieText As String * 256
Dim blnReturn As Boolean
blnReturn = InternetGetCookie("http://www.pellesoft.nu/cookie.htm", _
"CookiesNamn", strCookieText, 255)
If Not blnReturn Then
MsgBox "Kunde inte hämta cookies", vbCritical
Else
MsgBox strCookieText, vbInformation
End If
End Sub