读书人

把other的lparam转换为结构类型?该怎

发布时间: 2012-03-09 21:42:54 作者: rapoo

把other的lparam转换为结构类型?
我在other收到一个消息后,已经知道lparam是某个结构的指针,但是lparam只是一个数字,如何把它转换为某个结构的值?

注意,我需要的是lparam里面的结构与定义的变量的地址相同(地址引用),而不是简单的值COPY。

[解决办法]
pb处理不了指针,要么用API,定义成ref 变量
[解决办法]

C# code
// 声明 APISubroutine CopyMemory(ref s_rect destination, ulong source, ulong length) library "kernel32.dll" Alias for "RtlMoveMemory"Subroutine CopyMemory(ulong destination, s_rect source, ulong length) library "kernel32.dll" Alias for "RtlMoveMemory"// other 中截获 532int li_widthLimit = 1800long ll_wparams_rect lstr_rect // 矩形结构体ll_wparam = wparamli_widthLimit = UnitsToPixels(li_widthLimit, XUnitsToPixels!)CopyMemory(lstr_rect, lparam, 16)if lstr_rect.Right - lstr_rect.Left < li_widthLimit then    choose case ll_WParam        case 1,4,7            lstr_rect.Left = lstr_rect.Right - li_widthLimit        case 2,5,8            lstr_Rect.Right = lstr_Rect.Left + li_widthLimit        case else            //    end chooseend ifCopyMemory(lparam, lstr_rect, 16) 

读书人网 >PB

热点推荐