Guidance
指路人
g.yi.org
software / rapidq / Examples / Win32API & DLL / UDT arguments.bas

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
'From:   Trenchtownman  Wed Nov 12, 2003  1:01 am

'problem with nested UDT when try use

'---------------------------------------------
'idcolumn1=  SENDMESSAGEa(hh, HDM_HITTEST,0,      M_HDPointer    ) 'get
'number of columns

'when M_HDPointer - Pointer to an HD_HITTESTINFO structure that contains
'the position to test and receives information about the results of the
'test.

'Type POINT
'        x As Long
'        y As Long
'End Type

'type  HD_HITTESTINFO
'    pt As Point '-- !!!
'    flags as long
'    iItem as long
'END TYPE
'----------------------------------------------------------
'How to do with nested UDT passed in API calls ?

' can use this structure?

'type  HD_HITTESTINFO
''    pt As Point '-- !!!
'        x As Long
'        y As Long
'    flags as long
'    iItem as long
'END TYPE

'and it will be equivalent to this ?

'type  HD_HITTESTINFO
'    pt As Point '-- !!!
'    flags as long
'    iItem as long
'END TYPE

'Well, the problem with UDT is that RapidQ stores UDT data in non-contiguous memory spaces.
'However, the "safe" mode should be:

'-------------------------------------------------------------
     TYPE Point
      x AS LONG
      y AS LONG
     END TYPE

     TYPE  HD_HITTESTINFO
      pt AS LONG       ' Note that is LONG instead of POINT
      flags AS LONG
      iItem AS LONG
     END TYPE

     DIM PointStr AS QMEMORYSTREAM
     DIM Point AS Point
     Point.x = 789
     point.y = 123
     PointStr.WriteUDT(Point)

     DIM HitTestInfo AS HD_HITTESTINFO
     HitTestInfo.pt = Pointstr.Pointer

     idcolumn1=  SENDMESSAGEa(hh, HDM_HITTEST,0, M_HDPointer)

'-----------------------------------------------------
' OTHERWISE... (but I have never used it and, likely,
'  it won't work )
'-----------------------------------------------------

     TYPE  HD_HITTESTINFO
      x AS LONG
      y AS LONG
      flags AS LONG
      iItem AS LONG
     END TYPE

     DIM HitStr AS QMEMORYSTREAM

     DIM HitTestInfo AS HD_HITTESTINFO
     HitTestInfo.x = 789
     HitTestInfo.y = 123
'... and so on

     Hitstr.WriteUDT(HitTestInfo)

     idcolumn1=  SENDMESSAGEa(hh, HDM_HITTEST,0, HitStr.Pointer)
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Thu 2024-4-25  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2003-11-12 10:06:55