ExternalFunctionCallback.st
changeset 24756 fca38270ff24
parent 24338 9516492f8920
child 25087 6be980cf75e3
equal deleted inserted replaced
24755:9ceec9c7e546 24756:fca38270ff24
       
     1 "{ Encoding: utf8 }"
       
     2 
     1 "
     3 "
     2  COPYRIGHT (c) 2007 by eXept Software AG
     4  COPYRIGHT (c) 2007 by eXept Software AG
     3 	      All Rights Reserved
     5 	      All Rights Reserved
     4 
     6 
     5  This software is furnished under a license and may be used
     7  This software is furnished under a license and may be used
   403 
   405 
   404 !ExternalFunctionCallback class methodsFor:'instance creation'!
   406 !ExternalFunctionCallback class methodsFor:'instance creation'!
   405 
   407 
   406 callbackFor:aBlock returnType:returnType argumentTypes:argumentTypes
   408 callbackFor:aBlock returnType:returnType argumentTypes:argumentTypes
   407     "generate a callback for the ErrorCallbackProc signature:
   409     "generate a callback for the ErrorCallbackProc signature:
   408 	ErrorCallbackProc(HWND hWnd, int nErrID, LPTSTR lpErrorText)
   410         ErrorCallbackProc(HWND hWnd, int nErrID, LPTSTR lpErrorText)
   409      which, can be given to an external API call and which invokes the
   411      which, can be given to an external API call and which invokes the
   410      three arg block when clled.
   412      three arg block when clled.
   411      Do not forget to eventually release the callback to avoid a memory leak."
   413      Do not forget to eventually release the callback to avoid a memory leak."
   412 
   414 
   413     |cb|
   415     |cb|
   414 
   416 
   415     self assert:(aBlock numArgs == argumentTypes size).
   417     self assert:(aBlock argumentCount == argumentTypes size).
   416 
   418 
   417     cb := ExternalFunctionCallback new.
   419     cb := ExternalFunctionCallback new.
   418     cb returnType:returnType argumentTypes:argumentTypes.
   420     cb returnType:returnType argumentTypes:argumentTypes.
   419     cb beCallTypeWINAPI.
   421     cb beCallTypeWINAPI.
   420     cb generateClosure.
   422     cb generateClosure.
  1003 !
  1005 !
  1004 
  1006 
  1005 version_CVS
  1007 version_CVS
  1006     ^ '$Header$'
  1008     ^ '$Header$'
  1007 ! !
  1009 ! !
       
  1010