Imports System.Runtime.InteropServices Public Class Form1 <DllImport("urlmon.dll", CharSet:=CharSet.Ansi)> _ Private Shared Function UrlMkSetSessionOption(ByVal dwOption As Integer, ByVal str As String, ByVal nLength As Integer, ByVal dwReserved As Integer) As Integer End Function Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Const URLMON_OPTION_USERAGENT As Integer = &H10000001 'ここに設定したいUser-Agentをセットする。 Dim UserAgent As String = "Visual Basic Junior High School User-Agent" UrlMkSetSessionOption(URLMON_OPTION_USERAGENT, UserAgent, UserAgent.Length, 0) End Sub End Class