Call User32 API in .NET.

I am currently planning a project involving the creation of a shell replacement for Windows (based on Blackbox, bblean specifically). However, I want to use .NET features for this. Many of the API calls I need are hosted in the User32 library. I can of course use P / Invoke and create a static class to handle this for me.

However, many of these functions are already available in the .NET platform, especially in the System.Management namespace for processing processes and active windows, etc. Some of them seem to be missing, for example, the SetForegroundWindow functions.

Do you know anything built into the .NET environment that already provides this functionality, or will I need to use the P / Invoke route?

+4
source share
2 answers

I recently experimented with creating my own window system, really just creating new borders around all windows, but it required a lot of functions from the Win32 API, which I add to P / Invoke in.

But .NET has a ready-to-use library that wraps most of the already found Win32 API here

+3
source

Unfortunately, for many things you will have to go along the P / Invoke route. Fortunately, pinvoke.net with definitions for many Win32 APIs.

+1
source

Source: https://habr.com/ru/post/1277484/


All Articles