Can I call Windows API functions from a MEX file?

I would like to call Windows API functions from a MEX file.

 Accepted Answer

Calling Windows API functions from MEX files has not been tested by MathWorks. Therefore we are not aware of all of the issues that this may cause.
Calling Windows API functions can easily affect the stability of a MATLAB session. Additionally, many Windows API functions require the handle to the window of the running executable process. This handle is not available within MEX files.
You may be able to get some of the functionality from Windows API functions by linking against the Windows API libraries and including the appropriate header files. However, again, this has not been tested and can easily render the MATLAB process unstable.
The Related Solution at the bottom of the page documents how to link against external dynamically linked libraries from a MEX file.

More Answers (0)

Categories

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!