view R/scratch/win32.R @ 52:c5ca08cd3e78

- readme typos
author Tassilo Philipp
date Fri, 22 Jan 2021 15:12:34 +0100
parents 0cfcc391201f
children
line wrap: on
line source

# ----------------------------------------------------------------------------
# constants

CS_BYTEALIGNCLIENT = 4096
CS_BYTEALIGNWINDOW = 8192
CS_CLASSDC = 64
CS_DBLCLKS = 8
CS_DELETE_TRANSFORM = 0x00000003
CS_DISABLE = 0x00000002
CS_ENABLE = 0x00000001
CS_GLOBALCLASS = 16384
CS_HREDRAW = 2
CS_IME = 0x10000
CS_INSERTCHAR = 0x2000
CS_KEYCVTWINDOW = 4
CS_NOCLOSE = 512
CS_NOKEYCVT = 256
CS_NOMOVECARET = 0x4000
CS_OWNDC = 32
CS_PARENTDC = 128
CS_SAVEBITS = 2048
CS_VREDRAW = 1
WM_USER = 1024
WM_ACTIVATE = 6
WM_ACTIVATEAPP = 28
WM_AFXFIRST = 864
WM_AFXLAST = 895
WM_APP = 32768
WM_ASKCBFORMATNAME = 780
WM_CANCELJOURNAL = 75
WM_CANCELMODE = 31
WM_CAPTURECHANGED = 533
WM_CHANGECBCHAIN = 781
WM_CHAR = 258
WM_CHARTOITEM = 47
WM_CHILDACTIVATE = 34
WM_CHOOSEFONT_GETLOGFONT = (WM_USER+1)
WM_CHOOSEFONT_SETFLAGS = (WM_USER+102)
WM_CHOOSEFONT_SETLOGFONT = (WM_USER+101)
WM_CLEAR = 771
WM_CLOSE = 16
WM_COMMAND = 273
WM_COMMNOTIFY = 68
WM_COMPACTING = 65
WM_COMPAREITEM = 57
WM_CONTEXTMENU = 123
WM_CONVERTREQUESTEX = 0x108
WM_COPY = 769
WM_COPYDATA = 74
WM_CREATE = 1
WM_CTLCOLORBTN = 309
WM_CTLCOLORDLG = 310
WM_CTLCOLOREDIT = 307
WM_CTLCOLORLISTBOX = 308
WM_CTLCOLORMSGBOX = 306
WM_CTLCOLORSCROLLBAR = 311
WM_CTLCOLORSTATIC = 312
WM_CUT = 768
WM_DDE_FIRST = 0x03E0
WM_DDE_ACK = (WM_DDE_FIRST+4)
WM_DDE_ADVISE = (WM_DDE_FIRST+2)
WM_DDE_DATA = (WM_DDE_FIRST+5)
WM_DDE_EXECUTE = (WM_DDE_FIRST+8)
WM_DDE_INITIATE = (WM_DDE_FIRST)
WM_DDE_LAST = (WM_DDE_FIRST+8)
WM_DDE_POKE = (WM_DDE_FIRST+7)
WM_DDE_REQUEST = (WM_DDE_FIRST+6)
WM_DDE_TERMINATE = (WM_DDE_FIRST+1)
WM_DDE_UNADVISE = (WM_DDE_FIRST+3)
WM_DEADCHAR = 259
WM_DELETEITEM = 45
WM_DESTROY = 2
WM_DESTROYCLIPBOARD = 775
WM_DEVICECHANGE = 537
WM_DEVMODECHANGE = 27
WM_DISPLAYCHANGE = 126
WM_DRAWCLIPBOARD = 776
WM_DRAWITEM = 43
WM_DROPFILES = 563
WM_ENABLE = 10
WM_ENDSESSION = 22
WM_ENTERIDLE = 289
WM_ENTERMENULOOP = 529
WM_ENTERSIZEMOVE = 561
WM_ERASEBKGND = 20
WM_EXITMENULOOP = 530
WM_EXITSIZEMOVE = 562
WM_FONTCHANGE = 29
WM_GETDLGCODE = 135
WM_GETFONT = 49
WM_GETHOTKEY = 51
WM_GETICON = 127
WM_GETMINMAXINFO = 36
WM_GETTEXT = 13
WM_GETTEXTLENGTH = 14
WM_HANDHELDFIRST = 856
WM_HANDHELDLAST = 863
WM_HELP = 83
WM_HOTKEY = 786
WM_HSCROLL = 276
WM_HSCROLLCLIPBOARD = 782
WM_ICONERASEBKGND = 39
WM_IME_CHAR = 0x286
WM_IME_COMPOSITION = 0x10F
WM_IME_COMPOSITIONFULL = 0x284
WM_IME_CONTROL = 0x283
WM_IME_ENDCOMPOSITION = 0x10E
WM_IME_KEYDOWN = 0x290
WM_IME_KEYLAST = 0x10F
WM_IME_KEYUP = 0x291
WM_IME_NOTIFY = 0x282
WM_IME_SELECT = 0x285
WM_IME_SETCONTEXT = 0x281
WM_IME_STARTCOMPOSITION = 0x10D
WM_INITDIALOG = 272
WM_INITMENU = 278
WM_INITMENUPOPUP = 279
WM_INPUTLANGCHANGE = 81
WM_INPUTLANGCHANGEREQUEST = 80
WM_KEYDOWN = 256
WM_KEYFIRST = 256
WM_KEYLAST = 264
WM_KEYUP = 257
WM_KILLFOCUS = 8
WM_LBUTTONDBLCLK = 515
WM_LBUTTONDOWN = 513
WM_LBUTTONUP = 514
WM_MBUTTONDBLCLK = 521
WM_MBUTTONDOWN = 519
WM_MBUTTONUP = 520
WM_MDIACTIVATE = 546
WM_MDICASCADE = 551
WM_MDICREATE = 544
WM_MDIDESTROY = 545
WM_MDIGETACTIVE = 553
WM_MDIICONARRANGE = 552
WM_MDIMAXIMIZE = 549
WM_MDINEXT = 548
WM_MDIREFRESHMENU = 564
WM_MDIRESTORE = 547
WM_MDISETMENU = 560
WM_MDITILE = 550
WM_MEASUREITEM = 44
WM_MENUCHAR = 288
WM_MENUSELECT = 287
WM_MOUSEACTIVATE = 33
WM_MOUSEFIRST = 512
WM_MOUSEHOVER = 0x2A1
WM_MOUSELAST = 522
WM_MOUSELEAVE = 0x2A3
WM_MOUSEMOVE = 512
WM_MOUSEWHEEL = 522
WM_MOVE = 3
WM_MOVING = 534
WM_NCACTIVATE = 134
WM_NCCALCSIZE = 131
WM_NCCREATE = 129
WM_NCDESTROY = 130
WM_NCHITTEST = 132
WM_NCLBUTTONDBLCLK = 163
WM_NCLBUTTONDOWN = 161
WM_NCLBUTTONUP = 162
WM_NCMBUTTONDBLCLK = 169
WM_NCMBUTTONDOWN = 167
WM_NCMBUTTONUP = 168
WM_NCMOUSEMOVE = 160
WM_NCPAINT = 133
WM_NCRBUTTONDBLCLK = 166
WM_NCRBUTTONDOWN = 164
WM_NCRBUTTONUP = 165
WM_NEXTDLGCTL = 40
WM_NEXTMENU = 531
WM_NOTIFY = 78
WM_NOTIFYFORMAT = 85
WM_NULL = 0
WM_PAINT = 15
WM_PAINTCLIPBOARD = 777
WM_PAINTICON = 38
WM_PALETTECHANGED = 785
WM_PALETTEISCHANGING = 784
WM_PARENTNOTIFY = 528
WM_PASTE = 770
WM_PENWINFIRST = 896
WM_PENWINLAST = 911
WM_POWER = 72
WM_POWERBROADCAST = 536
WM_PRINT = 791
WM_PRINTCLIENT = 792
WM_PSD_ENVSTAMPRECT = (WM_USER+5)
WM_PSD_FULLPAGERECT = (WM_USER+1)
WM_PSD_GREEKTEXTRECT = (WM_USER+4)
WM_PSD_MARGINRECT = (WM_USER+3)
WM_PSD_MINMARGINRECT = (WM_USER+2)
WM_PSD_PAGESETUPDLG = WM_USER
WM_PSD_YAFULLPAGERECT = (WM_USER+6)
WM_QUERYDRAGICON = 55
WM_QUERYENDSESSION = 17
WM_QUERYNEWPALETTE = 783
WM_QUERYOPEN = 19
WM_QUEUESYNC = 35
WM_QUIT = 18
WM_RBUTTONDBLCLK = 518
WM_RBUTTONDOWN = 516
WM_RBUTTONUP = 517
WM_RENDERALLFORMATS = 774
WM_RENDERFORMAT = 773
WM_SETCURSOR = 32
WM_SETFOCUS = 7
WM_SETFONT = 48
WM_SETHOTKEY = 50
WM_SETICON = 128
WM_SETREDRAW = 11
WM_SETTEXT = 12
WM_SETTINGCHANGE = 26
WM_SHOWWINDOW = 24
WM_SIZE = 5
WM_SIZECLIPBOARD = 779
WM_SIZING = 532
WM_SPOOLERSTATUS = 42
WM_STYLECHANGED = 125
WM_STYLECHANGING = 124
WM_SYNCPAINT = 136
WM_SYSCHAR = 262
WM_SYSCOLORCHANGE = 21
WM_SYSCOMMAND = 274
WM_SYSDEADCHAR = 263
WM_SYSKEYDOWN = 260
WM_SYSKEYUP = 261
WM_TCARD = 82
WM_THEMECHANGED = 794
WM_TIMECHANGE = 30
WM_TIMER = 275
WM_UNDO = 772
WM_USERCHANGED = 84
WM_VKEYTOITEM = 46
WM_VSCROLL = 277
WM_VSCROLLCLIPBOARD = 778
WM_WINDOWPOSCHANGED = 71
WM_WINDOWPOSCHANGING = 70
WM_WININICHANGE = 26
WS_ACTIVECAPTION = 0x00000001
WS_BORDER = 0x800000
WS_CAPTION = 0xc00000
WS_CHILD = 0x40000000
WS_CHILDWINDOW = 0x40000000
WS_CLIPCHILDREN = 0x2000000
WS_CLIPSIBLINGS = 0x4000000
WS_DISABLED = 0x8000000
WS_DLGFRAME = 0x400000
WS_EX_ACCEPTFILES = 16
WS_EX_APPWINDOW = 0x40000
WS_EX_CLIENTEDGE = 512
WS_EX_COMPOSITED = 0x2000000
WS_EX_CONTEXTHELP = 0x400
WS_EX_CONTROLPARENT = 0x10000
WS_EX_DLGMODALFRAME = 1
WS_EX_LAYERED = 0x80000
WS_EX_LAYOUTRTL = 0x400000
WS_EX_LEFT = 0
WS_EX_LEFTSCROLLBAR = 0x4000
WS_EX_LTRREADING = 0
WS_EX_MDICHILD = 64
WS_EX_NOACTIVATE = 0x8000000
WS_EX_NOINHERITLAYOUT = 0x100000
WS_EX_NOPARENTNOTIFY = 4
WS_EX_OVERLAPPEDWINDOW = 0x300
WS_EX_PALETTEWINDOW = 0x188
WS_EX_RIGHT = 0x1000
WS_EX_RIGHTSCROLLBAR = 0
WS_EX_RTLREADING = 0x2000
WS_EX_STATICEDGE = 0x20000
WS_EX_TOOLWINDOW = 128
WS_EX_TOPMOST = 8
WS_EX_TRANSPARENT = 32
WS_EX_WINDOWEDGE = 256
WS_GROUP = 0x20000
WS_HSCROLL = 0x100000
WS_ICONIC = 0x20000000
WS_MAXIMIZE = 0x1000000
WS_MAXIMIZEBOX = 0x10000
WS_MINIMIZE = 0x20000000
WS_MINIMIZEBOX = 0x20000
WS_OVERLAPPED = 0
WS_OVERLAPPEDWINDOW = 0xcf0000
WS_POPUP = 0x80000000
WS_POPUPWINDOW = 0x80880000
WS_SIZEBOX = 0x40000
WS_SYSMENU = 0x80000
WS_TABSTOP = 0x10000
WS_THICKFRAME = 0x40000
WS_TILED = 0
WS_TILEDWINDOW = 0xcf0000
WS_VISIBLE = 0x10000000
WS_VSCROLL = 0x200000
SM_ARRANGE = 56
SM_CLEANBOOT = 67
SM_CMETRICS = 88
SM_CMONITORS = 80
SM_CMOUSEBUTTONS = 43
SM_CXBORDER = 5
SM_CXCURSOR = 13
SM_CXDLGFRAME = 7
SM_CXDOUBLECLK = 36
SM_CXDRAG = 68
SM_CXEDGE = 45
SM_CXFIXEDFRAME = 7
SM_CXFOCUSBORDER = 83
SM_CXFRAME = 32
SM_CXFULLSCREEN = 16
SM_CXHSCROLL = 21
SM_CXHTHUMB = 10
SM_CXICON = 11
SM_CXICONSPACING = 38
SM_CXMAXIMIZED = 61
SM_CXMAXTRACK = 59
SM_CXMENUCHECK = 71
SM_CXMENUSIZE = 54
SM_CXMIN = 28
SM_CXMINIMIZED = 57
SM_CXMINSPACING = 47
SM_CXMINTRACK = 34
SM_CXSCREEN = 0
SM_CXSIZE = 30
SM_CXSIZEFRAME = 32
SM_CXSMICON = 49
SM_CXSMSIZE = 52
SM_CXVIRTUALSCREEN = 78
SM_CXVSCROLL = 2
SM_CYBORDER = 6
SM_CYCAPTION = 4
SM_CYCURSOR = 14
SM_CYDLGFRAME = 8
SM_CYDOUBLECLK = 37
SM_CYDRAG = 69
SM_CYEDGE = 46
SM_CYFIXEDFRAME = 8
SM_CYFOCUSBORDER = 84
SM_CYFRAME = 33
SM_CYFULLSCREEN = 17
SM_CYHSCROLL = 3
SM_CYICON = 12
SM_CYICONSPACING = 39
SM_CYKANJIWINDOW = 18
SM_CYMAXIMIZED = 62
SM_CYMAXTRACK = 60
SM_CYMENU = 15
SM_CYMENUCHECK = 72
SM_CYMENUSIZE = 55
SM_CYMIN = 29
SM_CYMINIMIZED = 58
SM_CYMINSPACING = 48
SM_CYMINTRACK = 35
SM_CYSCREEN = 1
SM_CYSIZE = 31
SM_CYSIZEFRAME = 33
SM_CYSMCAPTION = 51
SM_CYSMICON = 50
SM_CYSMSIZE = 53
SM_CYVIRTUALSCREEN = 79
SM_CYVSCROLL = 20
SM_CYVTHUMB = 9
SM_DBCSENABLED = 42
SM_DEBUG = 22
SM_IMMENABLED = 82
SM_MEDIACENTER = 87
SM_MENUDROPALIGNMENT = 40
SM_MIDEASTENABLED = 74
SM_MOUSEPRESENT = 19
SM_MOUSEWHEELPRESENT = 75
SM_NETWORK = 63
SM_PENWINDOWS = 41
SM_REMOTESESSION = 0X1000
SM_RESERVED1 = 24
SM_RESERVED2 = 25
SM_RESERVED3 = 26
SM_RESERVED4 = 27
SM_SAMEDISPLAYFORMAT = 81
SM_SECURE = 44
SM_SERVERR2 = 89
SM_SHOWSOUNDS = 70
SM_SLOWMACHINE = 73
SM_STARTER = 88
SM_SWAPBUTTON = 23
SM_TABLETPC = 86
SM_XVIRTUALSCREEN = 76
SM_YVIRTUALSCREEN = 77
AF_12844 = 25
AF_APPLETALK = 16
AF_ATM = 22
AF_BAN = 21
AF_CCITT = 10
AF_CHAOS = 5
AF_CLUSTER = 24
AF_DATAKIT = 9
AF_DECnet = 12
AF_DLI = 13
AF_ECMA = 8
AF_FIREFOX = 19
AF_HYLINK = 15
AF_IMPLINK = 3
AF_INET = 2
AF_INET6 = 23
AF_IPX = 6
AF_IRDA = 26
AF_ISO = 7
AF_LAT = 14
AF_MAX = 29
AF_NETBIOS = 17
AF_NETDES = 28
AF_NS = 6
AF_OSI = AF_ISO
AF_PUP = 4
AF_SNA = 11
AF_UNIX = 1
AF_UNKNOWN1 = 20
AF_UNSPEC = 0
AF_VOICEVIEW = 18
COLOR_3DDKSHADOW = 21
COLOR_3DFACE = 15
COLOR_3DHIGHLIGHT = 20
COLOR_3DHILIGHT = 20
COLOR_3DLIGHT = 22
COLOR_3DSHADOW = 16
COLOR_ACTIVEBORDER = 10
COLOR_ACTIVECAPTION = 2
COLOR_ADJ_MAX = 100
COLOR_ADJ_MIN = (-100)
COLOR_APPWORKSPACE = 12
COLOR_BACKGROUND = 1
COLOR_BTNFACE = 15
COLOR_BTNHIGHLIGHT = 20
COLOR_BTNHILIGHT = 20
COLOR_BTNSHADOW = 16
COLOR_BTNTEXT = 18
COLOR_CAPTIONTEXT = 9
COLOR_DESKTOP = 1
COLOR_GRADIENTACTIVECAPTION = 27
COLOR_GRADIENTINACTIVECAPTION = 28
COLOR_GRAYTEXT = 17
COLOR_HIGHLIGHT = 13
COLOR_HIGHLIGHTTEXT = 14
COLOR_HOTLIGHT = 26
COLOR_INACTIVEBORDER = 11
COLOR_INACTIVECAPTION = 3
COLOR_INACTIVECAPTIONTEXT = 19
COLOR_INFOBK = 24
COLOR_INFOTEXT = 23
COLOR_MENU = 4
COLOR_MENUTEXT = 7
COLOR_SCROLLBAR = 0
COLOR_WINDOW = 5
COLOR_WINDOWFRAME = 6
COLOR_WINDOWTEXT = 8
# ----------------------------------------------------------------------------
# types

types <- c(
UINT='i',
WNDPROC='p',
int='i',
HINSTANCE='p',
HICON='p',
HCURSOR='p',
HBRUSH='p',
LPCTSTR='S',
LPCTSTR='S',
void='v'
)

# ----------------------------------------------------------------------------
# structures

WNDCLASSEXA <- structinfo("
  UINT cbSize;
  UINT style;
  WNDPROC lpfnWndProc;
  int cbClsExtra;
  int cbWndExtra;
  HINSTANCE hInstance;
  HICON hIcon;
  HCURSOR hCursor;
  HBRUSH hbrBackground;
  LPCTSTR lpszMenuName;
  LPCTSTR lpszClassName;
  HICON hIconSm;
", types) 

# ----------------------------------------------------------------------------
# functions

.kernel32 <- dynbind("kernel32","
  GetTickCount()i;
  GetLastError()i;
",callmode="stdcall")

.user32 <- dynbind("user32","
  RegisterClassExA(p)n;
  CreateWindowExA(iSSiiiiipppp)p;
  DefWindowProcA(pppp)p;
",callmode="stdcall")