win 0.3.17 → 0.3.24

Sign up to get free protection for your applications and to get access to all the features.
data/lib/win/error.rb CHANGED
@@ -882,7 +882,7 @@ module Win
882
882
  # to an array of values that represent the arguments. This flag cannot be used with 64-bit integer
883
883
  # values. If you are using a 64-bit integer, you must use the va_list structure.
884
884
  # - FORMAT_MESSAGE_FROM_HMODULE - The lpSource parameter is a module handle containing the message-table
885
- # resource(s) to search. If this lpSource handle is NULL, the current process's application image file
885
+ # resource(s) to search. If this lpSource handle is NULL, the current process's App image file
886
886
  # will be searched. This flag cannot be used with FORMAT_MESSAGE_FROM_STRING. If the module has no
887
887
  # message table resource, the function fails with ERROR_RESOURCE_TYPE_NOT_FOUND.
888
888
  # - FORMAT_MESSAGE_FROM_STRING - The lpSource parameter is a pointer to a null-terminated string that
@@ -892,7 +892,7 @@ module Win
892
892
  # - FORMAT_MESSAGE_FROM_SYSTEM - The function should search the system message-table resource(s) for
893
893
  # the requested message. If this flag is specified with FORMAT_MESSAGE_FROM_HMODULE, the function
894
894
  # searches the system message table if the message is not found in the module specified by lpSource.
895
- # This flag cannot be used with FORMAT_MESSAGE_FROM_STRING. If this flag is specified, an application
895
+ # This flag cannot be used with FORMAT_MESSAGE_FROM_STRING. If this flag is specified, an App
896
896
  # can pass the result of the GetLastError function to retrieve the message text for a system error.
897
897
  # - FORMAT_MESSAGE_IGNORE_INSERTS - Insert sequences in the message definition are to be ignored and
898
898
  # passed through to the output buffer unchanged. This flag is useful for fetching a message for later
@@ -1027,7 +1027,7 @@ module Win
1027
1027
  # GetLastError Function
1028
1028
  # Retrieves the calling thread's last-error code value. The last-error code is maintained on a
1029
1029
  # per-thread basis. Multiple threads do not overwrite each other's last-error code.
1030
- # Visual Basic: Applications should call err.LastDllError instead of GetLastError.
1030
+ # Visual Basic: Apps should call err.LastDllError instead of GetLastError.
1031
1031
  #
1032
1032
  # [*Syntax*] DWORD WINAPI GetLastError( void );
1033
1033
  #
@@ -1053,9 +1053,9 @@ module Win
1053
1053
  # that can be returned by each function. There are also many functions whose documentation does not
1054
1054
  # include even a partial list of error codes that can be returned.
1055
1055
  # Error codes are 32-bit values (bit 31 is the most significant bit). Bit 29 is reserved for
1056
- # application-defined error codes; no system error code has this bit set. If you are defining an error
1057
- # code for your application, set this bit to one. That indicates that the error code has been defined by
1058
- # an application, and ensures that your error code does not conflict with any error codes defined by the
1056
+ # App-defined error codes; no system error code has this bit set. If you are defining an error
1057
+ # code for your App, set this bit to one. That indicates that the error code has been defined by
1058
+ # an App, and ensures that your error code does not conflict with any error codes defined by the
1059
1059
  # system.
1060
1060
  # To convert a system error into an HRESULT value, use the HRESULT_FROM_WIN32 macro.
1061
1061
  # ---
@@ -1083,16 +1083,16 @@ module Win
1083
1083
  # - The last-error code is kept in thread local storage so that multiple threads do not overwrite each
1084
1084
  # other's values.
1085
1085
  # - This function is intended primarily for use by dynamic-link libraries (DLL). A DLL can provide the
1086
- # applications that are using it with additional diagnostic information by calling this function after
1086
+ # Apps that are using it with additional diagnostic information by calling this function after
1087
1087
  # an error occurs. Most functions call SetLastError or SetLastErrorEx only when they fail. However, some
1088
1088
  # system functions call SetLastError or SetLastErrorEx under conditions of success; those cases are
1089
1089
  # noted in each function's documentation.
1090
- # - Applications can optionally retrieve the value set by this function by using the GetLastError function
1090
+ # - Apps can optionally retrieve the value set by this function by using the GetLastError function
1091
1091
  # immediately after a function fails.
1092
1092
  # - Error codes are 32-bit values (bit 31 is the most significant bit). Bit 29 is reserved for
1093
- # application-defined error codes; no system error code has this bit set. If you are defining an error
1094
- # code for your application, set this bit to indicate that the error code has been defined by your
1095
- # application and to ensure that your error code does not conflict with any system-defined error codes.
1093
+ # App-defined error codes; no system error code has this bit set. If you are defining an error
1094
+ # code for your App, set this bit to indicate that the error code has been defined by your
1095
+ # App and to ensure that your error code does not conflict with any system-defined error codes.
1096
1096
  # ---
1097
1097
  # <b>Enhanced (snake_case) API: </b>
1098
1098
  #
@@ -1116,16 +1116,16 @@ module Win
1116
1116
  # The last-error code is kept in thread local storage so that multiple threads do not overwrite each
1117
1117
  # other's values.
1118
1118
  # This function is intended primarily for use by dynamic-link libraries (DLL). A DLL can provide the
1119
- # applications that are using it with additional diagnostic information by calling this function after
1119
+ # Apps that are using it with additional diagnostic information by calling this function after
1120
1120
  # an error occurs. Most functions call SetLastError or SetLastErrorEx only when they fail. However, some
1121
1121
  # system functions call SetLastError or SetLastErrorEx under conditions of success; those cases are
1122
1122
  # noted in each function's documentation.
1123
- # Applications can optionally retrieve the value set by this function by using the GetLastError function
1123
+ # Apps can optionally retrieve the value set by this function by using the GetLastError function
1124
1124
  # immediately after a function fails.
1125
1125
  # Error codes are 32-bit values (bit 31 is the most significant bit). Bit 29 is reserved for
1126
- # application-defined error codes; no system error code has this bit set. If you are defining an error
1127
- # code for your application, set this bit to indicate that the error code has been defined by the
1128
- # application and to ensure that your error code does not conflict with any system-defined error codes.
1126
+ # App-defined error codes; no system error code has this bit set. If you are defining an error
1127
+ # code for your App, set this bit to indicate that the error code has been defined by the
1128
+ # App and to ensure that your error code does not conflict with any system-defined error codes.
1129
1129
  #
1130
1130
  # :call-seq:
1131
1131
  # set_last_error_ex(err_code, dw_type)
@@ -1145,19 +1145,19 @@ module Win
1145
1145
  # SEM_FAILCRITICALERRORS:: The system does not display the critical-error-handler message box. Instead,
1146
1146
  # the system sends the error to the calling process.
1147
1147
  # SEM_NOALIGNMENTFAULTEXCEPT:: The system automatically fixes memory alignment faults and makes them
1148
- # invisible to the application. It does this for the calling process and
1148
+ # invisible to the App. It does this for the calling process and
1149
1149
  # any descendant processes. This feature is only supported by certain
1150
1150
  # processor architectures. For more information, see the Remarks section.
1151
1151
  # After this value is set for a process, subsequent attempts to clear the
1152
1152
  # value are ignored.
1153
1153
  # SEM_NOGPFAULTERRORBOX:: The system does not display the general-protection-fault message box. This
1154
- # flag should only be set by debugging applications that handle general
1154
+ # flag should only be set by debugging Apps that handle general
1155
1155
  # protection (GP) faults themselves with an exception handler.
1156
1156
  # SEM_NOOPENFILEERRORBOX:: The system does not display a message box when it fails to find a file.
1157
1157
  # Instead, the error is returned to the calling process.
1158
1158
  # ---
1159
1159
  # *Remarks*:
