|
|
|
2018/6/15(Fri) 23:13:22|NO.84617
画面キャプチャーソフトを作りました。
こんな感じです。
#packopt hide 1
#uselib "gdi32.dll"
#func BitBlt "BitBlt" int,int,int,int,int,int,int,int,int
#uselib "user32.dll"
#cfunc GetDC "GetDC" int
#func GetWindowLong "GetWindowLongA" sptr,sptr
#func SetWindowLong "SetWindowLongA" sptr,sptr,sptr
#func DrawIcon "DrawIcon" int,int,int,int
#func GetCursorInfo "GetCursorInfo" var
ScreenHDC = GetDC()
onkey gosub *key
dispx=ginfo_dispx
dispy=ginfo_dispy
screen 0,ginfo(20),ginfo(21),2,,,640,480
winx=640
winy=480
GetWindowLong hwnd, -16
SetWindowLong hwnd, -16, stat | $10000 | $40000
title "Desktop Capture"
gsel 0,2
oncmd gosub *resize,0x5
dim CURSORINFO,5
repeat
GetCursorInfo CURSORINFO
CURSORINFO.0=20
cursorx=CURSORINFO.3
cursory=CURSORINFO.4
xx=cursorx-(winx/2)
yy=cursory-(winy/2)
if cursorx<winx/2:xx=0
if cursory<winy/2:yy=0
if dispx-(winx/2)<cursorx:xx=dispx-winx
if dispy-(winy/2)<cursory:yy=dispy-winy
BitBlt hdc,0,0, winx,winy, ScreenHDC, xx, yy, $00CC0020 | $40000000
DrawIcon hdc,CURSORINFO.3-xx,CURSORINFO.4-yy,CURSORINFO.2
redraw
await 32
loop
*key
if wparam=13:bmpsave dir_desktop+"\\screenshot.bmp"
return
*resize
winx=ginfo_winx
winy=ginfo_winy
return
マウスカーソルの形状が変わったとき、カーソルの位置が少しずれてしまいます。
どうすればいいでしょうか?
| |
|
2018/6/16(Sat) 01:46:30|NO.84618
|
|
2018/6/16(Sat) 19:49:04|NO.84623
ありがとうございます。
#packopt hide 1
#uselib "gdi32.dll"
#cfunc GetDeviceCaps "GetDeviceCaps" int,int
#func BitBlt "BitBlt" int,int,int,int,int,int,int,int,int
#uselib "user32.dll"
#cfunc GetDC "GetDC" int
#func SetProcessDPIAware "SetProcessDPIAware"
#func GetWindowLong "GetWindowLongA" sptr,sptr
#func SetWindowLong "SetWindowLongA" sptr,sptr,sptr
#func DrawIcon "DrawIcon" int,int,int,int
#func GetCursorInfo "GetCursorInfo" var
#func GetIconInfo "GetIconInfo" int,var
#define LOGPIXELSX $00000058
#define LOGPIXELSY $0000005A
#define ctype XSIZ(%1) int(%1*XDPI/96)
#define ctype YSIZ(%1) int(%1*YDPI/96)
SetProcessDPIAware
XDPI=GetDeviceCaps(hdc,LOGPIXELSX)
YDPI=GetDeviceCaps(hdc,LOGPIXELSY)
ScreenHDC = GetDC()
onkey gosub *key
dispx=ginfo_dispx
dispy=ginfo_dispy
screen 0,ginfo(20),ginfo(21),2,,,XSIZ(640),YSIZ(480)
winx=XSIZ(640)
winy=YSIZ(480)
GetWindowLong hwnd, -16
SetWindowLong hwnd, -16, stat | $10000 | $40000
title "Desktop Capture"
gsel 0,2
oncmd gosub *resize,0x5
dim CURSORINFO,5
dim ICONINFO,5
repeat
GetCursorInfo CURSORINFO
GetIconInfo CURSORINFO.2,ICONINFO
CURSORINFO.0=20
cursorx=ginfo_mx
cursory=ginfo_my
xx=cursorx-(winx/2)
yy=cursory-(winy/2)
if cursorx<winx/2:xx=0
if cursory<winy/2:yy=0
if dispx-(winx/2)<cursorx:xx=dispx-winx
if dispy-(winy/2)<cursory:yy=dispy-winy
BitBlt hdc,0,0, winx,winy, ScreenHDC, xx, yy, $00CC0020 | $40000000
DrawIcon hdc,CURSORINFO.3-ICONINFO.1-xx,CURSORINFO.4-ICONINFO.2-yy,CURSORINFO.2
redraw
await 1000/30
loop
*key
if wparam=13:bmpsave dir_desktop+"\\screenshot.bmp"
return
*resize
winx=ginfo_winx
winy=ginfo_winy
return
| |
|