Can I call Windows API functions from a MEX file?

2 views (last 30 days)
I would like to call Windows API functions from a MEX file.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
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)

MathWorks Support

Categories

Find more on Write C Functions Callable from MATLAB (MEX Files) in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!