ほい。昔作ったのをURL用にちょっと直した。
// URL読み込み
#module mCOMOBJMACRO
#define global ctype SUCCEEDED(%1) ((%1) >= 0)
#define global SafeRelease(%1) if ((varuse(%1)) && (vartype(%1) == 6)){ \
delcom %1: \
%1 = 0 \
}
#global
#module mSHORTCUT
#uselib "ole32"
#func CoTaskMemFree "CoTaskMemFree" int
#define CLSID_InternetShortcut "{FBF23B40-E3F0-101B-8488-00AA003E56F8}"
#define IID_IUniformResourceLocatorA "{FBF23B80-E3F0-101B-8488-00AA003E56F8}"
#usecom IUniformResourceLocatorA IID_IUniformResourceLocatorA CLSID_InternetShortcut
#comfunc IUniformResourceLocatorA_GetUrl 4 var
#define S_FALSE 0x00000001
#define STGM_READ 0x00000000
#define STGM_SHARE_DENY_WRITE 0x00000020
#define IID_IPersistFile "{0000010b-0000-0000-C000-000000000046}"
#usecom IPersistFile IID_IPersistFile
#comfunc IPersistFile_Load 5 wstr, int
#defcfunc GetURL str file_path, \
local pUniformResourceLocatorA, \
local pPersistFile, \
local hr, \
local out_path, \
local tmp_path, \
local pszURL
hr = 0
pUniformResourceLocatorA = 0
pPersistFile = 0
newcom pUniformResourceLocatorA, IUniformResourceLocatorA
if varuse(pUniformResourceLocatorA) == 0 : return ""
querycom pPersistFile, pUniformResourceLocatorA, IPersistFile
IPersistFile_Load pPersistFile, file_path, 0 : hr = stat
if SUCCEEDED(hr){
pszURL = 0
IUniformResourceLocatorA_GetUrl pUniformResourceLocatorA, pszURL : hr = stat
if ((hr != S_FALSE) && SUCCEEDED(hr)){
dupptr tmp_path, pszURL, 64, 2
out_path = tmp_path
CoTaskMemFree pszURL
}
}
// SafeRelease
SafeRelease pPersistFile
SafeRelease pUniformResourceLocatorA
return out_path
#global
#define DIID_DWebBrowserEvents2 "{34A715A0-6587-11D0-924A-0020AFC7AC4D}"
#define DISPID_NAVIGATECOMPLETE2 252
cls 1
sdim url,512
url="http://hsp.tv/"
objsize 600,24
pos 0,2:mes "URL:"
pos 0,26:mes "ブラウザ"
pos 40,0:input url
objsize 120,24
pos 160,24:button "お気に入り",*rist
pos 520,24:button "移動",*wow
pos 400,24:button "進む",*go_f
pos 280,24:button "戻る",*go_b
pos 0,48
axobj ie, "Shell.Explorer.2",xx,yy-48
num=stat
comevent ie_event, ie, "{34A715A0-6587-11D0-924A-0020AFC7AC4D}",*event ; DIID_DWebBrowserEvents2
ie->"Navigate" url
*main
stop
*event
; COMイベント処理
dispid = comevdisp(ie_event)
if dispid = DISPID_NAVIGATECOMPLETE2 : gosub *OnNavigateComplete2
return
*OnNavigateComplete2
name = ie("LocationURL")
objprm 0,name
pDoc = ie("Document")
name = pDoc("Title")
title name
delcom pDoc
return
*wow
ie->"Navigate" url
goto *main
*go_f
ie->"GoForward"
goto *main
*go_b
ie->"GoBack"
goto *main
*rist
dialog "url",16,"ショ−トカット"
url=refstr
ie->"Navigate" GetURL(url)
goto *main
stop