//ビルド設定エリア
#packopt version "Build.ini" //詳細
#packopt icon "app.ico" //アイコン
#packopt hide 1
#define ctype HIWORD(%1) (%1 >> 16 & $FFFF)
//===================================================================================
//ライブラリのロード
#include "hsp3utf.as"//UTF-8化
#include "hspinet.as"//ネット通信
#include "mod_rss.as"//RSS用
#include "mod_regexp.as"//正規表現一括変換
//定数
AppName = "らいちブラウザ"
AppNameInternal = "LychiBrowser"
AppVer = "2.0"
AppVerInt = "2.0"
//エラーハンドリング
onerror *onerror_handle
//終了時の処理の予約
onexit *exit
//システム設定のロード
#include "SettingLoader.hsp"
//////////////////////////////////////////////////////////////////
//アプリエリア
//タスクトレイ依存関係
#include "kernel32.as"
#include "shell32.as"
#include "user32.as"
//DPI対策
#uselib "kernel32" //Kernel32.dllを利用する
#uselib "user32.dll" //user32.dllを利用する
#func SetProcessDpiAwarenessContext "SetProcessDpiAwarenessContext" int //DPI関数(上位)の定義
#func SetProcessDPIAware "SetProcessDPIAware" //DPI関数(下位)の定義
//モード別DPI対応
switch Var_DPIMode
case 1 : SetProcessDpiAware : swbreak
case 2 : SetProcessDpiAwarenessContext -4 : swbreak
default : swbreak
swend
#module
#defcfunc TrueScale int p1
return 1.0*Var_ViewScale@*p1
#deffunc SetTitle str p1
if p1=""{
title AppName@+" v"+AppVer@
}else{
title AppName@+" v"+AppVer@+" | "+p1
}
return 0
#global
//GUI設定
screen 0,TrueScale(500),TrueScale(350),0 //画面サイズを設定
width ,,ginfo(20)/2-TrueScale(250),ginfo(21)/2-TrueScale(150) //デスクトップの中心に表示
SetTitle "起動中"
color 192,192,192:boxf:color 0,0,0 //色の初期化
//全面表示設定
if Var_isForceTop {
gsel 0,2
}else{
gsel 0,1
}
/////////////////////////////////////////////////////
//UI設定
sdim URL,8192
font "MS ゴシック",TrueScale(18):objmode 2
pos 0,0 : objsize TrueScale(450),TrueScale( 30) : input URL
sdim RenderText,8192 : RenderText="起動中です..."
font "MS ゴシック",TrueScale(16):objmode 2
pos TrueScale(0),TrueScale(30) : objsize TrueScale(500),TrueScale(320) : mesbox RenderText,,,0,0
pos TrueScale(450), TrueScale(0) : objsize TrueScale( 50), TrueScale(30) : button gosub "移動",*SearchGo
randomize
newcom spv, "Sapi.SpVoice"
if varuse(spv)=0 {
IsCanUseSAPI=0
}else{
IsCanUseSAPI=1
}
gosub *init_internet
gosub *checkupdate
*main
navigate(":home")
stop
/////////////////////////////////////////////////////
//スタティックエリア
#include "InternetManager.hsp"
#include "NavigateManager.hsp"
*onerror_handle
tmp ="重大な問題が発生しました。\n"+AppName+"を終了します。\n\n"
tmp+="バージョン:"+AppVer+"\n"
tmp+="エラーコード: "
tmp+="0x"+strf("%04d",wparam)
tmp+="\n\n上記のデバッグ情報と状況を報告してくださると、修正の助けになります!"
dialog tmp,1
end
*SearchGo
if 0=instr(URL,0,":"){
navigate(URL)
return
}else:if URL=""{
return
}else:if 0=instr(URL,0,"http://") or 0=instr(URL,0,"https://") {
if wsitechk(URL)!=0{
t ="申し訳ございません。このページに到達できませんでした。"
objprm 1,t
return
}else{
navigate(URL)
}
return
}else{
urlencode URL,URL
sdim t
t ="https://html.duckduckgo.com/html/?q="
t+=URL
t+="&kl="+Var_Language_Location //地域・言語
t+="&kp="+Var_IsEnableSafeSearch //セーフサーチ
t+="&kd=-1" //リダイレクト無効
t+="&kh=1" //HTTPS強制
t+="&k1=-1" //広告非表示
navigate(t)
return
}
return
*exit
onexit 0
objprm 0,""
objprm 1,"Good Bye!"
await 750
end