#include "hspdsc.as"
#runtime "hsp3HighDPI"
#include "gdi32.as"
#include "user32.as"
#module
#define LOGPIXELSX 88
#define LOGPIXELSY 90
#defcfunc getScale int mode, int size
// 現在のDPI -> 96dpi
if 0 == mode : return int((1.0 * size * dpiX) / 96.0)
if 1 == mode : return int((1.0 * size * dpiY) / 96.0)
// 96dpi -> 現在のDPI
if 2 == mode : return int((1.0 * size * 96.0) / dpiX)
if 3 == mode : return int((1.0 * size * 96.0) / dpiY)
return 0
#defcfunc getFontScale int size
return int(1.0 * size * (1.0 * dpiY / 72.0) * (72.0 / 96.0))
#deffunc getDPI
GetDC 0
sHdc = stat
GetDeviceCaps sHdc, LOGPIXELSX
dpiX = stat
GetDeviceCaps sHdc, LOGPIXELSY
dpiY = stat
ReleaseDC 0, sHdc
return
#global
b = 1.4
getDPI
screen 0, getScale(0, 300.0*b), getScale(1, 184.0*b)
title "HSPDSC Video Capture"
dsc_Init
*main
cls
id = 0
font "Meiryo UI", getFontScale(12.0*b), 16
objmode 2, 1
sdim devList, dsc_GetDeviceListSize()
dsc_GetDeviceList devList
mes "▼ ビデオデバイスリスト"
objsize getScale(0, 300.0*b), getScale(1, 100.0*b)
listbox id, 0, devList
objid_Listbox = stat
objsize getScale(0, 300.0*b), getScale(1, 20.0*b)
button "ビデオデバイスリストの再読み込み", *main
objid_Button_ReLoadDevice = stat
button gosub "デバイスを開く", *OpenDevice
objid_Button_DeviceOpen = stat
button gosub "デバイスを閉じる", *CloseDevice
objid_Button_DeviceClose = stat
objenable objid_Button_DeviceClose, 0
onexit gosub *Exit
onexit 0
stop
*OpenDevice
if ( -1 == id ) {
dialog "選択してください。"
return
}
gosub *ButtonDisable
dsc_SetActiveSel 0
dsc_Open id, 0, 0, 0, 0
if stat < 0 {
dialog "デバイスのオープンに失敗しました。\nSTAT = " + stat
gosub *ButtonEnable
return
}
dsc_Play2
onexit 1
return
*CloseDevice
dsc_Stop
dsc_Close
onexit 1
gosub *ButtonEnable
return
*ButtonEnable
objenable objid_Listbox, 1
objenable objid_Button_DeviceOpen, 1
objenable objid_Button_DeviceClose, 0
objenable objid_Button_ReLoadDevice, 1
return
*ButtonDisable
objenable objid_Listbox, 0
objenable objid_Button_DeviceOpen, 0
objenable objid_Button_DeviceClose, 1
objenable objid_Button_ReLoadDevice, 0
return
*Exit
dsc_Stop
dsc_Close
dsc_Exit
end : end
return