【HSP3】Sony VAIO PCG-R505R/GK(2001年発売) の液晶の輝度を変えるサンプルコード

Sony,VAIO,PCG-R505R/GK

Sony,VAIO,PCG-R505R/GK

#include "kernel32.as"
#define FILE_SHARE_READ 0x00000001
#define FILE_SHARE_WRITE 0x00000002
#define GENERIC_READ 0x80000000
#define GENERIC_WRITE 0x40000000
#define IOCTL_VIDEO_QUERY_SUPPORTED_BRIGHTNESS 0x00230494
#define IOCTL_VIDEO_QUERY_DISPLAY_BRIGHTNESS 0x00230498
#define IOCTL_VIDEO_SET_DISPLAY_BRIGHTNESS 0x0023049C

	title "VAIO NOTEBOOK LCD BRIGHTNESS "

	//デバイスのオープン(Sony Notebook Control)
	val="\\\\?\\acpi#sny5001#4&2ab4e1f1&0#{f304eb09-5c5f-11d2-b53f-0800460198ac}"

	CreateFile val,GENERIC_READ|GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE,0,3,0,0
	if stat=-1:dialog
	hlcd=stat

// ソニーは8段階固定?
	l = ""
	repeat 9
		l+=""+cnt+"\n"
	loop

	// 現在の状態
	buf=0:br=0
	DeviceIoControl hLCD,0x00222018,"GBRT",4,varptr(buf),4,varptr(br),0
	s = buf

	combox s,,l
	button "変更",*set
	button "更新",*ref

stop
*set
	// レベル指定
	br = 0
	buf.0 = 0x54524253 //SBRT
	buf.1 = s
	DeviceIoControl hLCD,0x22201c,varptr(buf),8,varptr(buf),8,varptr(br),0
	br = 0
	buf.0 = 0x52425053 //SBRT
	buf.1 = s
	DeviceIoControl hLCD,0x22201c,varptr(buf),8,varptr(buf),8,varptr(br),0
stop
*ref
	// 現在の状態
	buf=0:br=0
	DeviceIoControl hLCD,0x00222018,"GBRT",4,varptr(buf),4,varptr(br),0
	s = buf
	objprm 0,s

stop