|   1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 |  
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
-
|
|
!
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | #uselib "user32.dll"
#func CreateAcceleratorTable "CreateAcceleratorTableA" sptr,int
#func DestroyAcceleratorTable"DestroyAcceleratorTable" int
#func GetMessage "GetMessageA" sptr,int,int,int
#func TranslateAccelerator "TranslateAcceleratorA" int,int,sptr
#func TranslateMessage "TranslateMessage" sptr
#func DispatchMessage "DispatchMessageA" sptr
 
#define WM_COMMAND 0x0111
#define WM_KEYDOWN 0x0100
#define WM_KEYUP   0x0101
 
#define FVIRTKEY   0x01
#define FNOINVERT  0x02
#define FSHIFT     0x04
#define FCONTROL   0x08
#define FALT       0x10
 
#define IDM_SAVE   1000
#define IDM_OPEN   1001
 
        sdim ACCEL, 6*2
 
        poke ACCEL, 0, FALT|FVIRTKEY
    wpoke ACCEL, 2, 'S'
    wpoke ACCEL, 4, IDM_SAVE
 
        poke ACCEL, 6, FALT|FVIRTKEY
    wpoke ACCEL, 8, 'O'
    wpoke ACCEL, 10, IDM_OPEN
 
    CreateAcceleratorTable varptr(ACCEL), 2
    if stat!0: haccel=stat: else: title "アクセラレータテーブル作成に失敗しました."
    
    oncmd gosub *On_KeyUp, WM_KEYUP
    oncmd gosub *On_KeyDown, WM_KEYDOWN
    oncmd gosub *On_Command, WM_COMMAND
 
    dim MSG, 7
 
 *msgloop
    GetMessage varptr(MSG), 0, 0, 0
    ret = stat
    if ret = 0: gosub *DestroyAccel: end
 
    if ret = -1: gosub *DestroyAccel: end
 
    TranslateAccelerator hwnd, haccel, varptr(MSG)
    if stat=0{
        TranslateMessage varptr(MSG)
        DispatchMessage varptr(MSG)        }
 
            goto *msgloop
 
    stop
 
 *DestroyAccel
        if haccel!0: DestroyAcceleratorTable haccel
    return
 
 *On_Command
    title ""
    switch (wparam & $FFFF)
        case IDM_SAVE:
            dialog "*", 17, "すべてのファイル"
            if stat=1: title refstr
            swbreak
        case IDM_OPEN:
            dialog "*", 16, "すべてのファイル"
            if stat=1: title refstr
    swend
    return 0
 
 *On_KeyDown
    title "WM_KEYDOWN "+strf("wparam=%X",wparam)
    return 0
 
 *On_KeyUp
    title ""
    return 0
 |