开发者

AllocHGlobal equivalent in VB6

All,

I have to write some share permission code in a legacy VB6 application. I know I will have to use API calls, and found a good example here. But I'm not clear on 开发者_StackOverflow中文版how to achieve some of the same functionality from VB6, mostly with memory allocation. For example:

pTrustee = Marshal.AllocHGlobal(Marshal.SizeOf(t))
BuildTrusteeWithSid(pTrustee, pSID)

How would I do the same thing in VB6?


For the memory allocation you can use this Win32 API function call:

Declare Function GlobalAlloc Lib "kernel32" Alias "GlobalAlloc" ( _
ByVal wFlags As Long, _
ByVal dwBytes As Long _
) As Long

MSDN here

Similar MSDN pages for GlobalFree, GlobalLock and GlobalUnlock can be found at the MSDN Reference

For the BuildTrusteeWithSid method MSDN is here. With links to TRUSTEE struct documentation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