1160
- # Each process has an associated error mode that indicates to the system how the application is going to
1160
+ # Each process has an associated error mode that indicates to the system how the App is going to
1161
1161
  # respond to serious errors. A child process inherits the error mode of its parent process.
1162
1162
  # To change the error mode for the process, use the SetErrorMode function.
1163
1163
  # ------
@@ -1180,13 +1180,13 @@ module Win
1180
1180
  # SEM_FAILCRITICALERRORS:: The system does not display the critical-error-handler message box. Instead,
1181
1181
  # the system sends the error to the calling process.
1182
1182
  # SEM_NOALIGNMENTFAULTEXCEPT:: The system automatically fixes memory alignment faults and makes them
1183
- # invisible to the application. It does this for the calling process and any
1183
+ # invisible to the App. It does this for the calling process and any
1184
1184
  # descendant processes. This feature is only supported by certain processor
1185
1185
  # architectures. For more information, see the Remarks section.
1186
1186
  # After this value is set for a process, subsequent attempts to clear the
1187
1187
  # value are ignored.
1188
1188
  # SEM_NOGPFAULTERRORBOX:: The system does not display the general-protection-fault message box. This flag
1189
- # should only be set by debugging applications that handle general protection (GP)
1189
+ # should only be set by debugging Apps that handle general protection (GP)
1190
1190
  # faults themselves with an exception handler.
1191
1191
  # SEM_NOOPENFILEERRORBOX:: The system does not display a message box when it fails to find a file. Instead,
1192
1192
  # the error is returned to the calling process.
@@ -1194,12 +1194,12 @@ module Win
1194
1194
  # *Returns*:: The return value is the previous state of the error-mode bit flags.
1195
1195
  # ---
1196
1196
  # *Remarks*:
1197
- # Each process has an associated error mode that indicates to the system how the application is going to
1197
+ # Each process has an associated error mode that indicates to the system how the App is going to
1198
1198
  # respond to serious errors. A child process inherits the error mode of its parent process. To retrieve
1199
1199
  # the process error mode, use the GetErrorMode function.
1200
- # Because the error mode is set for the entire process, you must ensure that multi-threaded applications
1200
+ # Because the error mode is set for the entire process, you must ensure that multi-threaded Apps
1201
1201
  # do not set different error-mode flags. Doing so can lead to inconsistent error handling.
1202
- # The system does not make alignment faults visible to an application on all processor architectures.
1202
+ # The system does not make alignment faults visible to an App on all processor architectures.
1203
1203
  # Therefore, specifying SEM_NOALIGNMENTFAULTEXCEPT is not an error on such architectures, but the system
1204
1204
  # is free to silently ignore the request. This means that code sequences such as the following are not
1205
1205
  # always valid on x86 computers:
@@ -1208,9 +1208,9 @@ module Win
1208
1208
  # fuOldErrorMode = SetErrorMode(0);
1209
1209
  # ASSERT(fuOldErrorMode == SEM_NOALIGNMENTFAULTEXCEPT);
1210
1210
  #
1211
- # Itanium:: An application must explicitly call SetErrorMode with SEM_NOALIGNMENTFAULTEXCEPT to have the
1211
+ # Itanium:: An App must explicitly call SetErrorMode with SEM_NOALIGNMENTFAULTEXCEPT to have the
1212
1212
  # system automatically fix alignment faults. The default setting is for the system to make alignment
1213
- # faults visible to an application.
1213
+ # faults visible to an App.
1214
1214
  # Visual Studio 2005:: When declaring a pointer to a structure that may not have aligned data, you can use
1215
1215
  # __unaligned keyword to indicate that the type must be read one byte at a time. For more
1216
1216
  # information, see Windows Data Alignment.
data/lib/win/gui.rb CHANGED
@@ -2,6 +2,7 @@ require 'win/gui/window'
2
2
  require 'win/gui/input'
3
3
  require 'win/gui/message'
4
4
  require 'win/gui/dialog'
5
+ require 'win/gui/menu'
5
6
 
6
7
  module Win
7
8
 
@@ -12,5 +13,6 @@ module Win
12
13
  include Win::Gui::Input
13
14
  include Win::Gui::Message
14
15
  include Win::Gui::Dialog
16
+ include Win::Gui::Menu
15
17
  end
16
18
  end
@@ -71,7 +71,7 @@ module Win
71
71
 
72
72
  # The user must respond to the message box before continuing work in the window identified by the hWnd
73
73
  # parameter. However, the user can move to the windows of other threads and work in those windows.
74
- # Depending on the hierarchy of windows in the application, the user may be able to move to other
74
+ # Depending on the hierarchy of windows in the App, the user may be able to move to other
75
75
  # windows within the thread. All child windows of the parent of the message box are automatically
76
76
  # disabled, but pop-up windows are not.
77
77
  # MB_APPLMODAL is the default if neither MB_SYSTEMMODAL nor MB_TASKMODAL is specified.
@@ -82,7 +82,7 @@ module Win
82
82
  # windows other than those associated with hWnd.
83
83
  MB_SYSTEMMODAL = 0x00001000
84
84
  # Same as MB_APPLMODAL except that all the top-level windows belonging to the current thread are
85
- # disabled if the hWnd parameter is NULL. Use this flag when the calling application or library does not
85
+ # disabled if the hWnd parameter is NULL. Use this flag when the calling App or library does not
86
86
  # have a window handle available but still needs to prevent input to other windows in the calling thread
87
87
  # without suspending other threads.
88
88
  MB_TASKMODAL = 0x00002000
@@ -145,10 +145,10 @@ module Win
145
145
  ErrorIcon = 0x14 # ID of Error Icon (this dialog informs about some Error)
146
146
 
147
147
  ##
148
- # DialogProc is an application-defined callback function used with the CreateDialog and DialogBox
148
+ # DialogProc is an App-defined callback function used with the CreateDialog and DialogBox
149
149
  # families of functions. It processes messages sent to a modal or modeless dialog box. The DLGPROC
150
150
  # type defines a pointer to this callback function. DialogProc is a placeholder for the
151
- # application-defined function name.
151
+ # App-defined function name.
152
152
  #
153
153
  # [*Syntax*] INT_PTR CALLBACK DialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
154
154
  #
@@ -215,7 +215,7 @@ module Win
215
215
  # :call-seq:
216
216
  # control_handle = [get_]dlg_item( dialog_handle, control_id )
217
217
  #
218
- function :GetDlgItem, [:ulong, :int], :ulong, zeronil: true
218
+ function :GetDlgItem, [:ulong, :int], :ulong, fails: 0
219
219
 
220
220
  ##
221
221
  # The GetDlgCtrlID function retrieves the identifier of the specified control. In other words,
@@ -232,7 +232,7 @@ module Win
232
232
  # ---
233
233
  # *Remarks*:
234
234
  # GetDlgCtrlID accepts child window handles as well as handles of controls in dialog boxes. An
235
- # application sets the identifier for a child window when it creates the window by assigning the
235
+ # App sets the identifier for a child window when it creates the window by assigning the
236
236
  # identifier value to the hmenu parameter when calling the CreateWindow or CreateWindowEx function.
237
237
  # Although GetDlgCtrlID may return a value if hwndCtl is a handle to a top-level window, top-level
238
238
  # windows cannot have identifiers and such a return value is never valid.
@@ -245,13 +245,13 @@ module Win
245
245
  # :call-seq:
246
246
  # control_id = get_dlg_ctrl_id(control_handle)
247
247
  #
248
- function :GetDlgCtrlID, [:HWND], :int, zeronil: true
248
+ function :GetDlgCtrlID, [:HWND], :int, fails: 0
249
249
 
250
250
  ##
251
251
  # MessageBox Function
252
252
  # --------------------------------------------------------------------------------
253
253
  # The MessageBox function creates, displays, and operates a message box. The message box contains an
254
- # application-defined message and title, along with any combination of predefined icons and push
254
+ # App-defined message and title, along with any combination of predefined icons and push
255
255
  # buttons.
256
256
  #
