Chris wrote:
In the body of a function? In a function call (expression)? I think both of these work, so perhaps you could give an example.
Maybe it's the help file being vague again.
This seems to work ok:
Code:
; CMDret (DLL version) examples
CMD := COMSPEC " /C set"
hModule := DllCall("LoadLibrary", "str", "cmdret.dll","UInt")
VarSetCapacity(StrOut, 1000)
DllCall("lstrcpyA", "str", StrOut, "int", DllCall("cmdret.dll\RunRedirect", "str", CMD))
DllCall("FreeLibrary", "UInt", hModule)
MsgBox, %StrOut%
This doesn't (unless it's something that I'm misunderstanding). It dies asking if I'd like to send a report to M$.
Code:
; CMDret (DLL version) examples
ret1 := CMDreturn(COMSPEC " /C set")
MsgBox, %ret1%
CMDreturn(CMD)
{
hModule := DllCall("LoadLibrary", "str", "cmdret.dll","UInt")
VarSetCapacity(StrOut, 1000)
DllCall("lstrcpyA", "str", StrOut, "int", DllCall("cmdret.dll\RunRedirect", "str", CMD))
DllCall("FreeLibrary", "UInt", hModule)
Return StrOut
}
Edit: Spelling typos