いままでバグがありましたが、完全に取り払うことができました!ついでに、サイズ変更機能はいらないんじゃないかなぁと思い、サイズ変更BOXスタイル(WS_SIZEBOX)をとりました。SetWindowLongAの行です。
いままでバグがありましたが、完全に取り払うことができました!ついでに、サイズ変更機能はいらないんじゃないかなぁと思い、サイズ変更BOXスタイル(WS_SIZEBOX)をとりました。SetWindowLongAの行です。
#module "scrlbar"/*Cookies wrote:http://fs-cgi-basic01.freespace.jp/~hsp/ver3/hsp3.cgi?print+200511/05110003.txtからの転載http://quasiquote.org/hspwiki/%E3%82%A6%E3%82%A4%E3%83%B3%E3%83%89%E3%82%A6%E3%81%AB%E3%82%B9%E3%82%AF%E3%83%AD%E3%83%BC%E3%83%AB%E3%83%90%E3%83%BC%E3%82%92%E4%BB%98%E3%81%91%E3%82%8Bを参考に。この行から下に23行目のところ、編集させていただきました。*///-----------------------#uselib "user32"#func GetWindowLongA "GetWindowLongA" int,int#func SetWindowLongA "SetWindowLongA" int,int,int#func ShowScrollBar "ShowScrollBar" int,int,int#func SetScrollInfo "SetScrollInfo" int,int,var,int#func SetScrollPos "SetScrollPos" int,int,int,int#func SetWindowPos "SetWindowPos" int,int,int,int,int,int,int//-----------------------// 水平 垂直スクロールバーを使えるようにする#deffunc ScrollBaroncmd gosub *WMSIZE, 5oncmd gosub *SCROLL, $114oncmd gosub *SCROLL, $115si= 28, 31, 0,0,0,0,0 // SCROLLINFO構造体wx.ginfo_sel= ginfo_sizex+ginfo_sx-ginfo_winxwy.ginfo_sel= ginfo_sizey+ginfo_sy-ginfo_winy; WS_VSCROLL|WS_HSCROLL|WS_SIZEBOXGetWindowLongA hwnd,-16 : SetWindowLongA hwnd,-16,stat|$340000 ^ 0x00040000 //^以降変更(WS_SIZEBOXはいらないでしょ?)SetWindowPos hWnd, 0, 0, 0, 0, 0, $37 ; screen 0, bgscr用return 1*WMSIZE //ウィンドウサイズが変更された時の処理sel=ginfo_sel : gsel ginfo_intidrepeat 2si.3= ginfo(26+cnt), ginfo(12+cnt), ginfo(8+cnt)SetScrollInfo hWnd, cnt, si, 1loopgroll ginfo_vx, ginfo_vymref bm,67 : bm.20=ginfo_winx, ginfo_winyhHide= wx.ginfo_intid= ginfo_sizex ;gsel selを確実に実行させるためvHide= wy.ginfo_intid= ginfo_sizeywnd=hwnd : gsel sel ;何故かスクロールバーが描画されない環境があるためif hHide=1: ShowScrollBar wnd, 0, 0:else: SetWindowPos Wnd, 0,0,0,0,0,$37if vHide=1: ShowScrollBar wnd, 1, 0:else: SetWindowPos Wnd, 0,0,0,0,0,$37return 1*SCROLL //スクロールバー操作時の処理sel=ginfo_sel : gsel ginfo_intidm=iparam=$115 : nPos=ginfo(8+(m=1))Code= wParam &$ffffrepeat 1if Code= 5 : nPos=wParam>>16&$ffff : break ;TB_THUMBTRACKif Code= 0 : nPos-4 : break ;TB_LINEUPif Code= 1 : nPos+4 : breakif Code= 2 : nPos-32: breakif Code= 3 : nPos+32loopSetScrollPos hWnd, m, nPos, 1if m : groll ginfo_vx, nPos :else: groll nPos, ginfo_vygsel sel : return 1#global;-----------------------#module "scrlbar_iframe"#uselib "USER32.DLL"#func SetParent "SetParent" int,int#cfunc GetSystemMenu "GetSystemMenu" int, int#func DeleteMenu "DeleteMenu" int, int, nullptr#deffunc iframe_ int wid_, int wxsize, int wysize, int sxsize, int sysizewid=wid_ : if wid=-1 : wid = ginfo_newidhpwnd=hwndbgscr wid, wxsize, wysize, 2, ginfo_cx, ginfo_cy, sxsize, sysizeSetParent hwnd, hpwndScrollBargsel wid, 1return wid#define global iframe(%1=-1, %2=640, %3=480, %4=640, %5=480) iframe_ %1,%2,%3,%4,%5#global//StyleAdd ハンドル,スタイル,追加(0)or削除(1) (+2で 拡張ウィンドウスタイル)#uselib "user32.dll"#func global SetLong "SetWindowLongA" int, int, int#cfunc global GetLong "GetWindowLongA" int, int#define global StyleAdd(%1, %2=0, %3=0)ujw=((%3)&2)*-2-16 :\SetLong %1, ujw, GetLong(%1, ujw)|(%2)^((%3)&1)*(%2)#define 拡張 2#define 削除 1;-----------------------onexit gosub *owariscreen 0title "screen 0"picload dir_exe+"\\sample\\hspdx\\HSPDX.BMP"ScrollBarwidth 400, 300pos 10, 20iframe , 640, 480, 100, 100title "サイズ変更してみてください(^^)v"picload dir_exe+"/sample/demo/JP6GIRL.BMP",1stop*owariif iparam|wparam=0:endwait 20:gsel wparam, -1:return