257
257
  # [*Syntax*] int MessageBox( HWND hWnd, LPCTSTR lpText, LPCTSTR lpCaption, UINT uType );
@@ -324,7 +324,7 @@ module Win
324
324
  # :call-seq:
325
325
  # selected_item = message_box(owner_handle, text, caption, type)
326
326
  #
327
- function :MessageBox, [:HWND, :LPCTSTR, :LPCTSTR, :UINT], :int, zeronil: true,
327
+ function :MessageBox, [:HWND, :LPCTSTR, :LPCTSTR, :UINT], :int, fails: 0,
328
328
  &->(api, handle, text, caption, type=MB_OK) {
329
329
  text_pointer = FFI::MemoryPointer.from_string(text)
330
330
  caption_pointer = FFI::MemoryPointer.from_string(caption)
data/lib/win/gui/input.rb CHANGED
@@ -153,7 +153,7 @@ module Win
153
153
  # <b>NO Return Value</b>
154
154
  # ---
155
155
  # *Remarks*:
156
- # - An application can simulate a press of the PRINTSCRN key in order to obtain a screen snapshot
156
+ # - An App can simulate a press of the PRINTSCRN key in order to obtain a screen snapshot
157
157
  # and save it to the clipboard. To do this, call keybd_event with the bVk parameter set to VK_SNAPSHOT.
158
158
  #
159
159
  # - Windows NT/2000/XP: The keybd_event function can toggle the NUM LOCK, CAPS LOCK, and SCROLL LOCK keys.
@@ -201,7 +201,7 @@ module Win
201
201
  # - If flags is not MOUSEEVENTF_WHEEL, MOUSEEVENTF_XDOWN, or MOUSEEVENTF_XUP, then data should be zero.
202
202
  # XBUTTON1 - Set if the first X button was pressed or released.
203
203
  # XBUTTON2 - Set if the second X button was pressed or released.
204
- # dwExtraInfo:: <in> Specifies an additional value associated with the mouse event. An application
204
+ # dwExtraInfo:: <in> Specifies an additional value associated with the mouse event. An App
205
205
  # calls GetMessageExtraInfo to obtain this extra information.
206
206
  # <b>NO Return Value</b>
207
207
  # ---
@@ -214,8 +214,8 @@ module Win
214
214
  # - If the MOUSEEVENTF_ABSOLUTE value is not specified, dx and dy specify relative motions from when the
215
215
  # last mouse event was generated (the last reported position). Positive values mean the mouse moved right
216
216
  # (or down); negative values mean the mouse moved left (or up). Relative mouse motion is subject to the
217
- # settings for mouse speed and acceleration level. An end user sets these values using the Mouse application
218
- # in Control Panel. An application obtains and sets these values with the SystemParametersInfo function.
217
+ # settings for mouse speed and acceleration level. An end user sets these values using the Mouse App
218
+ # in Control Panel. An App obtains and sets these values with the SystemParametersInfo function.
219
219
  # - The system applies two tests to the specified relative mouse motion when applying acceleration. If the
220
220
  # specified distance along either the x or y axis is greater than the first mouse threshold value, and the
221
221
  # mouse acceleration level is not zero, the operating system doubles the distance. If the specified distance
@@ -227,12 +227,12 @@ module Win
227
227
  # Mouse speed can range from 1 (slowest) to 20 (fastest) and represents how much the pointer moves based
228
228
  # on the distance the mouse moves. The default value is 10, which results in no additional modification
229
229
  # to the mouse motion.
230
- # - The mouse_event function is used to synthesize mouse events by applications that need to do so. It is also
231
- # used by applications that need to obtain more information from the mouse than its position and button state.
232
- # For example, if a tablet manufacturer wants to pass pen-based information to its own applications, it can
230
+ # - The mouse_event function is used to synthesize mouse events by Apps that need to do so. It is also
231
+ # used by Apps that need to obtain more information from the mouse than its position and button state.
232
+ # For example, if a tablet manufacturer wants to pass pen-based information to its own Apps, it can
233
233
  # write a DLL that communicates directly to the tablet hardware, obtains the extra information, and saves it
234
234
  # in a queue. The DLL then calls mouse_event with the standard button and x/y position data, along with,
235
- # in the dwExtraInfo parameter, some pointer or index to the queued extra information. When the application
235
+ # in the dwExtraInfo parameter, some pointer or index to the queued extra information. When the App
236
236
  # needs the extra information, it calls the DLL with the pointer or index stored in dwExtraInfo, and the DLL
237
237
  # returns the extra information.
238
238
  #
@@ -0,0 +1,740 @@
1
+ require 'win/library'
2
+ #require 'win/gui/window'
3
+ #require 'win/gui/message' # needed because SC_... constants defined there
4
+
5
+ module Win
6
+ module Gui
7
+
8
+ # Contains constants and Win32 API functions related to Window menus manipulation.
9
+ # Menu basics can be found here:
10
+ # http://msdn.microsoft.com/en-us/library/ms646977%28v=VS.85%29.aspx
11
+ module Menu
12
+ extend Win::Library
13
+ # include Win::Gui::Window
14
+
15
+ # Menu Flags
16
+
17
+ MF_INSERT = 0x00000000
18
+ MF_CHANGE = 0x00000080
19
+ MF_APPEND = 0x00000100
20
+ MF_DELETE = 0x00000200
21
+ MF_REMOVE = 0x00001000
22
+ MF_BYCOMMAND = 0x00000000
23
+ MF_BYPOSITION = 0x00000400
24
+ MF_SEPARATOR = 0x00000800
25
+ MF_ENABLED = 0x00000000
26
+ MF_GRAYED = 0x00000001
27
+ MF_DISABLED = 0x00000002
28
+ MF_UNCHECKED = 0x00000000
29
+ MF_CHECKED = 0x00000008
30
+ MF_USECHECKBITMAPS = 0x00000200
31
+ MF_STRING = 0x00000000
32
+ MF_BITMAP = 0x00000004
33
+ MF_OWNERDRAW = 0x00000100
34
+ MF_POPUP = 0x00000010
35
+ MF_MENUBARBREAK = 0x00000020
36
+ MF_MENUBREAK = 0x00000040
37
+ MF_UNHILITE = 0x00000000
38
+ MF_HILITE = 0x00000080
39
+ MF_DEFAULT = 0x00001000
40
+ MF_SYSMENU = 0x00002000
41
+ MF_HELP = 0x00004000
42
+ MF_RIGHTJUSTIFY = 0x00004000
43
+ MF_MOUSESELECT = 0x00008000
44
+ MF_END = 0x00000080
45
+
46
+ # System Objects
47
+
48
+ OBJID_WINDOW = 0x00000000
49
+ OBJID_SYSMENU = 0xFFFFFFFF
50
+ OBJID_TITLEBAR = 0xFFFFFFFE
51
+ OBJID_MENU = 0xFFFFFFFD
52
+ OBJID_CLIENT = 0xFFFFFFFC
53
+ OBJID_VSCROLL = 0xFFFFFFFB
54
+ OBJID_HSCROLL = 0xFFFFFFFA
55
+ OBJID_SIZEGRIP = 0xFFFFFFF9
56
+ OBJID_CARET = 0xFFFFFFF8
57
+ OBJID_CURSOR = 0xFFFFFFF7
58
+ OBJID_ALERT = 0xFFFFFFF6
59
+ OBJID_SOUND = 0xFFFFFFF5
60
+ OBJID_QUERYCLASSNAMEIDX = 0xFFFFFFF4
61
+ OBJID_NATIVEOM = 0xFFFFFFF0
62
+
63
+ # From atlres.h:
64
+
65
+ # operation messages sent to DLGINIT
66
+ # LB_ADDSTRING (WM_USER+1)
67
+ # CB_ADDSTRING (WM_USER+3)
68
+
69
+ # Standard window components
70
+
71
+ ID_SEPARATOR = 0 # special separator value
72
+ ID_DEFAULT_PANE = 0 # default status bar pane
73
+
74
+ # standard control bars (IDW = window ID)
75
+ ATL_IDW_TOOLBAR = 0xE800 # main Toolbar for window
76
+ ATL_IDW_STATUS_BAR = 0xE801 # Status bar window
77
+ ATL_IDW_COMMAND_BAR = 0xE802 # Command bar window
78
+
79
+ # parts of a frame window
80
+ ATL_IDW_CLIENT = 0xE900
81
+ ATL_IDW_PANE_FIRST = 0xE900 # first pane (256 max)
82
+ ATL_IDW_PANE_LAST = 0xE9FF
83
+ ATL_IDW_HSCROLL_FIRST = 0xEA00 # first Horz scrollbar (16 max)
84
+ ATL_IDW_VSCROLL_FIRST = 0xEA10 # first Vert scrollbar (16 max)
85
+ ATL_IDW_SIZE_BOX = 0xEA20 # size box for splitters
86
+ ATL_IDW_PANE_SAVE = 0xEA21 # to shift ATL_IDW_PANE_FIRST
87
+
88
+ # bands for a rebar
89
+ ATL_IDW_BAND_FIRST = 0xEB00
90
+ ATL_IDW_BAND_LAST = 0xEBFF
91
+
92
+ # Standard Commands
93
+
94
+ # File commands
95
+ ID_FILE_NEW = 0xE100
96
+ ID_FILE_OPEN = 0xE101
97
+ ID_FILE_CLOSE = 0xE102
98
+ ID_FILE_SAVE = 0xE103
99
+ ID_FILE_SAVE_AS = 0xE104
100
+ ID_FILE_PAGE_SETUP = 0xE105
101
+ ID_FILE_PRINT_SETUP = 0xE106
102
+ ID_FILE_PRINT = 0xE107
103
+ ID_FILE_PRINT_DIRECT = 0xE108
104
+ ID_FILE_PRINT_PREVIEW = 0xE109
105
+ ID_FILE_UPDATE = 0xE10A
106
+ ID_FILE_SAVE_COPY_AS = 0xE10B
107
+ ID_FILE_SEND_MAIL = 0xE10C
108
+ ID_FILE_MRU_FIRST = 0xE110
109
+ ID_FILE_MRU_FILE1 = 0xE110 # range - 16 max
110
+ ID_FILE_MRU_FILE2 = 0xE111
111
+ ID_FILE_MRU_FILE3 = 0xE112
112
+ ID_FILE_MRU_FILE4 = 0xE113
113
+ ID_FILE_MRU_FILE5 = 0xE114
114
+ ID_FILE_MRU_FILE6 = 0xE115
115
+ ID_FILE_MRU_FILE7 = 0xE116
116
+ ID_FILE_MRU_FILE8 = 0xE117
117
+ ID_FILE_MRU_FILE9 = 0xE118
118
+ ID_FILE_MRU_FILE10 = 0xE119
119
+ ID_FILE_MRU_FILE11 = 0xE11A
120
+ ID_FILE_MRU_FILE12 = 0xE11B
121
+ ID_FILE_MRU_FILE13 = 0xE11C
122
+ ID_FILE_MRU_FILE14 = 0xE11D
123
+ ID_FILE_MRU_FILE15 = 0xE11E
124
+ ID_FILE_MRU_FILE16 = 0xE11F
125
+ ID_FILE_MRU_LAST = 0xE11F
126
+
127
+ # Edit commands
128
+ ID_EDIT_CLEAR = 0xE120
129
+ ID_EDIT_CLEAR_ALL = 0xE121
130
+ ID_EDIT_COPY = 0xE122
131
+ ID_EDIT_CUT = 0xE123
132
+ ID_EDIT_FIND = 0xE124
133
+ ID_EDIT_PASTE = 0xE125
134
+ ID_EDIT_PASTE_LINK = 0xE126
135
+ ID_EDIT_PASTE_SPECIAL = 0xE127
136
+ ID_EDIT_REPEAT = 0xE128
137
+ ID_EDIT_REPLACE = 0xE129
138
+ ID_EDIT_SELECT_ALL = 0xE12A
139
+ ID_EDIT_UNDO = 0xE12B
140
+ ID_EDIT_REDO = 0xE12C
141
+
142
+ # Window commands
143
+ ID_WINDOW_NEW = 0xE130
144
+ ID_WINDOW_ARRANGE = 0xE131
145
+ ID_WINDOW_CASCADE = 0xE132
146
+ ID_WINDOW_TILE_HORZ = 0xE133
147
+ ID_WINDOW_TILE_VERT = 0xE134
148
+ ID_WINDOW_SPLIT = 0xE135
149
+ ATL_IDM_WINDOW_FIRST = 0xE130
150
+ ATL_IDM_WINDOW_LAST = 0xE13F
151
+ ATL_IDM_FIRST_MDICHILD = 0xFF00 # window list starts here
152
+
153
+ # Help and App commands
154
+ ID_APP_ABOUT = 0xE140
155
+ ID_APP_EXIT = 0xE141
156
+ ID_HELP_INDEX = 0xE142
157
+ ID_HELP_FINDER = 0xE143
158
+ ID_HELP_USING = 0xE144
159
+ ID_CONTEXT_HELP = 0xE145 # shift-F1
160
+ ID_HELP = 0xE146 # first attempt for F1
161
+ ID_DEFAULT_HELP = 0xE147 # last attempt
162
+
163
+ # Misc
164
+ ID_NEXT_PANE = 0xE150
165
+ ID_PREV_PANE = 0xE151
166
+ ID_PANE_CLOSE = 0xE152
167
+
168
+ # Format
169
+ ID_FORMAT_FONT = 0xE160
170
+
171
+ # Scroll
172
+ ID_SCROLL_UP = 0xE170
173
+ ID_SCROLL_DOWN = 0xE171
174
+ ID_SCROLL_PAGE_UP = 0xE172
175
+ ID_SCROLL_PAGE_DOWN = 0xE173
176
+ ID_SCROLL_TOP = 0xE174
177
+ ID_SCROLL_BOTTOM = 0xE175
178
+ ID_SCROLL_LEFT = 0xE176
179
+ ID_SCROLL_RIGHT = 0xE177
180
+ ID_SCROLL_PAGE_LEFT = 0xE178
181
+ ID_SCROLL_PAGE_RIGHT = 0xE179
182
+ ID_SCROLL_ALL_LEFT = 0xE17A
183
+ ID_SCROLL_ALL_RIGHT = 0xE17B
184
+
185
+ # OLE commands
186
+ ID_OLE_INSERT_NEW = 0xE200
187
+ ID_OLE_EDIT_LINKS = 0xE201
188
+ ID_OLE_EDIT_CONVERT = 0xE202
189
+ ID_OLE_EDIT_CHANGE_ICON = 0xE203
190
+ ID_OLE_EDIT_PROPERTIES = 0xE204
191
+ ID_OLE_VERB_FIRST = 0xE210 # range - 16 max
192
+ ID_OLE_VERB_LAST = 0xE21F
193
+
194
+ # View commands (same number used as IDW used for toolbar and status bar)
195
+ ID_VIEW_TOOLBAR = 0xE800
196
+ ID_VIEW_STATUS_BAR = 0xE801
197
+ ID_VIEW_REFRESH = 0xE803
198
+
199
+ # Standard control IDs
200
+
201
+ IDC_STATIC = -1 # all static controls
202
+
203
+ # Standard string error/warnings
204
+
205
+ # idle status bar message
206
+ ATL_IDS_IDLEMESSAGE = 0xE001
207
+ ATL_IDS_SCFIRST = 0xEF00
208
+ ATL_IDS_SCSIZE = 0xEF00
209
+ ATL_IDS_SCMOVE = 0xEF01
210
+ ATL_IDS_SCMINIMIZE = 0xEF02
211
+ ATL_IDS_SCMAXIMIZE = 0xEF03
212
+ ATL_IDS_SCNEXTWINDOW = 0xEF04
213
+ ATL_IDS_SCPREVWINDOW = 0xEF05
214
+ ATL_IDS_SCCLOSE = 0xEF06
215
+ ATL_IDS_SCRESTORE = 0xEF12
216
+ ATL_IDS_SCTASKLIST = 0xEF13
217
+ ATL_IDS_MDICHILD = 0xEF1F
218
+ ATL_IDS_MRU_FILE = 0xEFDA
219
+
220
+ # Misc. control IDs
221
+
222
+ # Property Sheet control id's (determined with Spy++)
223
+ ID_APPLY_NOW = 0x3021
224
+ ID_WIZBACK = 0x3023
225
+ ID_WIZNEXT = 0x3024
226
+ ID_WIZFINISH = 0x3025
227
+ ATL_IDC_TAB_CONTROL = 0x3020
228
+
229
+ ##
230
+ # The GetMenu function retrieves a handle to the menu assigned to the specified window.
231
+ #
232
+ # [*Syntax*] HMENU GetMenu( HWND hWnd );
233
+ #
234
+ # hWnd:: <in> Handle to the window whose menu handle is to be retrieved.
235
+ #
236
+ # *Returns*:: The return value is a handle to the menu. If the specified window has no menu, the return
237
+ # value is NULL. If the window is a child window, the return value is undefined.
238
+ # ---
239
+ # *Remarks*:
240
+ # GetMenu does not work on floating menu bars. Floating menu bars are custom controls that mimic
241
+ # standard menus; they are not menus. To get the handle on a floating menu bar, use the Active
242
+ # Accessibility APIs.
243
+ # ---
244
+ # Minimum DLL Version user32.dll
245
+ # Header Declared in Winuser.h, include Windows.h
246
+ # Import library User32.lib
247
+ # Minimum operating systems Windows 95, Windows NT 3.1
248
+ # ---
249
+ # *See* *Also*
250
+ # GetSubMenu, SetMenu
251
+ # Menus: http://msdn.microsoft.com/en-us/library/ms646977%28v=VS.85%29.aspx
252
+ # ---
253
+ # <b>Enhanced (snake_case) API: returns nil if no menu handle associated with this window. </b>
254
+ #
255
+ # :call-seq:
256
+ # menu_handle = [get_]menu(window_handle)
257
+ #
258
+ function :GetMenu, [:HWND], :HMENU, fails: 0
259
+
260
+ ##
261
+ # The GetSystemMenu function allows the application to access the window menu (also known as the system
262
+ # menu or the control menu) for copying and modifying.
263
+ #
264
+ # [*Syntax*] HMENU GetSystemMenu( HWND hWnd, BOOL bRevert );
265
+ #
266
+ # hWnd:: <in> Handle to the window that will own a copy of the window menu.
267
+ # bRevert:: <in> Specifies the action to be taken. If this parameter is FALSE, GetSystemMenu returns a
268
+ # handle to the copy of the window menu currently in use. The copy is initially identical to
269
+ # the window menu, but it can be modified. If this parameter is TRUE, GetSystemMenu resets the
270
+ # window menu back to the default state. The previous window menu, if any, is destroyed.
271
+ #
272
+ # *Returns*:: If the bRevert parameter is FALSE, the return value is a handle to a copy of the window
273
+ # menu. If the bRevert parameter is TRUE, the return value is NULL.
274
+ # ---
275
+ # *Remarks*:
276
+ # Any window that does not use the GetSystemMenu function to make its own copy of the window menu
277
+ # receives the standard window menu.
278
+ # The window menu initially contains items with various identifier values, such as SC_CLOSE, SC_MOVE, SC_SIZE.
279
+ # Menu items on the window menu send WM_SYSCOMMAND messages.
280
+ # All predefined window menu items have identifier numbers greater than 0xF000. If an application adds
281
+ # commands to the window menu, it should use identifier numbers less than 0xF000.
282
+ # The system automatically grays items on the standard window menu, depending on the situation. The
283
+ # application can perform its own checking or graying by responding to the WM_INITMENU message that is
284
+ # sent before any menu is displayed.
285
+ # ---
286
+ # Minimum DLL Version user32.dll
287
+ # Header Declared in Winuser.h, include Windows.h
288
+ # Import library User32.lib
289
+ # Minimum operating systems Windows 95, Windows NT 3.1
290
+ # ---
291
+ # *See* *Also*:
292
+ # GetMenu, InsertMenuItem, SetMenuItemInfo, WM_INITMENU, WM_SYSCOMMAND
293
+ # Menus: http://msdn.microsoft.com/en-us/library/ms646977%28v=VS.85%29.aspx
294
+ #
295
+ # ---
296
+ # <b>Enhanced (snake_case) API: reset is optional, defaults to false(do not reset)</b>
297
+ #
298
+ # :call-seq:
299
+ # menu_handle = [get_]system_menu(window_handle, reset)
300
+ #
301
+ function :GetSystemMenu, [:HWND, :int8], :HMENU, fails: 0,
302
+ &->(api, window_handle, reset=false) {
303
+ api.call window_handle, (reset == 0 || reset == false) ? 0 : 1 }
304
+ # weird lambda literal instead of normal block is needed because current version of RDoc
305
+ # goes crazy if block is attached to meta-definition
306
+
307
+ ##
308
+ # The GetMenuItemCount function determines the number of items in the specified menu.
309
+ #
310
+ # [*Syntax*] int GetMenuItemCount( HMENU hMenu );
311
+ #
312
+ # hMenu:: <in> Handle to the menu to be examined.
313
+ #
314
+ # *Returns*:: If the function succeeds, the return value specifies the number of items in the menu.
315
+ # If the function fails, the return value is -1. To get extended error information, call GetLastError.
316
+ # ---
317
+ # Minimum DLL Version user32.dll
318
+ # Header Declared in Winuser.h, include Windows.h
319
+ # Import library User32.lib
320
+ # Minimum operating systems Windows 95, Windows NT 3.1
321
+ # ---
322
+ # *See* *Also*:
323
+ # GetMenuItemID
324
+ #
325
+ # ---
326
+ # <b>Enhanced (snake_case) API: returns nil instead of -1 if function fails </b>
327
+ #
328
+ # :call-seq:
329
+ # num_items = [get_]menu_item_count(menu_handle)
330
+ #
331
+ function :GetMenuItemCount, [:HMENU], :int32, fails: -1
332
+
333
+ ##
334
+ # The GetMenuItemID function retrieves the menu item identifier of a menu item located at the specified
335
+ # position in a menu.
336
+ #
337
+ # [*Syntax*] UINT GetMenuItemID( HMENU hMenu, int nPos );
338
+ #
339
+ # hMenu:: <in> Handle to the menu that contains the item whose identifier is to be retrieved.
340
+ # nPos:: <in> Specifies the zero-based relative position of the menu item whose identifier is to be
341
+ # retrieved.
342
+ #
343
+ # *Returns*:: The return value is the identifier of the specified menu item. If the menu item identifier
344
+ # is NULL or if the specified item opens a submenu, the return value is -1.
345
+ # --
346
+ # Minimum DLL Version user32.dll
347
+ # Header Declared in Winuser.h, include Windows.h
348
+ # Import library User32.lib
349
+ # Minimum operating systems Windows 95, Windows NT 3.1
350
+ # ---
351
+ # See Also:
352
+ # GetMenuItemCount
353
+ #
354
+ # ---
355
+ # <b>Enhanced (snake_case) API: returns nil instead of -1 if function fails </b>
356
+ #
357
+ # :call-seq:
358
+ # item_id = [get_]menu_item_id(@menu_handle, pos)
359
+ #
360
+ function :GetMenuItemID, [:HMENU, :int], :int32, fails: -1
361
+
362
+ ##
363
+ # The GetSubMenu function retrieves a handle to the drop-down menu or submenu activated by the specified
364
+ # menu item.
365
+ #
366
+ # [*Syntax*] HMENU GetSubMenu( HMENU hMenu, int nPos );
367
+ #
368
+ # hMenu:: <in> Handle to the menu.
369
+ # nPos:: <in> Specifies the zero-based relative position in the specified menu of an item that activates
370
+ # a drop-down menu or submenu.
371
+ #
372
+ # *Returns*:: If the function succeeds, the return value is a handle to the drop-down menu or submenu
373
+ # activated by the menu item. If the menu item does not activate a drop-down menu or
374
+ # submenu, the return value is NULL.
375
+ # ---
376
+ # Minimum DLL Version user32.dll
377
+ # Header Declared in Winuser.h, include Windows.h
378
+ # Import library User32.lib
379
+ # Minimum operating systems Windows 95, Windows NT 3.1
380
+ # ---
381
+ # See Also: CreatePopupMenu, GetMenu
382
+ #
383
+ # ---
384
+ # <b>Enhanced (snake_case) API: </b>
385
+ #
386
+ # :call-seq:
387
+ # sub_menu = [get_]sub_menu(menu_handle, pos)
388
+ #
389
+ function :GetSubMenu, [:HMENU, :int], :HMENU, fails: 0
390
+
391
+ ##
392
+ # The IsMenu function determines whether a handle is a menu handle.
393
+ #
394
+ # [*Syntax*] BOOL IsMenu( HMENU hMenu );
395
+ #
396
+ # hMenu:: <in> Handle to be tested.
397
+ #
398
+ # *Returns*:: If hMenu is a menu handle, the return value is nonzero.
399
+ # If hMenu is not a menu handle, the return value is zero.
400
+ # ---
401
+ # Minimum DLL Version user32.dll
402
+ # Header Declared in Winuser.h, include Windows.h
403
+ # Import library User32.lib
404
+ # Minimum operating systems Windows 95, Windows NT 3.1
405
+ # Unicode Implemented as Unicode version.
406
+ #
407
+ # ---
408
+ # <b>Enhanced (snake_case) API: returns true/false instead of 1/0</b>
409
+ #
410
+ # :call-seq:
411
+ # success = menu?(menu_handle)
412
+ #
413
+ function :IsMenu, [:HMENU], :int8, boolean: true
414
+
415
+ ##
416
+ # The CreateMenu function creates a menu. The menu is initially empty, but it can be filled with menu
417
+ # items by using the InsertMenuItem, AppendMenu, and InsertMenu functions.
418
+ #
419
+ # [*Syntax*] HMENU CreateMenu( void );
420
+ #
421
+ # *Returns*:: If the function succeeds, the return value is a handle to the newly created menu.
422
+ # If the function fails, the return value is NULL. To get extended error information, call GetLastError.
423
+ # ---
424
+ # *Remarks*:
425
+ # Resources associated with a menu that is assigned to a window are freed automatically. If the menu is
426
+ # not assigned to a window, an application must free system resources associated with the menu before
427
+ # closing. An application frees menu resources by calling the DestroyMenu function.
428
+ # Windows 95/98/Me:The system can support a maximum of 16,364 menu handles.
429
+ # ---
430
+ # Minimum DLL Version user32.dll
431
+ # Header Declared in Winuser.h, include Windows.h
432
+ # Import library User32.lib
433
+ # Minimum operating systems Windows 95, Windows NT 3.1
434
+ # Unicode Implemented as Unicode version.
435
+ # ---
436
+ # See Also: AppendMenu, CreatePopupMenu, DestroyMenu, InsertMenu, SetMenu, InsertMenuItem
437
+ #
438
+ # :call-seq:
439
+ # menu_handle = create_menu()
440
+ #
441
+ function :CreateMenu, [], :HMENU
442
+
443
+ ##
444
+ # The DestroyMenu function destroys the specified menu and frees any memory that the menu occupies.
445
+ #
446
+ # [*Syntax*] BOOL DestroyMenu( HMENU hMenu );
447
+ #
448
+ # hMenu:: <in> Handle to the menu to be destroyed.
449
+ #
450
+ # *Returns*:: If the function succeeds, the return value is nonzero.
451
+ # If the function fails, the return value is zero. To get extended error information, call GetLastError.
452
+ # ---
453
+ # *Remarks*:
454
+ # Before closing, an application must use the DestroyMenu function to destroy a menu not assigned to a
455
+ # window. A menu that is assigned to a window is automatically destroyed when the application closes.
456
+ # DestroyMenu is recursive, that is, it will destroy the menu and all its submenus.
457
+ # ---
458
+ # Minimum DLL Version user32.dll
459
+ # Header Declared in Winuser.h, include Windows.h
460
+ # Import library User32.lib
461
+ # Minimum operating systems Windows 95, Windows NT 3.1
462
+ # Unicode Implemented as Unicode version.
463
+ # ---
464
+ # See Also: CreateMenu, DeleteMenu, RemoveMenu, SetMenuItemInfo
465
+ #
466
+ # ---
467
+ # <b>Enhanced (snake_case) API: returns true/false instead of 1/0</b>
468
+ #
469
+ # :call-seq:
470
+ # success = destroy_menu(menu_handle)
471
+ #
472
+ function :DestroyMenu, [:HMENU], :int8, boolean: true
473
+
474
+ ##
475
+ # The SetMenu function assigns a new menu to the specified window.
476
+ #
477
+ # [*Syntax*] BOOL SetMenu( HWND hWnd, HMENU hMenu );
478
+ #
479
+ # hWnd:: <in> Handle to the window to which the menu is to be assigned.
480
+ # hMenu:: <in> Handle to the new menu. If this parameter is NULL, the window's current menu is removed.
481
+ #
482
+ # *Returns*:: If the function succeeds, the return value is nonzero.
483
+ # If the function fails, the return value is zero. To get extended error information, call GetLastError.
484
+ # ---
485
+ # *Remarks*:
486
+ # The window is redrawn to reflect the menu change. A menu can be assigned to any window that is not a
487
+ # child window.
488
+ # The SetMenu function replaces the previous menu, if any, but it does not destroy it. An application
489
+ # should call the DestroyMenu function to accomplish this task.
490
+ # ---
491
+ # Minimum DLL Version user32.dll
492
+ # Header Declared in Winuser.h, include Windows.h
493
+ # Import library User32.lib
494
+ # Minimum operating systems Windows 95, Windows NT 3.1
495
+ # Unicode Implemented as Unicode version.
496
+ # ---
497
+ # See Also: DestroyMenu, GetMenu
498
+ #
499
+ # ---
500
+ # <b>Enhanced (snake_case) API: menu_handle argument optional</b>
501
+ #
502
+ # :call-seq:
503
+ # success = set_menu(window_handle, menu_handle)
504
+ #
505
+ function :SetMenu, [:HWND, :HMENU], :int8, boolean: true,
506
+ &->(api, window_handle, menu_handle=nil){
507
+ api.call window_handle, menu_handle ? menu_handle : 0}
508
+
509
+ ##
510
+ # The AppendMenu function appends a new ITEM to the end of the specified menu bar, drop-down menu, submenu, or
511
+ # shortcut menu. You can use this function to specify the content, appearance, and behavior of the menu item.
512
+ #
513
+ # [*Syntax*] BOOL AppendMenu( HMENU hMenu, UINT uFlags, UINT_PTR uIDNewItem, LPCTSTR lpNewItem );
514
+ #
515
+ # hMenu:: <in> Handle to the menu bar, drop-down menu, submenu, or shortcut menu to be changed.
516
+ # uFlags:: <in> Specifies flags to control the appearance and behavior of the new menu item. This
517
+ # parameter can be a combination of the values listed in the following Remarks section.
518
+ # uIDNewItem:: <in> Specifies either the identifier of the new menu item or, if the uFlags parameter is
519
+ # set to MF_POPUP, a handle to the drop-down menu or submenu.
520
+ # lpNewItem:: <in> Specifies the content of the new menu item. The interpretation of lpNewItem depends
521
+ # on whether the uFlags parameter includes the MF_BITMAP, MF_OWNERDRAW, or MF_STRING flag,
522
+ # as shown in the following table.
523
+ # MF_BITMAP:: Contains a bitmap handle.
524
+ # MF_OWNERDRAW:: Contains an application-supplied value that can be used to maintain additional
525
+ # data related to the menu item. The value is in the itemData member of the structure
526
+ # pointed to by the lParam parameter of the WM_MEASUREITEM or WM_DRAWITEM message
527
+ # sent when the menu is created or its appearance is updated.
528
+ # MF_STRING:: Contains a pointer to a null-terminated string.
529
+ #
530
+ # *Returns*:: If the function succeeds, the return value is nonzero. If the function fails, the return
531
+ # value is zero. To get extended error information, call GetLastError.
532
+ # ---
533
+ # *Remarks*:
534
+ # The application must call the DrawMenuBar function whenever a menu changes, whether or not the menu is
535
+ # in a displayed window.
536
+ # To get keyboard accelerators to work with bitmap or owner-drawn menu items, the owner of the menu must
537
+ # process the WM_MENUCHAR message. For more information, see Owner-Drawn Menus and the WM_MENUCHAR Message.
538
+ # The following flags can be set in the uFlags parameter:
539
+ # MF_BITMAP:: Uses a bitmap as the menu item. The lpNewItem parameter contains a handle to the bitmap.
540
+ # MF_CHECKED:: Places a check mark next to the menu item. If the application provides check-mark bitmaps
541
+ # (see SetMenuItemBitmaps, this flag displays the check-mark bitmap next to the menu item.)
542
+ # MF_DISABLED:: Disables the menu item so that it cannot be selected, but the flag does not gray it.
543
+ # MF_ENABLED:: Enables the menu item so that it can be selected, and restores it from its grayed state.
544
+ # MF_GRAYED:: Disables the menu item and grays it so that it cannot be selected.
545
+ # MF_MENUBARBREAK:: Functions the same as the MF_MENUBREAK flag for a menu bar. For a drop-down menu, submenu,
546
+ # or shortcut menu, the new column is separated from the old column by a vertical line.
547
+ # MF_MENUBREAK:: Places the item on a new line (for a menu bar) or in a new column (for a drop-down menu,
548
+ # submenu, or shortcut menu) without separating columns.
549
+ # MF_OWNERDRAW:: Specifies that the item is an owner-drawn item. Before the menu is displayed for the
550
+ # first time, the window that owns the menu receives a WM_MEASUREITEM message to retrieve
551
+ # the width and height of the menu item. The WM_DRAWITEM message is then sent to the window
552
+ # procedure of the owner window whenever the appearance of the menu item must be updated.
553
+ # MF_POPUP:: Specifies that the menu item opens a drop-down menu or submenu. The uIDNewItem parameter
554
+ # specifies a handle to the drop-down menu or submenu. This flag is used to add a menu name to a menu
555
+ # bar, or a menu item that opens a submenu to a drop-down menu, submenu, or shortcut menu.
556
+ # MF_SEPARATOR:: Draws a horizontal dividing line. This flag is used only in a drop-down menu, submenu, or
557
+ # shortcut menu. The line cannot be grayed, disabled, or highlighted. The lpNewItem and uIDNewItem
558
+ # parameters are ignored.
559
+ # MF_STRING:: Specifies that the menu item is a text string; the lpNewItem parameter is a pointer to the string.
560
+ # MF_UNCHECKED:: Does not place a check mark next to the item (default). If the application supplies check-mark
561
+ # bitmaps (see SetMenuItemBitmaps), this flag displays the clear bitmap next to the menu item.
562
+ # The following groups of flags cannot be used together:
563
+ # MF_BITMAP, MF_STRING, and MF_OWNERDRAW
564
+ # MF_CHECKED and MF_UNCHECKED
565
+ # MF_DISABLED, MF_ENABLED, and MF_GRAYED
566
+ # MF_MENUBARBREAK and MF_MENUBREAK
567
+ # ---
568
+ # Minimum DLL Version user32.dll
569
+ # Header Declared in Winuser.h, include Windows.h
570
+ # Import library User32.lib
571
+ # Minimum operating systems Windows 95, Windows NT 3.1
572
+ # Unicode Implemented as ANSI and Unicode versions.
573
+ # ---
574
+ # See Also:
575
+ # CreateMenu, DeleteMenu, DestroyMenu, DrawMenuBar, InsertMenu, InsertMenuItem, ModifyMenu,
576
+ # RemoveMenu, SetMenuItemBitmaps
577
+ #
578
+ # ---
579
+ # <b>Enhanced (snake_case) API: </b>
580
+ #
581
+ # :call-seq:
582
+ # success = append_menu(menu_handle, flags, id_new_item, lp_new_item)
583
+ #
584
+ function :AppendMenu, [:HMENU, :UINT, :UINT, :pointer], :int8, boolean: true
585
+
586
+ ##
587
+ # The InsertMenu function inserts a new menu item into a menu, moving other items down the menu.
588
+ # Note The InsertMenu function has been superseded by the InsertMenuItem function. You can still use
589
+ # InsertMenu, however, if you do not need any of the extended features of InsertMenuItem.
590
+ #
591
+ # [*Syntax*] BOOL InsertMenu( HMENU hMenu, UINT uPosition, UINT uFlags, PTR uIDNewItem, LPCTSTR
592
+ # lpNewItem );
593
+ #
594
+ # hMenu:: <in> Handle to the menu to be changed.
595
+ # uPosition:: <in> Specifies the menu item before which the new menu item is to be inserted, as
596
+ # determined by the uFlags parameter.
597
+ # uFlags:: <in> Specifies flags that control the interpretation of the uPosition parameter and the content,
598
+ # appearance, and behavior of the new menu item. This parameter must be a combination of one of the
599
+ # following required values and at least one of the values listed in the following Remarks section.
600
+ # MF_BYCOMMAND:: Indicates that the uPosition parameter gives the identifier of the menu item.
601
+ # MF_BYCOMMAND flag is the default if neither MF_BYCOMMAND nor MF_BYPOSITION specified.
602
+ # MF_BYPOSITION:: Indicates that the uPosition parameter gives the zero-based relative position of the
603
+ # new menu item. If uPosition is -1, new menu item is appended to the end of the menu.
604
+ # uIDNewItem:: <in> Specifies either the identifier of the new menu item or, if the uFlags parameter has
605
+ # the MF_POPUP flag set, a handle to the drop-down menu or submenu.
606
+ # lpNewItem:: <in> Specifies the content of the new menu item. The interpretation of lpNewItem depends on whether
607
+ # the uFlags parameter includes the MF_BITMAP, MF_OWNERDRAW, or MF_STRING flag, as follows:
608
+ # MF_BITMAP:: Contains a bitmap handle.
609
+ # MF_OWNERDRAW:: Contains an application-supplied value that can be used to maintain additional data
610
+ # related to the menu item. The value is in the itemData member of the structure
611
+ # pointed to by the lParam parameter of the WM_MEASUREITEM or WM_DRAWITEM message sent
612
+ # when the menu item is created or its appearance is updated.
613
+ # MF_STRING:: Contains a pointer to a null-terminated string (the default).
614
+ #
615
+ # *Returns*:: If the function succeeds, the return value is nonzero.
616
+ # If the function fails, the return value is zero. To get extended error information, call GetLastError.
617
+ # ---
618
+ # *Remarks*:
619
+ # The application must call the DrawMenuBar function whenever a menu changes, whether or not the menu is
620
+ # in a displayed window.
621
+ # The following list describes the flags that can be set in the uFlags parameter:
622
+ # MF_BITMAP:: Uses a bitmap as the menu item. The lpNewItem parameter contains a handle to the bitmap.
623
+ # MF_CHECKED:: Places a check mark next to the menu item. If the application provides check-mark bitmaps
624
+ # (see SetMenuItemBitmaps), this flag displays the check-mark bitmap next to the menu item.
625
+ # MF_DISABLED:: Disables the menu item so that it cannot be selected, but does not gray it.
626
+ # MF_ENABLED:: Enables the menu item so that it can be selected and restores it from its grayed state.
627
+ # MF_GRAYED:: Disables the menu item and grays it so it cannot be selected.
628
+ # MF_MENUBARBREAK:: Functions the same as the MF_MENUBREAK flag for a menu bar. For a drop-down menu, submenu, or
629
+ # shortcut menu, the new column is separated from the old column by a vertical line.
630
+ # MF_MENUBREAK:: Places the item on a new line (for menu bars) or in a new column (for a drop-down menu,
631
+ # submenu, or shortcut menu) without separating columns.
632
+ # MF_OWNERDRAW:: Specifies that the item is an owner-drawn item. Before the menu is displayed for the first time,
633
+ # the window that owns the menu receives a WM_MEASUREITEM message to retrieve the width and
634
+ # height of the menu item. The WM_DRAWITEM message is then sent to the window procedure of the
635
+ # owner window whenever the appearance of the menu item must be updated.
636
+ # MF_POPUP:: Specifies that the menu item opens a drop-down menu or submenu. The uIDNewItem parameter
637
+ # specifies a handle to the drop-down menu or submenu. This flag is used to add a menu name to a menu
638
+ # bar or a menu item that opens a submenu to a drop-down menu, submenu, or shortcut menu.
639
+ # MF_SEPARATOR:: Draws a horizontal dividing line. This flag is used only in a drop-down menu, submenu, or
640
+ # shortcut menu. The line cannot be grayed, disabled, or highlighted. The lpNewItem and uIDNewItem
641
+ # parameters are ignored.
642
+ # MF_STRING:: Specifies that the menu item is a text string; the lpNewItem parameter is a pointer to the string.
643
+ # MF_UNCHECKED:: Does not place a check mark next to the menu item (default). If the application supplies
644
+ # check-mark bitmaps (see the SetMenuItemBitmaps function), this flag displays the clear bitmap
645
+ # next to the menu item.
646
+ # The following groups of flags cannot be used together:
647
+ # MF_BYCOMMAND and MF_BYPOSITION
648
+ # MF_DISABLED, MF_ENABLED, and MF_GRAYED
649
+ # MF_BITMAP, MF_STRING, MF_OWNERDRAW, and MF_SEPARATOR
650
+ # MF_MENUBARBREAK and MF_MENUBREAK
651
+ # MF_CHECKED and MF_UNCHECKED
652
+ # ---
653
+ # Minimum DLL Version user32.dll
654
+ # Header Declared in Winuser.h, include Windows.h
655
+ # Import library User32.lib
656
+ # Minimum operating systems Windows 95, Windows NT 3.1
657
+ # Unicode Implemented as ANSI and Unicode versions.
658
+ # ---
659
+ # See Also: AppendMenu, DeleteMenu, DrawMenuBar, InsertMenuItem, ModifyMenu, RemoveMenu,
660
+ # SetMenuItemBitmaps, WM_DRAWITEM, WM_MEASUREITEM
661
+ #
662
+ # ---
663
+ # <b>Enhanced (snake_case) API: returns true/false instead of 1/0</b>
664
+ #
665
+ # :call-seq:
666
+ # success = insert_menu(menu_handle, position, flags, id_new_item, lp_new_item)
667
+ #
668
+ function :InsertMenu, [:HMENU, :UINT, :UINT, :UINT, :pointer], :int8, boolean: true
669
+
670
+ ##
671
+ # The DeleteMenu function deletes an item from the specified menu. If the menu item opens a menu or submenu,
672
+ # this function destroys the handle to the menu or submenu and frees the memory used by the menu or submenu.
673
+ #
674
+ # [*Syntax*] BOOL DeleteMenu( HMENU hMenu, UINT uPosition, UINT uFlags );
675
+ #
676
+ # hMenu:: <in> Handle to the menu to be changed.
677
+ # uPosition:: <in> Specifies the menu item to be deleted, as determined by the uFlags parameter.
678
+ # uFlags:: <in> Specifies how the uPosition parameter is interpreted. This parameter must be one of the
679
+ # following values.
680
+ # MF_BYCOMMAND:: Indicates that uPosition gives the identifier of the menu item. The MF_BYCOMMAND
681
+ # flag is the default flag if neither MF_BYCOMMAND nor MF_BYPOSITION flag is specified.
682
+ # MF_BYPOSITION:: Indicates that uPosition gives the zero-based relative position of the menu item.
683
+ #
684
+ # *Returns*:: If the function succeeds, the return value is nonzero.
685
+ # If the function fails, the return value is zero. To get extended error information, call GetLastError.
686
+ # ---
687
+ # *Remarks*:
688
+ # The application must call the DrawMenuBar function whenever a menu changes, whether or not the menu is
689
+ # in a displayed window.
690
+ # ---
691
+ # Minimum DLL Version user32.dll
692
+ # Header Declared in Winuser.h, include Windows.h
693
+ # Import library User32.lib
694
+ # Minimum operating systems Windows 95, Windows NT 3.1
695
+ # Unicode Implemented as Unicode version.
696
+ # ---
697
+ # See Also: DrawMenuBar, RemoveMenu
698
+ #
699
+ # ---
700
+ # <b>Enhanced (snake_case) API: returns true/false instead of 1/0</b>
701
+ #
702
+ # :call-seq:
703
+ # success = delete_menu(menu_handle, position, flags)
704
+ #
705
+ function :DeleteMenu, [:HMENU, :UINT, :UINT], :int8, boolean: true
706
+
707
+
708
+ # Untested:
709
+
710
+ function :CheckMenuItem, 'LII', 'L'
711
+ function :CheckMenuRadioItem, 'LIIII', :int8, boolean: true
712
+ function :CreatePopupMenu, [], 'L'
713
+ function :DrawMenuBar, 'L', :int8, boolean: true
714
+ function :EnableMenuItem, 'LII', :int8, boolean: true
715
+ function :EndMenu, [], :int8, boolean: true
716
+ function :GetMenuBarInfo, 'LLLP', :int8, boolean: true
717
+ function :GetMenuCheckMarkDimensions, [], 'L'
718
+ function :GetMenuDefaultItem, 'LII', 'I'
719
+ function :GetMenuInfo, 'LP', :int8, boolean: true
720
+ function :GetMenuItemInfo, 'LIIP', :int8, boolean: true
721
+ function :GetMenuItemRect, 'LLIP', :int8, boolean: true
722
+ function :GetMenuState, 'LLI', 'I'
723
+ function :GetMenuString, 'LIPII', 'I'
724
+ function :HiliteMenuItem, 'LLII', :int8, boolean: true
725
+ function :InsertMenuItem, 'LIIP', :int8, boolean: true
726
+ function :LoadMenu, 'LP', 'L'
727
+ function :LoadMenuIndirect, 'P', 'L'
728
+ function :MenuItemFromPoint, 'LLP', 'I'
729
+ function :ModifyMenu, 'LIIPP', :int8, boolean: true
730
+ function :RemoveMenu, 'LII', :int8, boolean: true
731
+ function :SetMenuDefaultItem, 'LLL', :int8, boolean: true
732
+ function :SetMenuInfo, 'LP', :int8, boolean: true
733
+ function :SetMenuItemBitmaps, 'LIILL', :int8, boolean: true
734
+ function :SetMenuItemInfo, 'LIIP', :int8, boolean: true
735
+ function :TrackPopupMenu, 'LIIIILP', :int8, boolean: true
736
+ function :TrackPopupMenuEx, 'LIIILP', :int8, boolean: true
737
+
738
+ end
739
+ end
740
+ end