Using AutoIt's DllCall function might be confusing at first. The biggest issue I encountered was on how to "translate" the C++ variable types to AutoIt variable types. In this article, we give some example of how some standard Microsoft DLL calls can be translated into AutoIt DLL calls. We give a brief explation of each function and then first show the function definition in C++ and then show how you can call the function from within AutoIt.
When using the RunAs or RunAsWait functions in AutoIt, you want to run an external program under the context of a different user. While doing this, there can be many things that may be the reason why the functions fails. The AutoIt Function Reference only states that if the function call failed that the return value is zero and that the @error flag is set to non-zero.
Using DllCall in AutoIt given you enormous power to extend the functionality of AutoIt. It allows you to implement almost everyting in AutoIt that you can implement in C++.
However, one of the most difficult things when working with DllCall is to know how to type the variables that you pass to DllCall.
The table below show how to convert C++ and Windows API types to AutoIt types: