win 0.1.18 → 0.1.22

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.18
1
+ 0.1.22
data/lib/win/dde.rb CHANGED
@@ -267,6 +267,8 @@ module Win
267
267
 
268
268
  # Errors Hash {ERROR_CODE=>'Error description')}
269
269
  ERRORS = {
270
+ nil => 'No DDEML error',
271
+ DMLERR_NO_ERROR => 'No DDEML error',
270
272
  DMLERR_ADVACKTIMEOUT => 'A request for a synchronous advise transaction has timed out.',
271
273
  DMLERR_BUSY => 'The response to the transaction caused the DDE_FBUSY flag to be set.',
272
274
  DMLERR_DATAACKTIMEOUT => 'A request for a synchronous data transaction has timed out.',
@@ -303,6 +305,37 @@ module Win
303
305
  'that callback function is no longer valid.'
304
306
  }
305
307
 
308
+ # Predefined Clipboard Formats:
309
+
310
+ # The simplest form of Clipboard data. It is a null-terminated string containing a carriage return
311
+ # and linefeed at the end of each line.
312
+ CF_TEXT = 1
313
+ # A Windows version 2.x-compatible bitmap
314
+ CF_BITMAP = 2
315
+ # A metafile picture structure. See docs for Microsoft Windows Software Development Kit.
316
+ CF_METAFILEPICT = 3
317
+ # Microsoft symbolic link (SYLK) format. Microsoft Excel for the Apple Macintosh was originally designed to use
318
+ # SYLK format, and this format is now supported by Microsoft Excel on both the Windows and Macintosh platforms
319
+ CF_SYLK = 4
320
+ # An ASCII format used by the VisiCalc spreadsheet program
321
+ CF_DIF = 5
322
+ CF_TIFF = 6
323
+ CF_OEMTEXT = 7
324
+ CF_DIB = 8
325
+ CF_PALETTE = 9
326
+ CF_PENDATA = 10
327
+ CF_RIFF = 11
328
+ CF_WAVE = 12
329
+ CF_UNICODETEXT = 13
330
+ CF_ENHMETAFILE = 14
331
+ # Filename copied to clipboard
332
+ CF_HDROP = 15
333
+ CF_LOCALE = 16
334
+ CF_MAX = 17
335
+
336
+ # DdeClientTransaction timeout value indicating async transaction
337
+ TIMEOUT_ASYNC = 0xFFFFFFFF
338
+
306
339
  ##
307
340
  # The RegisterClipboardFormat function registers a new clipboard format.
308
341
  # This format can then be used as a valid clipboard format.
@@ -473,9 +506,9 @@ module Win
473
506
  &->(api, old_id=0, cmd, &block){
474
507
  raise ArgumentError, 'No callback block' unless block
475
508
  old_id = 0 unless old_id
476
- id = FFI::MemoryPointer.new(:long).write_long(old_id)
509
+ id = FFI::MemoryPointer.new(:long).put_uint32(0, old_id)
477
510
  status = api.call(id, block, cmd, 0)
478
- id = status == 0 ? id.read_long() : nil
511
+ id = status == 0 ? id.get_uint32(0) : nil
479
512
  [id, status] }
480
513
  # weird lambda literal instead of block is needed because RDoc goes crazy if block is attached to meta-definition
481
514
 
@@ -531,7 +564,8 @@ module Win
531
564
  # string_handle = dde_create_string_handle( instance_id, string, code_page_id )
532
565
  #
533
566
  function :DdeCreateStringHandle, [:uint32, :pointer, :int], :ulong, zeronil: true,
534
- &->(api, instance_id, string, code_page=CP_WINANSI){ api.call(instance_id, string, code_page) }
567
+ &->(api, instance_id, string, code_page=CP_WINANSI){
568
+ api.call(instance_id, FFI::MemoryPointer.from_string(string), code_page) }
535
569
 
536
570
  ##
537
571
  # The DdeFreeStringHandle function frees a string handle in the calling application.
@@ -774,5 +808,107 @@ module Win
774
808
  #
775
809
  function :DdeGetLastError, [:uint32], :int, zeronil: true
776
810
 
811
+ ##
812
+ # The DdeClientTransaction function begins a data transaction between a client and a server. Only a
813
+ # Dynamic Data Exchange (DDE) client application can call this function, and the application can use it
814
+ # only after establishing a conversation with the server.
815
+ #
816
+ # [*Syntax*] HDDEDATA DdeClientTransaction( LPBYTE pData, DWORD cbData, HCONV hConv, HSZ hszItem, UINT
817
+ # wFmt, UINT wType, DWORD dwTimeout, LPDWORD pdwResult );
818
+ #
819
+ # pData:: [in] Pointer to the beginning of the data the client must pass to the server.
820
+ # Optionally, an application can specify the data handle (HDDEDATA) to pass to the server and in that
821
+ # case the cbData parameter should be set to -1. This parameter is required only if the wType parameter
822
+ # is XTYP_EXECUTE or XTYP_POKE. Otherwise, this parameter should be NULL.
823
+ # For the optional usage of this parameter, XTYP_POKE transactions where pData is a data handle, the
824
+ # handle must have been created by a previous call to the DdeCreateDataHandle function, employing the
825
+ # same data format specified in the wFmt parameter.
826
+ # cbData:: [in] Specifies the length, in bytes, of the data pointed to by the pData parameter, including
827
+ # the terminating NULL, if the data is a string. A value of -1 indicates that pData is a data
828
+ # handle that identifies the data being sent.
829
+ # hConv:: [in] Handle to the conversation in which the transaction is to take place.
830
+ # hszItem:: [in] Handle to the data item for which data is being exchanged during the transaction. This
831
+ # handle must have been created by a previous call to the DdeCreateStringHandle function. This
832
+ # parameter is ignored (and should be set to 0L) if the wType parameter is XTYP_EXECUTE.
833
+ # wFmt:: [in] Specifies the standard clipboard format in which the data item is being submitted or
834
+ # requested. If the transaction specified by the wType parameter does not pass data or is XTYP_EXECUTE,
835
+ # this parameter should be zero.
836
+ # If the transaction specified by the wType parameter references non-execute DDE data ( XTYP_POKE,
837
+ # XTYP_ADVSTART, XTYP_ADVSTOP, XTYP_REQUEST), the wFmt value must be either a valid predefined (CF_) DDE
838
+ # format or a valid registered clipboard format.
839
+ # wType:: [in] Specifies the transaction type. This parameter can be one of the following values.
840
+ # - XTYP_ADVSTART: Begins an advise loop. Any number of distinct advise loops can exist within a
841
+ # conversation. An application can alter the advise loop type by combining the XTYP_ADVSTART
842
+ # transaction type with one or more of the following flags: Flag Meaning
843
+ # - XTYPF_NODATA Instructs the server to notify the client of any data changes without actually sending
844
+ # the data. This flag gives the client the option of ignoring the notification or requesting the changed
845
+ # data from the server.
846
+ # - XTYPF_ACKREQ Instructs the server to wait until the client acknowledges that it received the previous
847
+ # data item before sending the next data item. This flag prevents a fast server from sending data faster
848
+ # than the client can process it.
849
+ # - XTYP_ADVSTOP: Ends an advise loop.
850
+ # - XTYP_EXECUTE: Begins an execute transaction.
851
+ # - XTYP_POKE: Begins a poke transaction.
852
+ # - XTYP_REQUEST: Begins a request transaction.
853
+ # dwTimeout:: [in] Specifies the maximum amount of time, in milliseconds, that the client will wait for
854
+ # a response from the server application in a synchronous transaction. This parameter should
855
+ # be TIMEOUT_ASYNC for asynchronous transactions.
856
+ # pdwResult:: [out] Pointer to a variable that receives the result of the transaction. An application
857
+ # that does not check the result can use NULL for this value. For synchronous transactions,
858
+ # the low-order word of this variable contains any applicable DDE_ flags resulting from the
859
+ # transaction. This provides support for applications dependent on DDE_APPSTATUS bits. It
860
+ # is, however, recommended that applications no longer use these bits because they may not
861
+ # be supported in future versions of the Dynamic Data Exchange Management Library (DDEML).
862
+ # For asynchronous transactions, this variable is filled with a unique transaction
863
+ # identifier for use with the DdeAbandonTransaction function and the XTYP_XACT_COMPLETE
864
+ # transaction.
865
+ #
866
+ # *Returns*:: If the function succeeds, the return value is a data handle that identifies the data for
867
+ # successful synchronous transactions in which the client expects data from the server. The
868
+ # return value is nonzero for successful asynchronous transactions and for synchronous
869
+ # transactions in which the client does not expect data. The return value is zero for all
870
+ # unsuccessful transactions.
871
+ # The DdeGetLastError function can be used to get the error code, which can be one of the following values:
872
+ # - DMLERR_ADVACKTIMEOUT
873
+ # - DMLERR_BUSY
874
+ # - DMLERR_DATAACKTIMEOUT
875
+ # - DMLERR_DLL_NOT_INITIALIZED
876
+ # - DMLERR_EXECACKTIMEOUT
877
+ # - DMLERR_INVALIDPARAMETER
878
+ # - DMLERR_MEMORY_ERROR
879
+ # - DMLERR_NO_CONV_ESTABLISHED
880
+ # - DMLERR_NO_ERROR
881
+ # - DMLERR_NOTPROCESSED
882
+ # - DMLERR_POKEACKTIMEOUT
883
+ # - DMLERR_POSTMSG_FAILED
884
+ # - DMLERR_REENTRANCY
885
+ # - DMLERR_SERVER_DIED
886
+ # - DMLERR_UNADVACKTIMEOUT
887
+ # ---
888
+ # *Remarks*:
889
+ # When an application has finished using the data handle returned by DdeClientTransaction, the application should
890
+ # free the handle by calling the DdeFreeDataHandle function.
891
+ #
892
+ #Transactions can be synchronous or asynchronous. During a synchronous transaction, DdeClientTransaction does not
893
+ # return until the transaction either completes successfully or fails. Synchronous transactions cause a client to
894
+ # enter a modal loop while waiting for various asynchronous events. Because of this, a client application can still
895
+ # respond to user input while waiting on a synchronous transaction, but the application cannot begin a second
896
+ # synchronous transaction because of the activity associated with the first. DdeClientTransaction fails if any
897
+ # instance of the same task has a synchronous transaction already in progress.
898
+ #
899
+ # During an asynchronous transaction, DdeClientTransaction returns after the transaction has begun,
900
+ # passing a transaction identifier for reference. When the server's DDE callback function finishes
901
+ # processing an asynchronous transaction, the system sends an XTYP_XACT_COMPLETE transaction to the
902
+ # client. This transaction provides the client with the results of the asynchronous transaction that it
903
+ # initiated by calling DdeClientTransaction. A client application can choose to abandon an asynchronous
904
+ # transaction by calling the DdeAbandonTransaction function.
905
+ # ---
906
+ # <b>Enhanced (snake_case) API: </b>
907
+ #
908
+ # :call-seq:
909
+ # data_handle = dde_client_transaction(data_pointer, size, conv, item, format, type, timeout, result)
910
+ #
911
+ function :DdeClientTransaction, [:pointer, :uint32, :ulong, :ulong, :uint, :uint, :uint32, :pointer], :HDDEDATA
912
+
777
913
  end
778
914
  end
data/lib/win/error.rb CHANGED
@@ -1142,19 +1142,19 @@ module Win
1142
1142
  # This function has no parameters.
1143
1143
  #
1144
1144
  # *Returns*:: The process error mode. This function returns one of the following values.
1145
- # SEM_FAILCRITICALERRORS:: The system does not display the critical-error-handler message box. Instead,
1146
- # the system sends the error to the calling process.
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 any
1149
- # descendant processes. This feature is only supported by certain processor
1150
- # architectures. For more information, see the Remarks section.
1151
- # After this value is set for a process, subsequent attempts to clear the
1152
- # value are ignored.
1153
- # SEM_NOGPFAULTERRORBOX:: The system does not display the general-protection-fault message box. This flag
1154
- # should only be set by debugging applications that handle general protection (GP)
1155
- # faults themselves with an exception handler.
1156
- # SEM_NOOPENFILEERRORBOX:: The system does not display a message box when it fails to find a file. Instead,
1157
- # the error is returned to the calling process.
1145
+ # SEM_FAILCRITICALERRORS:: The system does not display the critical-error-handler message box. Instead,
1146
+ # the system sends the error to the calling process.
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
1149
+ # any descendant processes. This feature is only supported by certain
1150
+ # processor architectures. For more information, see the Remarks section.
1151
+ # After this value is set for a process, subsequent attempts to clear the
1152
+ # value are ignored.
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
1155
+ # protection (GP) faults themselves with an exception handler.
1156
+ # SEM_NOOPENFILEERRORBOX:: The system does not display a message box when it fails to find a file.
1157
+ # Instead, the error is returned to the calling process.
1158
1158
  # ---
1159
1159
  # *Remarks*:
1160
1160
  # Each process has an associated error mode that indicates to the system how the application is going to
@@ -1166,7 +1166,7 @@ module Win
1166
1166
  # :call-seq:
1167
1167
  # mode = get_error_mode()
1168
1168
  #
1169
- try_function :GetErrorMode, [], :UINT
1169
+ try_function :GetErrorMode, [], :uint
1170
1170
  # fails silently unless platform is Vista++
1171
1171
 
1172
1172
  ##
@@ -9,6 +9,7 @@ module Win
9
9
  include Win::Library
10
10
  include Win::GUI::Window
11
11
 
12
+ ##
12
13
  # The GetDlgItem function retrieves a handle to a control in the specified dialog box.
13
14
  #
14
15
  # [*Syntax*] HWND GetDlgItem( HWND hDlg, int nIDDlgItem );
data/lib/win/gui/input.rb CHANGED
@@ -92,8 +92,6 @@ module Win
92
92
  # xi(0 To 23) As Byte
93
93
  # End Type
94
94
 
95
-
96
-
97
95
  # dwFlags:
98
96
  # Specifies that the dx and dy parameters contain normalized absolute coordinates. If not set, those parameters
99
97
  # contain relative data: the change in position since the last reported position. This flag can be set, or not
@@ -149,7 +147,7 @@ module Win
149
147
  # KEYEVENTF_EXTENDEDKEY, KEYEVENTF_KEYUP, KEYEVENTF_KEYDOWN
150
148
  # dwExtraInfo:: [in] Specifies an additional value associated with the key stroke.
151
149
  #
152
- # *Returns*:: nothing
150
+ # <b>NO Return Value</b>
153
151
  # ---
154
152
  # *Remarks*:
155
153
  # - An application can simulate a press of the PRINTSCRN key in order to obtain a screen snapshot
@@ -240,30 +238,6 @@ module Win
240
238
  #
241
239
  function :mouse_event, [:ulong, :ulong, :ulong, :ulong, :ulong, ], :void
242
240
 
243
- ##
244
- # GetCursorPos Function retrieves the cursor's position, in screen coordinates.
245
- #
246
- # [*Syntax*]: BOOL GetCursorPos( LPPOINT lpPoint );
247
- # Parameters
248
- #
249
- # lpPoint
250
- # [out] Pointer to a POINT structure that receives the screen coordinates of the cursor.
251
- # Return Value
252
- #
253
- # Returns nonzero if successful or zero otherwise. To get extended error information, call GetLastError.
254
- #
255
- #
256
- #
257
- #
258
- # Remarks
259
- #
260
- # The cursor position is always specified in screen coordinates and is not affected by the mapping mode of the window that contains the cursor.
261
- #
262
- # The calling process must have WINSTA_READATTRIBUTES access to the window station.
263
- #
264
- # The input desktop must be the current desktop when you call GetCursorPos. Call OpenInputDesktop to determine whether the current desktop is the input desktop. If it is not, call SetThreadDesktop with the HDESK returned by OpenInputDesktop to switch to that desktop.
265
-
266
-
267
241
  ##
268
242
  # SetCursorPos Function moves the cursor to the specified screen coordinates. If the new coordinates are not
269
243
  # within the screen rectangle set by the most recent ClipCursor function call, the system automatically adjusts