// DLL 確認 exist "Jpex.dll":if strsize==-1:jpg=-1 exist "Hspng.dll":if strsize==-1:png=-1 exist "iconrewr.dll":if strsize==-1:ico=-1 // インクルード #include "iconrewr.as" #include "jpex.as" #include "hspng.as" #define app "The Change 1.22" #define ico_max 16 // 変換ファイル形式 sdim type_list,1024 type_list="ビットマップイメージ (*.bmp)\n" type_list+="アイコン (*.ico)\n" type_list+="JPEG イメージ (*.jpg)\n" type_list+="PNG イメージ (*.png)\n" type_list+="実行形式 (*.exe)\n" // 白色検索モジュール #module #deffunc white val,val sw=0:mref x,48:mref y,49:x=0:y=0 repeat:pget x,y if (rval==255)&(gval==255)&(bval==255):sw=1:break x++:if x>winx:x=0:y++ if y>winy:break loop if sw=0:x=-1:y=-1 return #global // 初期化 sdim files,10000:sdim file,1000:str type:opt="" sel=-1:files=cmdline:onerror error // 画面 title app:screen 2,200,200,12:title app:color:boxf // コマンドライン無しの場合 if(files==""){ dialog "bmp;*.ico;*.jpg;*.png;*.exe",16,"全てのファイル" if stat==0:end file=refstr:goto loaded} *load // 1ファイル取得 getstr file,files,i,' ' strmid opt,file,,1 if(opt=="/"){peek opt,file,1}else{opt=""} if(file==""){end} i+=strsize *loaded // タイトル変更 title app+" - "+file // ファイル確認 exist file:if(strsize==-1){dialog "読込失敗 ["+file+"]",1,app:goto load} // 拡張子判別 getpath type,file,18 // ビットマップ MAG if(type=".bmp")|(type=".mag"):picload file:goto save // JPEG if(type==".jpg"){ jpexload size,file:if stat:dialog "読込失敗 ["+file+"]",1,app:goto load screen 2,size,size.1,12:jpexdraw:if stat:dialog "描画失敗 ["+file+"]",1,app:goto load goto save} // PNG if(type==".png"){ pngload size,file:if stat:dialog "読込失敗 ["+file+"]",1,app:goto load screen 2,size,size.1,12:pngdraw:if stat:dialog "描画失敗 ["+file+"]",1,app:goto load goto save} // アイコン if(type==".ico"){ irw_set_iconname file:irw_get_icon_info size,1 if(stat){dialog "読込失敗 ["+file+"]",1,app:goto load} screen 2,0xff&(size>>16),0xff&(size>>8),12 irw_icon_view 1:goto save} // 実行ファイル if(type=".exe"){ irw_set_exename file:irw_get_icon_info_exe size,1 if(stat){dialog "読込失敗 ["+file+"]",1,app:goto load} screen 2,0xff&(size>>16),0xff&(size>>8),12 irw_icon_view_exe 1:goto save} dialog "未知の形式 ["+file+"]",1,app:goto load *save if(sel!=-1){goto save_two} // 非表示ウィンドウ screen 3,200,200,6 // ファイルタイプ選択 if(opt!=""){goto save_three} color 192,192,192:boxf title "ファイルの種類":color pos 10,10:sysfont 17:mes "ファイルの種類" objsize winx-20,winy-70:objmode 1,1:sel==-1 listbox sel,1,type_list:objsize winx-20,20 pos 10,winy-30:button "終了",save_two:gsel 3,2 // 選択取得 repeat:if(sel!=-1){break}:wait 1:loop *save_two // 選択拡張子判断 gsel 3,-1:gsel 2 notesel type_list:noteget opt,sel strmid opt,opt,-1,4:strmid opt,opt,,3 *save_three getpath file,file,1:file+="."+opt // ビットマップ保存 if(opt=="bmp"){bmpsave file:goto load} // JPEG 保存 if(opt=="jpg"){ jpexsave file,,2 if strsize==-1:dialog "保存失敗 ["+file+"]",1,app goto load} // PNG 保存 if(opt=="png"){ pngsave file if stat:dialog "保存失敗 ["+file+"]",1,app goto load} // アイコン保存 if(opt=="ico")|(opt=="exe"){ white x,y:irw_set_backcolor x,y if(opt=="ico"){irw_set_iconname file} if(opt=="exe"){irw_set_iconname "C:\\Temp\\Temp.ico"} irw_screen_to_icon winx,winy if(stat){dialog "保存エラー",1,app:goto load} if(opt=="ico"){goto load} dialog "exe",16,"実行ファイル" if(stat==0){goto load} irw_set_exename refstr:irw_icon_rewrite 1,1 if(stat){dialog "書換エラー ["+refstr+"]",1,app} goto load} dialog "不明なエラー",1,app:goto load *error // エラー処理 dialog "未知のエラー [No:"+wparam+" Line:"+lparam+" File:"+file+"]",1,app goto load