MCI版
#uselib "user32.dll"
#cfunc GetDC "GetDC" int
#cfunc GetWindowDC "GetWindowDC" int
#func ReleaseDC "ReleaseDC" int,int
#cfunc GetForegroundWindow "GetForegroundWindow"
#cfunc GetDesktopWindow "GetDesktopWindow"
#func GetWindowRect "GetWindowRect" int,int
#func GetClientRect "GetClientRect" int,int
#uselib "gdi32.dll"
#func BitBlt "BitBlt" int,int,int,int,int,int,int,int,int
#define NULL 0
#define SRCCOPY 0x00CC0020
dialog "*",16
if stat=0:end
fname=refstr
//ダミー画面
mci "open \""+fname+"\" alias DUMMY type mpegvideo"
mci "window DUMMY handle " + hwnd
mci "put DUMMY destination at -320 -240 320 240"
mci "play DUMMY":mci "stop DUMMY"
//本体
mci "open \""+fname+"\" alias MOVIE type mpegvideo"
mci "window MOVIE handle " + hwnd
mci "put MOVIE destination at 0 0 640 480"
mci "play MOVIE"
dialog "キャプチャしたいところでOKを押す!"
wait 100
// この辺を参考に
// http://yokohama.cool.ne.jp/chokuto/advanced/capturewindow.html
thwnd=hwnd
screen 2,640,480,2:title "キャプチャ"
dim rect,4
GetClientRect thwnd,varptr(rect)
sx=rect(2)-rect(0):sy=rect(3)-rect(1)
thdc=GetDC(thwnd)
BitBlt hdc,0,0,sx,sy,thdc,0,0,SRCCOPY
ReleaseDC thwnd,thdc
gsel 2,1
// 全解放するにはallが使えます。
mci "close all"
hspdsp版
#include "hspdsp.as"
// Ver 1.03用
// 注意 : SRCCOPY は hspdsp.as 内で定義されていますが
// 次回VerUP時に削除を行います。注意してください。
;#define SRCCOPY 0x00CC0020
dsp_Init
dialog "*",16
if stat=0:end
fname=refstr
dsp_Open fname,0,0,0,0
dsp_Play hwnd,0,0,640,480
dialog "キャプチャしたいところでOKを押す!"
screen 2,dsp_Info(0),dsp_Info(1),2:title "キャプチャ"
dsp_CaptureVideo hdc,0,0,dsp_Info(0),dsp_Info(1),SRCCOPY
gsel 2,1
dsp_Close