Home > Net >  C # how to invoke parameter method of structure pointer
C # how to invoke parameter method of structure pointer

Time:11-07


This is I want to call the method, ELM_TEXT_INFO is a structure in the figure, I want to assign a value to a structure member, and then call this method, has been tried in the unsafe below, (textParam structures instantiated)

But to quote below fault

Could you tell me how to change it? (QiuShengYu strong rookie, don't spray )

CodePudding user response:

Defined as:
Ref ELM_TEXT_INFO pTextInfo

CodePudding user response:

reference 1st floor wanghui0380 response:
is defined as:
Ref ELM_TEXT_INFO pTextInfo

Thank you, but references, and there is other information: the data area passed to a system call is too small, (exception from HRESULT: 0 x8007007a)
If statement structure before a [StructLayout (LayoutKind. Explicit, CharSet=CharSet. The Unicode)]
Give members assigned values will mess, do you know this how to solve?

CodePudding user response:

Explicit is precise layout, need you manual control offset

Sequential order is to declare the layout, first using Sequential

This please myself baidu
I'll throw a brick
https://blog.csdn.net/aoshilang2249/article/details/39429731

Ps: the things you need to know, "pinvoke memory alignment", at the same time the need to test, because we have no way to know what each other with, so only conventional default test first, if not in in special test, if you have a c + + h head, translation was going to be easy

CodePudding user response:

Oh, look at the statement, you use the MSI, this is a commonly used foundation library, in theory it should be easy to find h header definition

However, aiming at a glance on the MSDN

Msi. H head didn't define

https://docs.microsoft.com/zh-cn/windows/win32/api/msi/

http://www.pinvoke.net also cannot search information

It's hard to say what you use
  •  Tags:  
  • C#
  • Related