How to know if native method is safe / unsafe?

后端 未结 3 1523
轻奢々
轻奢々 2020-12-31 08:01

I implement this function : GetSystemPowerStatusEx & GetSystemPowerStatusEx2

according to this article on MSDN, I should create a class named according to the fu

3条回答
  •  無奈伤痛
    2020-12-31 08:14

    Put them inside the class you are going to use them as a static methods, then wrap around them with normal methods so you won't bother the rest of the application with the notion that there is something extern involved.

    I use that approach and it never fails.

    EDIT:

    Check this out:

    http://pinvoke.net/search.aspx?search=GetSystemPowerStatusEx

提交回复
热议问题